avoid W->A->W corruption in shell32

Aric Stewart aric at codeweavers.com
Tue Apr 10 05:40:00 CDT 2007


use _ILSimpleGetTextW instead of using _ILGetTextPointer to be able to 
make use of FileStructW and avoiding W->A->W roundtrips if possible.
---
  dlls/shell32/shlfolder.c |   11 +++++------
  1 files changed, 5 insertions(+), 6 deletions(-)
-------------- next part --------------
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 6ab4908..b243412 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -222,13 +222,10 @@ static HRESULT SHELL32_CoCreateInitSF (L
 	    }
 
 	    if (pidlChild) {
-		LPCSTR pszChild = _ILGetTextPointer(pidlChild);
                 int len = lstrlenW(ppfti.szTargetParsingName);
 
-		if (pszChild)
-		    MultiByteToWideChar (CP_ACP, 0, pszChild, -1, ppfti.szTargetParsingName + len, MAX_PATH - len);
-		else
-		    hr = E_INVALIDARG;
+		if (!_ILSimpleGetTextW(pidlChild, ppfti.szTargetParsingName + len, MAX_PATH - len))
+			hr = E_INVALIDARG;
 	    }
 
 	    IPersistFolder3_InitializeEx (ppf, NULL, pidlAbsolute, &ppfti);
@@ -290,7 +287,9 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLI
             lstrcpynW(wszFolderPath, pathRoot, MAX_PATH);
             pwszPathTail = PathAddBackslashW(wszFolderPath);
         }
-        MultiByteToWideChar(CP_ACP, 0, _ILGetTextPointer(pidlChild), -1, pwszPathTail, MAX_PATH - (int)(pwszPathTail - wszFolderPath));
+
+        _ILSimpleGetTextW(pidlChild,pwszPathTail,MAX_PATH - (int)(pwszPathTail - wszFolderPath));
+
         if (SHELL32_GetCustomFolderAttributeFromPath (wszFolderPath,
             wszDotShellClassInfo, wszCLSID, wszCLSIDValue, CHARS_IN_GUID))
             CLSIDFromString (wszCLSIDValue, &clsidFolder);


More information about the wine-patches mailing list