Keno Fischer : ntdll: Tolerate null handle in DeregisterWait.

Alexandre Julliard julliard at winehq.org
Mon Aug 22 10:24:13 CDT 2016


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

Author: Keno Fischer <keno at juliacomputing.com>
Date:   Fri Aug 19 17:24:44 2016 -0400

ntdll: Tolerate null handle in DeregisterWait.

Signed-off-by: Keno Fischer <keno at juliacomputing.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/thread.c | 4 ++++
 dlls/ntdll/threadpool.c      | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index a9a04df..0a5f0d3 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -1245,6 +1245,10 @@ static void test_RegisterWaitForSingleObject(void)
 
     ret = pUnregisterWait(wait_handle);
     ok(ret, "UnregisterWait failed with error %d\n", GetLastError());
+
+    ret = pUnregisterWait(0);
+    ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
+        "UnregisterWait failed with unexpected error %d\n", GetLastError());
 }
 
 static DWORD LS_main;
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index 04790aa..173e865 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -637,6 +637,9 @@ NTSTATUS WINAPI RtlDeregisterWaitEx(HANDLE WaitHandle, HANDLE CompletionEvent)
 
     TRACE( "(%p)\n", WaitHandle );
 
+    if (WaitHandle == NULL)
+        return STATUS_INVALID_HANDLE;
+
     NtSetEvent( wait_work_item->CancelEvent, NULL );
     if (wait_work_item->CallbackInProgress)
     {




More information about the wine-cvs mailing list