shell32/test: Make shelllink.c compile with mingw and work with win2k

Vitaliy Margolen wine-patch at kievinfo.com
Tue Oct 25 14:36:29 CDT 2005


ILFree, ILIsEqual and SHILCreateFromPath are not exported by names at least on
my win2k. 

Vitaliy Margolen

changelog:
  shell32/test
    Make shelllink.c compile with mingw and work with win2k.
-------------- next part --------------
Index: dlls/shell32/tests/shelllink.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/shelllink.c,v
retrieving revision 1.8
diff -u -p -r1.8 shelllink.c
--- dlls/shell32/tests/shelllink.c	24 Jul 2005 16:26:53 -0000	1.8
+++ dlls/shell32/tests/shelllink.c	1 Oct 2005 17:35:54 -0000
@@ -38,12 +38,15 @@
 static const WCHAR lnkfile[]= { 'C',':','\\','t','e','s','t','.','l','n','k',0 };
 static const WCHAR notafile[]= { 'C',':','\\','n','o','n','e','x','i','s','t','e','n','t','\\','f','i','l','e',0 };
 
+static IMalloc *ppM;
 
 /* For some reason SHILCreateFromPath does not work on Win98 and
  * SHSimpleIDListFromPathA does not work on NT4. But if we call both we
  * get what we want on all platforms.
  */
 static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathA)(LPCSTR)=NULL;
+static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
+static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR,LPITEMIDLIST*,PDWORD);
 
 static LPITEMIDLIST path_to_pidl(const char* path)
 {
@@ -71,7 +74,7 @@ static LPITEMIDLIST path_to_pidl(const c
         pathW=HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
         MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
 
-        r=SHILCreateFromPath(pathW, &pidl, NULL);
+        r=pSHILCreateFromPath(pathW, &pidl, NULL);
         todo_wine {
         ok(SUCCEEDED(r), "SHILCreateFromPath failed (0x%08lx)\n", r);
         }
@@ -187,11 +190,11 @@ static void test_get_set(void)
         tmp_pidl=NULL;
         r = IShellLinkA_GetIDList(sl, &tmp_pidl);
         ok(SUCCEEDED(r), "GetIDList failed (0x%08lx)\n", r);
-        ok(tmp_pidl && ILIsEqual(pidl, tmp_pidl),
+        ok(tmp_pidl && pILIsEqual(pidl, tmp_pidl),
            "GetIDList returned an incorrect pidl\n");
 
         /* tmp_pidl is owned by IShellLink so we don't free it */
-        ILFree(pidl);
+        IMalloc_Free(ppM, pidl);
 
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
@@ -409,7 +412,7 @@ static void check_lnk_(int line, const W
         LPITEMIDLIST pidl=NULL;
         r = IShellLinkA_GetIDList(sl, &pidl);
         lok(SUCCEEDED(r), "GetIDList failed (0x%08lx)\n", r);
-        lok(ILIsEqual(pidl, desc->pidl),
+        lok(pILIsEqual(pidl, desc->pidl),
            "GetIDList returned an incorrect pidl\n");
     }
     if (desc->showcmd)
@@ -514,13 +517,21 @@ static void test_load_save(void)
 START_TEST(shelllink)
 {
     HRESULT r;
+    HMODULE hdll=LoadLibraryA("shell32.dll");
 
     r = CoInitialize(NULL);
     ok(SUCCEEDED(r), "CoInitialize failed (0x%08lx)\n", r);
     if (!SUCCEEDED(r))
         return;
 
-    test_get_set();
+    r = SHGetMalloc(&ppM);
+    ok(SUCCEEDED(r), "SHGetMalloc failed %08lx\n", r);
+
+    pILIsEqual = (void*)GetProcAddress(hdll, (char*)21);
+    pSHILCreateFromPath =  (void*)GetProcAddress(hdll, (char*)28);
+    if (pILIsEqual && pSHILCreateFromPath)
+        test_get_set();
+
     test_load_save();
 
     CoUninitialize();


More information about the wine-patches mailing list