wine/dlls/shell32 shlfolder.c shfldr_fs.c shfl ...

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 1 03:34:04 CST 2005


ChangeSet ID:	21011
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/01 03:34:03

Modified files:
	dlls/shell32   : shlfolder.c shfldr_fs.c shfldr_desktop.c 
	                 shfldr.h 

Log message:
	Robert Shearman <rob at codeweavers.com>
	Convert SHELL32_BindToChild to Unicode and fix up the callers.

Patch: http://cvs.winehq.org/patch.py?id=21011

Old revision  New revision  Changes     Path
 1.104         1.105         +14 -17     wine/dlls/shell32/shlfolder.c
 1.47          1.48          +3 -1       wine/dlls/shell32/shfldr_fs.c
 1.47          1.48          +1 -4       wine/dlls/shell32/shfldr_desktop.c
 1.10          1.11          +1 -1       wine/dlls/shell32/shfldr.h

Index: wine/dlls/shell32/shlfolder.c
diff -u -p wine/dlls/shell32/shlfolder.c:1.104 wine/dlls/shell32/shlfolder.c:1.105
--- wine/dlls/shell32/shlfolder.c	1 Nov 2005  9:34: 3 -0000
+++ /dev/null	1 Nov 2005  9:34: 3 -0000
@@ -192,12 +192,12 @@ HRESULT SHELL32_ParseNextElement (IShell
  *   pathRoot can be NULL for Folders beeing a drive.
  *   In this case the absolute path is build from pidlChild (eg. C:)
  */
-HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot,	LPCSTR pathRoot,
+static HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCWSTR pathRoot,
     LPCITEMIDLIST pidlChild, REFCLSID clsid, REFIID riid, LPVOID * ppvOut)
 {
     HRESULT hr;
 
-    TRACE ("%p %s %p\n", pidlRoot, pathRoot, pidlChild);
+    TRACE ("%p %s %p\n", pidlRoot, debugstr_w(pathRoot), pidlChild);
 
     if (SUCCEEDED ((hr = SHCoCreateInstance (NULL, clsid, NULL, riid, ppvOut)))) {
 	LPITEMIDLIST pidlAbsolute = ILCombine (pidlRoot, pidlChild);
@@ -208,32 +208,29 @@ HRESULT SHELL32_CoCreateInitSF (LPCITEMI
             SUCCEEDED (IUnknown_QueryInterface ((IUnknown *) * ppvOut, &IID_IPersistFolder3, (LPVOID *) & ppf))) 
         {
 	    PERSIST_FOLDER_TARGET_INFO ppfti;
-	    char szDestPath[MAX_PATH];
 
 	    ZeroMemory (&ppfti, sizeof (ppfti));
 
+	    /* fill the PERSIST_FOLDER_TARGET_INFO */
+	    ppfti.dwAttributes = -1;
+	    ppfti.csidl = -1;
+
 	    /* build path */
 	    if (pathRoot) {
-		lstrcpyA (szDestPath, pathRoot);
-		PathAddBackslashA(szDestPath);          /* FIXME: why have drives a backslash here ? */
-	    } else {
-		szDestPath[0] = '\0';
+		lstrcpynW (ppfti.szTargetParsingName, pathRoot, MAX_PATH - 1);
+		PathAddBackslashW(ppfti.szTargetParsingName); /* FIXME: why have drives a backslash here ? */
 	    }
 
 	    if (pidlChild) {
-		LPSTR pszChild = _ILGetTextPointer(pidlChild);
+		LPCSTR pszChild = _ILGetTextPointer(pidlChild);
+                int len = lstrlenW(ppfti.szTargetParsingName);
 
 		if (pszChild)
-		    lstrcatA (szDestPath, pszChild);
+		    MultiByteToWideChar (CP_ACP, 0, pszChild, -1, ppfti.szTargetParsingName + len, MAX_PATH - len);
 		else
 		    hr = E_INVALIDARG;
 	    }
 
-	    /* fill the PERSIST_FOLDER_TARGET_INFO */
-	    ppfti.dwAttributes = -1;
-	    ppfti.csidl = -1;
-	    MultiByteToWideChar (CP_ACP, 0, szDestPath, -1, ppfti.szTargetParsingName, MAX_PATH);
-
 	    IPersistFolder3_InitializeEx (ppf, NULL, pidlAbsolute, &ppfti);
 	    IPersistFolder3_Release (ppf);
 	}
@@ -265,7 +262,7 @@ HRESULT SHELL32_CoCreateInitSF (LPCITEMI
  *  means you probably can't use it for your IShellFolder implementation.
  */
 HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
-                             LPCSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut)
+                             LPCWSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut)
 {
     GUID const *clsid;
     IShellFolder *pSF;
@@ -290,10 +287,10 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLI
        
         /* see if folder CLSID should be overridden by desktop.ini file */
         if (pathRoot) {
-            MultiByteToWideChar(CP_ACP, 0, pathRoot, -1, wszFolderPath, MAX_PATH);
+            lstrcpynW(wszFolderPath, pathRoot, MAX_PATH);
             pwszPathTail = PathAddBackslashW(wszFolderPath);
         }
-        MultiByteToWideChar(CP_ACP, 0, _ILGetTextPointer(pidlChild), -1, pwszPathTail, MAX_PATH);
+        MultiByteToWideChar(CP_ACP, 0, _ILGetTextPointer(pidlChild), -1, pwszPathTail, MAX_PATH - (int)(pwszPathTail - wszFolderPath));
         if (SHELL32_GetCustomFolderAttributeFromPath (wszFolderPath,
             wszDotShellClassInfo, wszCLSID, wszCLSIDValue, CHARS_IN_GUID))
             CLSIDFromString (wszCLSIDValue, &clsidFolder);
Index: wine/dlls/shell32/shfldr_fs.c
diff -u -p wine/dlls/shell32/shfldr_fs.c:1.47 wine/dlls/shell32/shfldr_fs.c:1.48
--- wine/dlls/shell32/shfldr_fs.c	1 Nov 2005  9:34: 4 -0000
+++ /dev/null	1 Nov 2005  9:34: 4 -0000
@@ -481,11 +481,13 @@ IShellFolder_fnBindToObject (IShellFolde
                              LPBC pbc, REFIID riid, LPVOID * ppvOut)
 {
     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
+    WCHAR szPath[MAX_PATH];
 
     TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbc,
      shdebugstr_guid (riid), ppvOut);
 
-    return SHELL32_BindToChild (This->pidlRoot, This->sPathTarget, pidl, riid,
+    MultiByteToWideChar(CP_ACP, 0, This->sPathTarget, -1, szPath, MAX_PATH);
+    return SHELL32_BindToChild (This->pidlRoot, szPath, pidl, riid,
      ppvOut);
 }
 
Index: wine/dlls/shell32/shfldr_desktop.c
diff -u -p wine/dlls/shell32/shfldr_desktop.c:1.47 wine/dlls/shell32/shfldr_desktop.c:1.48
--- wine/dlls/shell32/shfldr_desktop.c	1 Nov 2005  9:34: 4 -0000
+++ /dev/null	1 Nov 2005  9:34: 4 -0000
@@ -341,14 +341,11 @@ static HRESULT WINAPI ISF_Desktop_fnBind
                 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
 {
     IGenericSFImpl *This = (IGenericSFImpl *)iface;
-    char szPath[MAX_PATH];
 
     TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
            This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
 
-    WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
-                         szPath, MAX_PATH, NULL, NULL );
-    return SHELL32_BindToChild( This->pidlRoot, szPath, pidl, riid, ppvOut );
+    return SHELL32_BindToChild( This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut );
 }
 
 /**************************************************************************
Index: wine/dlls/shell32/shfldr.h
diff -u -p wine/dlls/shell32/shfldr.h:1.10 wine/dlls/shell32/shfldr.h:1.11
--- wine/dlls/shell32/shfldr.h	1 Nov 2005  9:34: 4 -0000
+++ /dev/null	1 Nov 2005  9:34: 4 -0000
@@ -43,7 +43,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (I
 				       DWORD dwOutLen);
 
 HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
-			     LPCSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut);
+			     LPCWSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut);
 
 HRESULT SHELL32_CompareIDs (IShellFolder * iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
 LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path);



More information about the wine-cvs mailing list