Alexandre Julliard : ntdll/tests: Fix vectored exception handler usage.

Alexandre Julliard julliard at winehq.org
Tue Jul 28 15:53:31 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul 28 14:12:36 2020 +0200

ntdll/tests: Fix vectored exception handler usage.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/exception.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index fce1de385e..c498d628ff 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1747,6 +1747,7 @@ void CDECL hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTEXT *contex
 
 static void test_kiuserexceptiondispatcher(void)
 {
+    PVOID vectored_handler;
     HMODULE hntdll = GetModuleHandleA("ntdll.dll");
     static BYTE except_code[] =
     {
@@ -1874,7 +1875,7 @@ static void test_kiuserexceptiondispatcher(void)
     record.ExceptionAddress = NULL; /* does not matter, copied return address */
     record.NumberParameters = 0;
 
-    AddVectoredExceptionHandler(TRUE, dbg_except_continue_vectored_handler);
+    vectored_handler = AddVectoredExceptionHandler(TRUE, dbg_except_continue_vectored_handler);
 
     memcpy(pKiUserExceptionDispatcher, patched_KiUserExceptionDispatcher_bytes,
             sizeof(patched_KiUserExceptionDispatcher_bytes));
@@ -1886,7 +1887,7 @@ static void test_kiuserexceptiondispatcher(void)
     ok(got_exception, "Handler was not called.\n");
     ok(hook_called || broken(!hook_called) /* 2003 */, "Hook was not called.\n");
 
-    RemoveVectoredExceptionHandler(dbg_except_continue_vectored_handler);
+    RemoveVectoredExceptionHandler(vectored_handler);
     ret = VirtualProtect(pKiUserExceptionDispatcher, sizeof(saved_KiUserExceptionDispatcher_bytes),
             old_protect2, &old_protect2);
     ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
@@ -2971,6 +2972,7 @@ void WINAPI hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTEXT *conte
 
 static void test_kiuserexceptiondispatcher(void)
 {
+    LPVOID vectored_handler;
     HMODULE hntdll = GetModuleHandleA("ntdll.dll");
     static BYTE except_code[] =
     {
@@ -3099,7 +3101,7 @@ static void test_kiuserexceptiondispatcher(void)
     record.ExceptionAddress = NULL;
     record.NumberParameters = 0;
 
-    AddVectoredExceptionHandler(TRUE, dbg_except_continue_vectored_handler);
+    vectored_handler = AddVectoredExceptionHandler(TRUE, dbg_except_continue_vectored_handler);
 
     memcpy(pKiUserExceptionDispatcher, patched_KiUserExceptionDispatcher_bytes,
             sizeof(patched_KiUserExceptionDispatcher_bytes));
@@ -3126,7 +3128,7 @@ static void test_kiuserexceptiondispatcher(void)
             || broken(!hook_exception_address) /* 2008 */, "Got unexpected addresses %p, %p.\n",
             hook_KiUserExceptionDispatcher_rip, hook_exception_address);
 
-    RemoveVectoredExceptionHandler(dbg_except_continue_vectored_handler);
+    RemoveVectoredExceptionHandler(vectored_handler);
 
     memcpy(pKiUserExceptionDispatcher, patched_KiUserExceptionDispatcher_bytes,
             sizeof(patched_KiUserExceptionDispatcher_bytes));




More information about the wine-cvs mailing list