[Bug 8553] Open Workbench : fixme:commdlg:GetFileName95 Flags

Wine Bugs wine-bugs at winehq.org
Tue Jun 5 15:56:51 CDT 2007


http://bugs.winehq.org/show_bug.cgi?id=8553





------- Additional Comments From focht at gmx.net  2007-05-06 15:56 -------
Hello,

the exception (access violation) is actually a bug in explorer-style file dialog
support in wine.
The application hooks open/save file dialog procedures and in order to customize
them.

When GetOpenFileName(A) is called and the original FileOpenDlgProc95 dialog proc
receives the WM_INITDIALOG message, it calls CreateTemplateDialog() which sets
up necessary stuff.
Within CreateTemplateDialog(), the client hook procedure is called
(CreateDialogIndirectParamA).
The application hook explicitly searches for "toolbarwindow32" controls in order
to modify them - but it doesnt expect that these controls do not exist (yet).

--- snip dlls/comdlg32/filedlg.c ---
INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
...
 switch(uMsg)
  {
    case WM_INITDIALOG:
      {
         FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;

	 /* Adds the FileOpenDlgInfos in the property list of the dialog
            so it will be easily accessible through a GetPropA(...) */
      	 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos);

       	 fodInfos->DlgInfos.hwndCustomDlg =
     	   CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);

         FILEDLG95_InitControls(hwnd);
         if (fodInfos->DlgInfos.hwndCustomDlg)

...
--- snip dlls/comdlg32/filedlg.c ---

"FILEDLG95_InitControls(hwnd)" which creates child controls is called too late.
Child controls must be created before the client hook procedure is executed
(within CreateTemplateDialog) to give the client a chance to access/modify them.

By moving control creation before template dialog creation it goes further.

--- snip dlls/comdlg32/filedlg-new.c ---
switch(uMsg)
  {
    case WM_INITDIALOG:
      {
         FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;

	 /* Adds the FileOpenDlgInfos in the property list of the dialog
            so it will be easily accessible through a GetPropA(...) */
      	 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos);

         FILEDLG95_InitControls(hwnd);

       	 fodInfos->DlgInfos.hwndCustomDlg =
     	   CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);

         if (fodInfos->DlgInfos.hwndCustomDlg)
..
--- snip dlls/comdlg32/filedlg-new.c ---

It later crashes here:

--- snip dlls/comdlg32/filedlg.c ---
static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
{
  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)
GetPropA(hwnd,FileOpenDlgInfosStr);

...

      /* Refresh the actual view to display the included items*/
      IShellView_Refresh(fodInfos->Shell.FOIShellView);  <-- *boom*
    }
  }
  return FALSE;
}
--- snip dlls/comdlg32/filedlg.c ---

"fodInfos->Shell.FOIShellView" is NULL at this point.
That should be taken into account.

--- snip dlls/comdlg32/filedlg-new.c ---
..
      /* Refresh the actual view to display the included items*/
      if( fodInfos->Shell.FOIShellView) 
          IShellView_Refresh(fodInfos->Shell.FOIShellView);
...
--- snip dlls/comdlg32/filedlg-new.c ---

With both patches the application "open"/"save"/"save as" dialogs display fine.

Regards


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list