Commit 82016c19 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 0e00a61a
...@@ -3867,7 +3867,6 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d ...@@ -3867,7 +3867,6 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d
UINT dlgType /* type dialogue : open/save */ UINT dlgType /* type dialogue : open/save */
) )
{ {
HINSTANCE hInst;
BOOL bRet = FALSE; BOOL bRet = FALSE;
PFD31_DATA lfs; PFD31_DATA lfs;
...@@ -3877,8 +3876,7 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d ...@@ -3877,8 +3876,7 @@ static BOOL GetFileName31A(LPOPENFILENAMEA lpofn, /* address of structure with d
lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE); lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, FALSE);
if (lfs) if (lfs)
{ {
hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE ); bRet = DialogBoxIndirectParamA( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner,
FD32_FileOpenDlgProc, (LPARAM)lfs); FD32_FileOpenDlgProc, (LPARAM)lfs);
FD31_DestroyPrivate(lfs); FD31_DestroyPrivate(lfs);
} }
...@@ -3896,7 +3894,6 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d ...@@ -3896,7 +3894,6 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d
UINT dlgType /* type dialogue : open/save */ UINT dlgType /* type dialogue : open/save */
) )
{ {
HINSTANCE hInst;
BOOL bRet = FALSE; BOOL bRet = FALSE;
PFD31_DATA lfs; PFD31_DATA lfs;
...@@ -3905,8 +3902,7 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d ...@@ -3905,8 +3902,7 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* address of structure with d
lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE); lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, TRUE);
if (lfs) if (lfs)
{ {
hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE ); bRet = DialogBoxIndirectParamW( COMDLG32_hInstance, lfs->template, lpofn->hwndOwner,
bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner,
FD32_FileOpenDlgProc, (LPARAM)lfs); FD32_FileOpenDlgProc, (LPARAM)lfs);
FD31_DestroyPrivate(lfs); FD31_DestroyPrivate(lfs);
} }
......
...@@ -2080,7 +2080,6 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd) ...@@ -2080,7 +2080,6 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
return FALSE; return FALSE;
} }
hInst = (HINSTANCE)GetWindowLongPtrA( lppd->hwndOwner, GWLP_HINSTANCE );
if(TRACE_ON(commdlg)) { if(TRACE_ON(commdlg)) {
char flagstr[1000] = ""; char flagstr[1000] = "";
const struct pd_flags *pflag = pd_flags; const struct pd_flags *pflag = pd_flags;
...@@ -2173,6 +2172,8 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd) ...@@ -2173,6 +2172,8 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
/* and create & process the dialog . /* and create & process the dialog .
* -1 is failure, 0 is broken hwnd, everything else is ok. * -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, bRet = (0<DialogBoxIndirectParamA(hInst, ptr, lppd->hwndOwner,
PrintDlgProcA, PrintDlgProcA,
(LPARAM)PrintStructures)); (LPARAM)PrintStructures));
...@@ -2230,7 +2231,6 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd) ...@@ -2230,7 +2231,6 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
return FALSE; return FALSE;
} }
hInst = (HINSTANCE)GetWindowLongPtrW( lppd->hwndOwner, GWLP_HINSTANCE );
if(TRACE_ON(commdlg)) { if(TRACE_ON(commdlg)) {
char flagstr[1000] = ""; char flagstr[1000] = "";
const struct pd_flags *pflag = pd_flags; const struct pd_flags *pflag = pd_flags;
...@@ -2323,6 +2323,8 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd) ...@@ -2323,6 +2323,8 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
/* and create & process the dialog . /* and create & process the dialog .
* -1 is failure, 0 is broken hwnd, everything else is ok. * -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, bRet = (0<DialogBoxIndirectParamW(hInst, ptr, lppd->hwndOwner,
PrintDlgProcW, PrintDlgProcW,
(LPARAM)PrintStructures)); (LPARAM)PrintStructures));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment