Paul Vriens : advapi32/tests: Add helper function to get function pointers.

Alexandre Julliard julliard at winehq.org
Fri Aug 22 04:44:02 CDT 2008


Module: wine
Branch: master
Commit: 6381303c019c9d9b9a7119a1db8fb7dae68c867c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6381303c019c9d9b9a7119a1db8fb7dae68c867c

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Wed Aug 20 20:13:59 2008 +0200

advapi32/tests: Add helper function to get function pointers.

---

 dlls/advapi32/tests/service.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 829cfe7..306f000 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -33,6 +33,19 @@
 
 static const CHAR spooler[] = "Spooler"; /* Should be available on all platforms */
 
+static BOOL (WINAPI *pChangeServiceConfig2A)(SC_HANDLE,DWORD,LPVOID);
+static BOOL (WINAPI *pQueryServiceConfig2A)(SC_HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
+static BOOL (WINAPI *pQueryServiceConfig2W)(SC_HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
+
+static void init_function_pointers(void)
+{
+    HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
+
+    pChangeServiceConfig2A = (void*)GetProcAddress(hadvapi32, "ChangeServiceConfig2A");
+    pQueryServiceConfig2A= (void*)GetProcAddress(hadvapi32, "QueryServiceConfig2A");
+    pQueryServiceConfig2W= (void*)GetProcAddress(hadvapi32, "QueryServiceConfig2W");
+}
+
 static void test_open_scm(void)
 {
     SC_HANDLE scm_handle;
@@ -958,13 +971,7 @@ static void test_queryconfig2(void)
     static const CHAR dependencies[] = "Master1\0Master2\0+MasterGroup1\0";
     static const CHAR password    [] = "";
     static const CHAR description [] = "Description";
-    HMODULE dllhandle = GetModuleHandleA("advapi32.dll");
-    BOOL (WINAPI *pChangeServiceConfig2A)(SC_HANDLE,DWORD,LPVOID)
-            = (void*)GetProcAddress(dllhandle, "ChangeServiceConfig2A");
-    BOOL (WINAPI *pQueryServiceConfig2A)(SC_HANDLE,DWORD,LPBYTE,DWORD,LPDWORD)
-            = (void*)GetProcAddress(dllhandle, "QueryServiceConfig2A");
-    BOOL (WINAPI *pQueryServiceConfig2W)(SC_HANDLE,DWORD,LPBYTE,DWORD,LPDWORD)
-            = (void*)GetProcAddress(dllhandle, "QueryServiceConfig2W");
+
     if(!pQueryServiceConfig2A)
     {
         skip("function QueryServiceConfig2A not present\n");
@@ -1250,6 +1257,8 @@ START_TEST(service)
     }
     CloseServiceHandle(scm_handle);
 
+    init_function_pointers();
+
     /* First some parameter checking */
     test_open_scm();
     test_open_svc();




More information about the wine-cvs mailing list