Stefan Brüns : commdlg: Makes return value of FILEDLG95_SendFileOK dependent of

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 12 06:43:25 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 324b11f206c046e581b858a2f6b2af7a6bc383d7
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=324b11f206c046e581b858a2f6b2af7a6bc383d7

Author: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Date:   Thu Jan 12 13:30:11 2006 +0100

commdlg: Makes return value of FILEDLG95_SendFileOK dependent of
return value, not of DWL_MSGRESULT.

---

 dlls/commdlg/filedlg.c        |   26 ++++++++++++++++----------
 dlls/commdlg/filedlgbrowser.c |    2 +-
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c
index cbe6198..014e9f3 100644
--- a/dlls/commdlg/filedlg.c
+++ b/dlls/commdlg/filedlg.c
@@ -228,7 +228,7 @@ static void *MemAlloc(UINT size);
 static void MemFree(void *mem);
 
 INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-void SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
+LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
 static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 static BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCount, UINT sizeUsed);
 static BOOL BrowseSelectedFolder(HWND hwnd);
@@ -811,13 +811,15 @@ static HWND CreateTemplateDialog(FileOpe
 * Send CustomDialogNotification (CDN_FIRST -- CDN_LAST) message to the custom template dialog
 */
 
-void SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
+LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
 {
+    LRESULT hook_result = 0;
+
     FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndParentDlg,FileOpenDlgInfosStr);
 
     TRACE("%p 0x%04x\n",hwndParentDlg, uCode);
 
-    if(!fodInfos) return;
+    if(!fodInfos) return 0;
 
     if(fodInfos->DlgInfos.hwndCustomDlg)
     {
@@ -830,7 +832,7 @@ void SendCustomDlgNotificationMessage(HW
             ofnNotify.hdr.code = uCode;
             ofnNotify.lpOFN = fodInfos->ofnInfos;
             ofnNotify.pszFile = NULL;
-            SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
+            hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
         }
         else
         {
@@ -840,10 +842,12 @@ void SendCustomDlgNotificationMessage(HW
             ofnNotify.hdr.code = uCode;
             ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos;
             ofnNotify.pszFile = NULL;
-            SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
+            hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
         }
 	TRACE("RET NOTIFY\n");
     }
+    TRACE("Retval: 0x%08lx\n", hook_result);
+    return hook_result;
 }
 
 static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID buffer)
@@ -1593,22 +1597,24 @@ static BOOL FILEDLG95_SendFileOK( HWND h
     /* ask the hook if we can close */
     if(IsHooked(fodInfos))
     {
+        LRESULT retval;
+
         TRACE("---\n");
         /* First send CDN_FILEOK as MSDN doc says */
-        SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
+        retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
         if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT))
         {
             TRACE("canceled\n");
-            return FALSE;
+            return (retval == 0);
         }
 
         /* fodInfos->ofnInfos points to an ASCII or UNICODE structure as appropriate */
-        SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,
-                     fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
+        retval = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,
+                              fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
         if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT))
         {
             TRACE("canceled\n");
-            return FALSE;
+            return (retval == 0);
         }
     }
     return TRUE;
diff --git a/dlls/commdlg/filedlgbrowser.c b/dlls/commdlg/filedlgbrowser.c
index 2b7d678..c8731b9 100644
--- a/dlls/commdlg/filedlgbrowser.c
+++ b/dlls/commdlg/filedlgbrowser.c
@@ -88,7 +88,7 @@ extern LPITEMIDLIST     GetParentPidl(LP
 extern LPITEMIDLIST     GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
 
 extern int     FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
-extern void    SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
+extern LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
 
 
 /*




More information about the wine-cvs mailing list