Jacek Caban : kernel32/tests: Avoid function pointers for functions present since XP.

Alexandre Julliard julliard at winehq.org
Fri Jan 3 15:25:06 CST 2020


Module: wine
Branch: master
Commit: 1d556188a7c698ef4f3109946fa46f4493a576ad
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1d556188a7c698ef4f3109946fa46f4493a576ad

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jan  3 18:48:36 2020 +0100

kernel32/tests: Avoid function pointers for functions present since XP.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/debugger.c | 38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index cd982a2014..e6ba746248 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -38,9 +38,6 @@ static int    myARGC;
 static char** myARGV;
 
 static BOOL (WINAPI *pCheckRemoteDebuggerPresent)(HANDLE,PBOOL);
-static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD);
-static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL);
-static BOOL (WINAPI *pIsDebuggerPresent)(void);
 
 static void (WINAPI *pDbgBreakPoint)(void);
 
@@ -509,7 +506,7 @@ static void doDebugger(int argc, char** argv)
     blackbox.nokill_err=0;
     if (strstr(myARGV[2], "nokill"))
     {
-        blackbox.nokill_rc=pDebugSetProcessKillOnExit(FALSE);
+        blackbox.nokill_rc = DebugSetProcessKillOnExit(FALSE);
         if (!blackbox.nokill_rc)
             blackbox.nokill_err=GetLastError();
     }
@@ -519,7 +516,7 @@ static void doDebugger(int argc, char** argv)
     blackbox.detach_err=0;
     if (strstr(myARGV[2], "detach"))
     {
-        blackbox.detach_rc=pDebugActiveProcessStop(blackbox.pid);
+        blackbox.detach_rc = DebugActiveProcessStop(blackbox.pid);
         if (!blackbox.detach_rc)
             blackbox.detach_err=GetLastError();
     }
@@ -764,17 +761,9 @@ static void test_ExitCode(void)
     ok(disposition == REG_OPENED_EXISTING_KEY, "expected REG_OPENED_EXISTING_KEY, got %d\n", disposition);
     crash_and_debug(hkey, test_exe, "dbg,event,order");
     crash_and_debug(hkey, test_exe, "dbg,attach,event,code2");
-    if (pDebugSetProcessKillOnExit)
-        crash_and_debug(hkey, test_exe, "dbg,attach,event,nokill");
-    else
-        win_skip("DebugSetProcessKillOnExit is not available\n");
-    if (pDebugActiveProcessStop)
-    {
-        crash_and_debug(hkey, test_exe, "dbg,attach,event,detach");
-        crash_and_debug(hkey, test_exe, "dbg,attach,detach,late");
-    }
-    else
-        win_skip("DebugActiveProcessStop is not available\n");
+    crash_and_debug(hkey, test_exe, "dbg,attach,event,nokill");
+    crash_and_debug(hkey, test_exe, "dbg,attach,event,detach");
+    crash_and_debug(hkey, test_exe, "dbg,attach,detach,late");
     crash_and_debug(hkey, test_exe, "dbg,attach,process,event,detach");
 
     if (disposition == REG_CREATED_NEW_KEY)
@@ -851,7 +840,7 @@ static void doChild(int argc, char **argv)
     child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
     child_ok(debug, "Expected debug != 0, got %#x.\n", debug);
 
-    ret = pDebugActiveProcessStop(ppid);
+    ret = DebugActiveProcessStop(ppid);
     child_ok(ret, "DebugActiveProcessStop failed, last error %#x.\n", GetLastError());
 
     ret = pCheckRemoteDebuggerPresent(parent, &debug);
@@ -861,7 +850,7 @@ static void doChild(int argc, char **argv)
     ret = CloseHandle(parent);
     child_ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
 
-    ret = pIsDebuggerPresent();
+    ret = IsDebuggerPresent();
     child_ok(ret, "Expected ret != 0, got %#x.\n", ret);
     ret = pCheckRemoteDebuggerPresent(GetCurrentProcess(), &debug);
     child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
@@ -869,7 +858,7 @@ static void doChild(int argc, char **argv)
 
     NtCurrentTeb()->Peb->BeingDebugged = FALSE;
 
-    ret = pIsDebuggerPresent();
+    ret = IsDebuggerPresent();
     child_ok(!ret, "Expected ret != 0, got %#x.\n", ret);
     ret = pCheckRemoteDebuggerPresent(GetCurrentProcess(), &debug);
     child_ok(ret, "CheckRemoteDebuggerPresent failed, last error %#x.\n", GetLastError());
@@ -893,9 +882,9 @@ static void test_debug_loop(int argc, char **argv)
     char *cmd;
     BOOL ret;
 
-    if (!pDebugActiveProcessStop || !pCheckRemoteDebuggerPresent)
+    if (!pCheckRemoteDebuggerPresent)
     {
-        win_skip("DebugActiveProcessStop or CheckRemoteDebuggerPresent not available, skipping test.\n");
+        win_skip("CheckRemoteDebuggerPresent not available, skipping test.\n");
         return;
     }
 
@@ -1024,9 +1013,9 @@ static void test_debug_children(const char *name, DWORD flag, BOOL debug_child,
     BOOL debug, ret;
     struct debugger_context ctx = { 0 };
 
-    if (!pDebugActiveProcessStop || !pCheckRemoteDebuggerPresent)
+    if (!pCheckRemoteDebuggerPresent)
     {
-        win_skip("DebugActiveProcessStop or CheckRemoteDebuggerPresent not available, skipping test.\n");
+        win_skip("CheckRemoteDebuggerPresent not available, skipping test.\n");
         return;
     }
 
@@ -1447,9 +1436,6 @@ START_TEST(debugger)
 
     hdll=GetModuleHandleA("kernel32.dll");
     pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent");
-    pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop");
-    pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit");
-    pIsDebuggerPresent=(void*)GetProcAddress(hdll, "IsDebuggerPresent");
 
     ntdll = GetModuleHandleA("ntdll.dll");
     pDbgBreakPoint = (void*)GetProcAddress(ntdll, "DbgBreakPoint");




More information about the wine-cvs mailing list