DPA_Create/Search may be missing

Francois Gouget fgouget at free.fr
Mon Jan 19 06:23:22 CST 2004


Third try. Should work this time (keeping my fingers crossed).

Both DPA_Create and DPA_Search are exported by ordinal. With the very
latest Microsoft SDK DPA_Search is present in the import library, but
DPA_Create is missing.

So to compile this test with MSVC we need to use GetProcAddress to load
DPA_Create but we can statically link to DPA_Search which will test the
ordinal imports (is that the best of both worlds?).


Changelog:

 * dlls/comctl32/tests/dpa.c

   DPA_Search is present in the February 2003 Microsoft SDK import
library. So we link to it normally.
   However DPA_Create is missing from all recent import libraries so we
use GetProcAddress to load it.
   Add '\n' to 'ok' calls.


Index: dlls/comctl32/tests/dpa.c
===================================================================
RCS file: /home/cvs/wine/dlls/comctl32/tests/dpa.c,v
retrieving revision 1.2
diff -u -r1.2 dpa.c
--- dlls/comctl32/tests/dpa.c	5 Sep 2003 23:08:42 -0000	1.2
+++ dlls/comctl32/tests/dpa.c	19 Jan 2004 09:56:45 -0000
@@ -29,11 +29,13 @@

 #include "wine/test.h"

+static HDPA (WINAPI *pDPA_Create)(int);
+
 static INT CALLBACK dpa_strcmp(LPVOID pvstr1, LPVOID pvstr2, LPARAM flags)
 {
   LPCSTR str1 = (LPCSTR)pvstr1;
   LPCSTR str2 = (LPCSTR)pvstr2;
-
+
   return lstrcmpA (str1, str2);
 }

@@ -42,19 +44,27 @@
   HDPA dpa_ret;
   INT  int_ret;
   CHAR test_str0[]="test0";
-
-  dpa_ret = DPA_Create(0);
-  ok((dpa_ret !=0), "DPA_Create failed");
+
+  if (!pDPA_Create)
+      return;
+
+  dpa_ret = pDPA_Create(0);
+  ok((dpa_ret !=0), "DPA_Create failed\n");
   int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED);
-  ok((int_ret == -1), "DPA_Search found invalid item");
+  ok((int_ret == -1), "DPA_Search found invalid item\n");
   int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED|DPAS_INSERTBEFORE);
-  ok((int_ret == 0), "DPA_Search proposed bad item");
+  ok((int_ret == 0), "DPA_Search proposed bad item\n");
   int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED|DPAS_INSERTAFTER);
-  ok((int_ret == 0), "DPA_Search proposed bad item");
+  ok((int_ret == 0), "DPA_Search proposed bad item\n");
 }

 START_TEST(dpa)
 {
+    HMODULE hdll;
+
+    hdll=LoadLibraryA("comctl32.dll");
+    ok(hdll!=NULL,"Couldn't load kernel32.dll (%ld)\n",GetLastError());
+    pDPA_Create=(void*)GetProcAddress(hdll,(LPCSTR)328);
+
     DPA_test();
-
 }


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  Hiroshima '45 - Czernobyl '86 - Windows '95



More information about the wine-patches mailing list