Commit 2118ce0f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comdlg32: Add a helper to test if file dialog hook is enabled.

parent 7514475c
...@@ -84,8 +84,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); ...@@ -84,8 +84,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\ OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/) OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
#define IsHooked(fodInfos) \
((fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook)
/*********************************************************************** /***********************************************************************
* Data structure and global variables * Data structure and global variables
*/ */
...@@ -184,6 +182,11 @@ FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) ...@@ -184,6 +182,11 @@ FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd)
return GetPropW(hwnd, filedlg_info_propnameW); return GetPropW(hwnd, filedlg_info_propnameW);
} }
static BOOL is_dialog_hooked(const FileOpenDlgInfos *info)
{
return (info->ofnInfos->Flags & OFN_ENABLEHOOK) && info->ofnInfos->lpfnHook;
}
/*********************************************************************** /***********************************************************************
* Prototypes * Prototypes
*/ */
...@@ -307,7 +310,7 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos) ...@@ -307,7 +310,7 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
} }
/* old style hook messages */ /* old style hook messages */
if (IsHooked(fodInfos)) if (is_dialog_hooked(fodInfos))
{ {
fodInfos->HookMsg.fileokstring = RegisterWindowMessageW(FILEOKSTRINGW); fodInfos->HookMsg.fileokstring = RegisterWindowMessageW(FILEOKSTRINGW);
fodInfos->HookMsg.lbselchstring = RegisterWindowMessageW(LBSELCHSTRINGW); fodInfos->HookMsg.lbselchstring = RegisterWindowMessageW(LBSELCHSTRINGW);
...@@ -824,15 +827,15 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) ...@@ -824,15 +827,15 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
} }
if (fodInfos->unicode) if (fodInfos->unicode)
hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd, hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, is_dialog_hooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
(LPARAM)fodInfos->ofnInfos); (LPARAM)fodInfos->ofnInfos);
else else
hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd, hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, is_dialog_hooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
(LPARAM)fodInfos->ofnInfos); (LPARAM)fodInfos->ofnInfos);
return hChildDlg; return hChildDlg;
} }
else if( IsHooked(fodInfos)) else if (is_dialog_hooked(fodInfos))
{ {
RECT rectHwnd; RECT rectHwnd;
struct { struct {
...@@ -2014,7 +2017,7 @@ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd) ...@@ -2014,7 +2017,7 @@ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd)
static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos ) static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos )
{ {
/* ask the hook if we can close */ /* ask the hook if we can close */
if(IsHooked(fodInfos)) if (is_dialog_hooked(fodInfos))
{ {
LRESULT retval = 0; LRESULT retval = 0;
......
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