[PATCH] lpstrInitialDir for open file common dialog

gerard patel gerard.patel at asi.fr
Wed Mar 7 16:39:02 CST 2001


Passing an empty string for the initial dir to open file dialogs should browse
the current  directory, not the work station as is done with current Wine.
My tests have shown that an invalid value has the same effect - but in this case
it's the shell folder that is doing this job under Windows it seems.

ChangeLog:

    * dlls/commdlg/filedlg95.c, dlls/shell32/shlfolder.c
    handle empty strings and invalid values in lpstrInitialDir for 32 bits open file dialogs
-------------- next part --------------
Index: dlls/commdlg/filedlg95.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
retrieving revision 1.56
diff -u -r1.56 filedlg95.c
--- dlls/commdlg/filedlg95.c	2001/01/28 23:09:11	1.56
+++ dlls/commdlg/filedlg95.c	2001/03/07 23:35:09
@@ -2693,7 +2693,7 @@
  *      GetPidlFromName
  *
  * returns the pidl of the file name relative to folder 
- * NULL if an error occured
+ * NULL if an error occurred
  */
 LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
 {
@@ -2704,7 +2704,8 @@
   TRACE("sf=%p file=%s\n", lpsf, lpcstrFileName);
 
   if(!lpcstrFileName) return NULL;
-    
+  if(!*lpcstrFileName) return NULL;
+
   MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH);  
 
   if(!lpsf)
Index: dlls/shell32/shlfolder.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfolder.c,v
retrieving revision 1.56
diff -u -r1.56 shlfolder.c
--- dlls/shell32/shlfolder.c	2001/02/28 05:31:03	1.56
+++ dlls/shell32/shlfolder.c	2001/03/07 23:35:14
@@ -682,7 +682,10 @@
 	  }
 	}
 
-	*ppidl = pidlTemp;
+        if (!hr)
+	  *ppidl = pidlTemp;
+	else
+	  *ppidl = NULL;
 
 	TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr);
 
-------------- next part --------------



More information about the wine-patches mailing list