GetOpenFileNameW - Create unicode windows

Stefan Siebert stefan.siebert at web.de
Mon Jul 24 07:45:32 CDT 2006


The Notes Client currently crashes on configuration Setup selecting a 
user id or when switching the id (menu/security/switch user id).
The problem is, that it's checking if the template window is unicode. 
Dependant on IsWindowUnicode Notes is using A or W functions.

Changelog: GetOpenFileNameW - Create unicode windows (programms might 
check IsWindowUnicode)

- Stefan
-------------- next part --------------
? filedlg.diff
Index: dlls/comdlg32/filedlg.c
===================================================================
RCS file: /home/wine/wine/dlls/comdlg32/filedlg.c,v
retrieving revision 1.3
diff -u -p -r1.3 filedlg.c
--- dlls/comdlg32/filedlg.c	30 May 2006 10:57:56 -0000	1.3
+++ dlls/comdlg32/filedlg.c	24 Jul 2006 06:45:28 -0000
@@ -260,8 +260,12 @@ static BOOL WINAPI GetFileName95(FileOpe
     }
 
     /* Create the dialog from a template */
+    if (fodInfos->unicode)
+      hRes = FindResourceW(COMDLG32_hInstance,MAKEINTRESOURCEW(NEWFILEOPENORD),(LPCWSTR)RT_DIALOG);
+    else
+      hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(NEWFILEOPENORD),(LPSTR)RT_DIALOG);
 
-    if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(NEWFILEOPENORD),(LPSTR)RT_DIALOG)))
+    if(!hRes)
     {
         COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
         return FALSE;
@@ -285,11 +289,18 @@ static BOOL WINAPI GetFileName95(FileOpe
     /* Some shell namespace extensions depend on COM being initialized. */
     hr = OleInitialize(NULL);
 
-    lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,
-                                  (LPDLGTEMPLATEA) template,
-                                  fodInfos->ofnInfos->hwndOwner,
-                                  FileOpenDlgProc95,
-                                  (LPARAM) fodInfos);
+    if (fodInfos->unicode)
+      lRes = DialogBoxIndirectParamW(COMDLG32_hInstance,
+                                     template,
+                                     fodInfos->ofnInfos->hwndOwner,
+                                     FileOpenDlgProc95,
+                                     (LPARAM) fodInfos);
+    else
+      lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,
+                                     (LPDLGTEMPLATEA) template,
+                                     fodInfos->ofnInfos->hwndOwner,
+                                     FileOpenDlgProc95,
+                                     (LPARAM) fodInfos);
     if (SUCCEEDED(hr)) 
         OleUninitialize();
 
@@ -771,9 +782,14 @@ static HWND CreateTemplateDialog(FileOpe
           return NULL;
     	}
       }
-      hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
-                                             IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
-                                             (LPARAM)fodInfos->ofnInfos);
+      if (fodInfos->unicode)
+          hChildDlg = CreateDialogIndirectParamW(hinst, template, hwnd,
+              IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
+              (LPARAM)fodInfos->ofnInfos);
+      else
+          hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
+              IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
+              (LPARAM)fodInfos->ofnInfos);
       if(hChildDlg)
       {
         ShowWindow(hChildDlg,SW_SHOW);
@@ -1197,11 +1213,18 @@ static LRESULT FILEDLG95_InitControls(HW
   rectTB.left = rectlook.right;
   rectTB.top = rectlook.top-1;
 
-  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
-        WS_CHILD | WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
-        rectTB.left, rectTB.top,
-        rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
-        hwnd, (HMENU)IDC_TOOLBAR, COMDLG32_hInstance, NULL);
+  if (fodInfos->unicode)
+      fodInfos->DlgInfos.hwndTB = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL,
+          WS_CHILD | WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
+          rectTB.left, rectTB.top,
+          rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
+          hwnd, (HMENU)IDC_TOOLBAR, COMDLG32_hInstance, NULL);
+  else
+      fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL,
+          WS_CHILD | WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
+          rectTB.left, rectTB.top,
+          rectTB.right - rectTB.left, rectTB.bottom - rectTB.top,
+          hwnd, (HMENU)IDC_TOOLBAR, COMDLG32_hInstance, NULL);
 
   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
 


More information about the wine-patches mailing list