From: Paul Gofman pgofman@codeweavers.com
--- dlls/kernel32/tests/sync.c | 2 ++ server/thread.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 49f5002f651..7ccc91e0a38 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -2930,6 +2930,8 @@ static void test_QueueUserAPC(void) ok(ret == STATUS_UNSUCCESSFUL, "got %#lx\n", ret); ret = pNtQueueApcThread(thread, NULL, 0, 0, 0); ok(ret == STATUS_UNSUCCESSFUL, "got %#lx\n", ret); + ret = pNtQueueApcThread((HANDLE)0xdeadbeef, call_user_apc, (ULONG_PTR)user_apc, 0, 0); + ok(ret == STATUS_INVALID_HANDLE, "got %#lx\n", ret);
SetLastError(0xdeadbeef); ret = QueueUserAPC(user_apc, thread, 0); diff --git a/server/thread.c b/server/thread.c index 3003c4bc930..1015e6db636 100644 --- a/server/thread.c +++ b/server/thread.c @@ -2039,7 +2039,7 @@ DECL_HANDLER(queue_apc) return; } thread = get_thread_from_handle( req->handle, THREAD_SET_CONTEXT ); - if (call->user.flags & SERVER_USER_APC_SPECIAL && is_wow64_process( thread->process )) + if (thread && call && call->user.flags & SERVER_USER_APC_SPECIAL && is_wow64_process( thread->process )) { release_object( apc ); release_object( thread );
Fixes a regression introduced by fd06b6c9d3433235454ea7ee8a14c08f0c506783.
Not sure what happened, I was sure the tests (right in the file where they were added in the MR) were succeeding by the moment of the MR submission, but now the referenced commit was causing a wineserver crash in kernel32/tests:test_QueueUserAPC().