[PATCH 1/2] commdlg: Pass the 16-bit structure to the WM_INITDIALOG hook.

Huw Davies huw at codeweavers.com
Tue Jan 11 08:00:36 CST 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52356
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/commdlg.dll16/filedlg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/commdlg.dll16/filedlg.c b/dlls/commdlg.dll16/filedlg.c
index 4fa62c15d6c..0a4dad4a37a 100644
--- a/dlls/commdlg.dll16/filedlg.c
+++ b/dlls/commdlg.dll16/filedlg.c
@@ -482,6 +482,12 @@ static UINT_PTR CALLBACK call_hook_proc( WNDPROC16 hook, HWND hwnd, UINT msg, WP
     case WM_ACTIVATEAPP:
         ret = call_hook16( hook, hwnd, msg, wp, HTASK_16( lp ));
         break;
+    case WM_INITDIALOG:
+        {
+            OPENFILENAMEA *ofn = (OPENFILENAMEA *)lp;
+            ret = call_hook16( hook, hwnd, msg, wp, ofn->lCustData );
+            break;
+        }
     default:
         ret = call_hook16( hook, hwnd, msg, wp, lp );
         break;
@@ -591,7 +597,7 @@ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn ) /* [in/out] address of structure w
     ofn32.nFileOffset       = lpofn->nFileOffset;
     ofn32.nFileExtension    = lpofn->nFileExtension;
     ofn32.lpstrDefExt       = MapSL( lpofn->lpstrDefExt );
-    ofn32.lCustData         = lpofn->lCustData;
+    ofn32.lCustData         = ofn; /* See WM_INITDIALOG in the hook proc */
     ofn32.lpfnHook          = dummy_hook;  /* this is to force old 3.1 dialog style */
 
     if (lpofn->Flags & OFN_ENABLETEMPLATE)
-- 
2.23.0




More information about the wine-devel mailing list