Commit 94ca95a6 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll/tests: Fix vectored exception handler usage.

parent d775b9fd
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment