Get shlfolder test running with shell32 4.0

Francois Gouget fgouget at codeweavers.com
Tue Aug 16 08:49:31 CDT 2005


Version 4.0 of the shell32 dll does not export StrRetToBufW(). This 
causes the current shell32_test.exe to fail loading on such platforms. 
So I modified the shlfolder test to do a GetProcAddress() on 
StrRetToBufW() and to skip tests if it is missing.


Changelog:

  * dlls/shell32/tests/shlfolder.c

    Francois Gouget <fgouget at codeweavers.com>
    Dynamically load StrRetToBufW().
    This lets shell32_test.exe run on systems that have version 4.0 of 
shell32.dll.

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/shell32/tests/shlfolder.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/tests/shlfolder.c,v
retrieving revision 1.30
diff -u -p -r1.30 shlfolder.c
--- dlls/shell32/tests/shlfolder.c	15 Aug 2005 09:40:45 -0000	1.30
+++ dlls/shell32/tests/shlfolder.c	16 Aug 2005 09:35:40 -0000
@@ -43,6 +43,7 @@ static IMalloc *ppM;
 
 static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
 static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
+static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
 
 static void init_function_pointers(void)
 {
@@ -53,6 +54,7 @@ static void init_function_pointers(void)
     {
         pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
         pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
+        pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
     }
 
     hr = SHGetMalloc(&ppM);
@@ -369,10 +371,13 @@ static void test_GetDisplayName(void)
         IShellFolder_Release(psfPersonal);
         return;
     }
-    
-    hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
-    ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08lx\n", hr);
-    ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
+
+    if (pStrRetToBufW)
+    {
+        hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
+        ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08lx\n", hr);
+        ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
+    }
     
     IShellFolder_Release(psfDesktop);
     IShellFolder_Release(psfPersonal);
@@ -661,10 +666,13 @@ static void test_SHGetPathFromIDList(voi
         IMalloc_Free(ppM, pidlTestFile);
         return;
     }
-    StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
-    ok(0 == lstrcmpW(wszFileName, wszPath), 
-        "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
-        "returned incorrect path for file placed on desktop\n");
+    if (pStrRetToBufW)
+    {
+        pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
+        ok(0 == lstrcmpW(wszFileName, wszPath), 
+           "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
+           "returned incorrect path for file placed on desktop\n");
+    }
 
     result = SHGetPathFromIDListW(pidlTestFile, wszPath);
     ok(result, "SHGetPathFromIDListW failed! Last error: %08lx\n", GetLastError());


More information about the wine-patches mailing list