Alexandre Julliard : comdlg32: Don' t use the instance of the owner window for dialog boxes.

Alexandre Julliard julliard at winehq.org
Mon Dec 28 09:16:09 CST 2009


Module: wine
Branch: master
Commit: 82016c19efadbd1866a89625e63d8e7af3109d36
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=82016c19efadbd1866a89625e63d8e7af3109d36

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 23 17:55:04 2009 +0100

comdlg32: Don't use the instance of the owner window for dialog boxes.

---

 dlls/comdlg32/filedlg.c  |    8 ++------
 dlls/comdlg32/printdlg.c |    6 ++++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 034403e..5e8f75e 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -3867,7 +3867,6 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d
                            UINT dlgType /* type dialogue : open/save */
                            )
 {
-    HINSTANCE hInst;
     BOOL bRet = FALSE;
     PFD31_DATA lfs;
 
@@ -3877,8 +3876,7 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d
     lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
     if (lfs)
     {
-        hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE );
-        bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner,
+        bRet = DialogBoxIndirectParamA( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
                                         FD32_FileOpenDlgProc, (LPARAM)lfs);
         FD31_DestroyPrivate(lfs);
     }
@@ -3896,7 +3894,6 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d
                            UINT dlgType /* type dialogue : open/save */
                            )
 {
-    HINSTANCE hInst;
     BOOL bRet = FALSE;
     PFD31_DATA lfs;
 
@@ -3905,8 +3902,7 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d
     lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
     if (lfs)
     {
-        hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE );
-        bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner,
+        bRet = DialogBoxIndirectParamW( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
                                         FD32_FileOpenDlgProc, (LPARAM)lfs);
         FD31_DestroyPrivate(lfs);
     }
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 72d8dd8..149694a 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -2080,7 +2080,6 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
         return FALSE;
     }
 
-    hInst = (HINSTANCE)GetWindowLongPtrA( lppd->hwndOwner, GWLP_HINSTANCE );
     if(TRACE_ON(commdlg)) {
         char flagstr[1000] = "";
 	const struct pd_flags *pflag = pd_flags;
@@ -2173,6 +2172,8 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
 	/* and create & process the dialog .
 	 * -1 is failure, 0 is broken hwnd, everything else is ok.
 	 */
+        hInst = COMDLG32_hInstance;
+	if (lppd->Flags & (PD_ENABLESETUPTEMPLATE | PD_ENABLEPRINTTEMPLATE)) hInst = lppd->hInstance;
 	bRet = (0<DialogBoxIndirectParamA(hInst, ptr, lppd->hwndOwner,
 					   PrintDlgProcA,
 					   (LPARAM)PrintStructures));
@@ -2230,7 +2231,6 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
         return FALSE;
     }
 
-    hInst = (HINSTANCE)GetWindowLongPtrW( lppd->hwndOwner, GWLP_HINSTANCE );
     if(TRACE_ON(commdlg)) {
         char flagstr[1000] = "";
 	const struct pd_flags *pflag = pd_flags;
@@ -2323,6 +2323,8 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
 	/* and create & process the dialog .
 	 * -1 is failure, 0 is broken hwnd, everything else is ok.
 	 */
+        hInst = COMDLG32_hInstance;
+	if (lppd->Flags & (PD_ENABLESETUPTEMPLATE | PD_ENABLEPRINTTEMPLATE)) hInst = lppd->hInstance;
 	bRet = (0<DialogBoxIndirectParamW(hInst, ptr, lppd->hwndOwner,
 					   PrintDlgProcW,
 					   (LPARAM)PrintStructures));




More information about the wine-cvs mailing list