Module: wine Branch: master Commit: 2118ce0fa9785ce301370738b12b8f38a23ca86b URL: https://source.winehq.org/git/wine.git/?a=commit;h=2118ce0fa9785ce301370738b...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Mar 20 10:37:50 2018 +0300
comdlg32: Add a helper to test if file dialog hook is enabled.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/comdlg32/filedlg.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 81eaeca..e721c08 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -84,8 +84,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\ OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
-#define IsHooked(fodInfos) \ - ((fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook) /*********************************************************************** * Data structure and global variables */ @@ -184,6 +182,11 @@ FileOpenDlgInfos *get_filedlg_infoptr(HWND hwnd) return GetPropW(hwnd, filedlg_info_propnameW); }
+static BOOL is_dialog_hooked(const FileOpenDlgInfos *info) +{ + return (info->ofnInfos->Flags & OFN_ENABLEHOOK) && info->ofnInfos->lpfnHook; +} + /*********************************************************************** * Prototypes */ @@ -307,7 +310,7 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos) }
/* old style hook messages */ - if (IsHooked(fodInfos)) + if (is_dialog_hooked(fodInfos)) { fodInfos->HookMsg.fileokstring = RegisterWindowMessageW(FILEOKSTRINGW); fodInfos->HookMsg.lbselchstring = RegisterWindowMessageW(LBSELCHSTRINGW); @@ -824,15 +827,15 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) } if (fodInfos->unicode) hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd, - IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, + is_dialog_hooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, (LPARAM)fodInfos->ofnInfos); else hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd, - IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, + is_dialog_hooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate, (LPARAM)fodInfos->ofnInfos); return hChildDlg; } - else if( IsHooked(fodInfos)) + else if (is_dialog_hooked(fodInfos)) { RECT rectHwnd; struct { @@ -2014,7 +2017,7 @@ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd) static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos ) { /* ask the hook if we can close */ - if(IsHooked(fodInfos)) + if (is_dialog_hooked(fodInfos)) { LRESULT retval = 0;