[shellpath.c]: minor fix to Rolf's patch

Fabrice Ménard menard.fabrice at wanadoo.fr
Mon Nov 1 11:58:05 CST 2004


The latest patch from Rolf Kalbermatter on shellpath.c was breaking the installation of wine.inf.

 wine rundll32 setupapi.dll,InstallHinfSection DefaultInstall 128 d:\\wine.inf

was returning errors about being unable to create some dirs.  In facts these errors was concerning 
already existing directories in SHGetFolderPathW.
I think it is not necessary to care about that in this function so I added a check on the
type of error returned by SHCreateDirectoryExW.  
Send me a note if I'm wrong.

Here is the patch:

Index: shellpath.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellpath.c,v
retrieving revision 1.94
diff -u -c -r1.94 shellpath.c
cvs server: conflicting specifications of output style
*** shellpath.c 28 Oct 2004 20:58:51 -0000 1.94
--- shellpath.c 1 Nov 2004 16:42:58 -0000
***************
*** 1573,1579 ****
      WCHAR      szBuildPath[MAX_PATH], szTemp[MAX_PATH];
      DWORD      folder = nFolder & CSIDL_FOLDER_MASK;
      CSIDL_Type type;
! 
      TRACE("%p,%p,nFolder=0x%04x\n", hwndOwner,pszPath,nFolder);
  
      /* Windows always NULL-terminates the resulting path regardless of success
--- 1573,1580 ----
      WCHAR      szBuildPath[MAX_PATH], szTemp[MAX_PATH];
      DWORD      folder = nFolder & CSIDL_FOLDER_MASK;
      CSIDL_Type type;
!     int        ret;
!     
      TRACE("%p,%p,nFolder=0x%04x\n", hwndOwner,pszPath,nFolder);
  
      /* Windows always NULL-terminates the resulting path regardless of success
***************
*** 1656,1662 ****
      }
  
      /* create directory/directories */
!     if (SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL))
      {
          ERR("Failed to create directory '%s'.\n", debugstr_w(szBuildPath));
          hr = E_FAIL;
--- 1657,1664 ----
      }
  
      /* create directory/directories */
!     ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL);
!     if (ret && ret != ERROR_ALREADY_EXISTS)
      {
          ERR("Failed to create directory '%s'.\n", debugstr_w(szBuildPath));
          hr = E_FAIL;

Here is the changelog:

 * dlls/shell32/shellpath.c: Fabrice Ménard  <menard.fabrice at wanadoo.fr>
Minor fix in SHGetFolderPathW.


-- 
Fabrice Ménard
menard.fabrice at wanadoo.fr




More information about the wine-patches mailing list