ntdll: Tolerate null handle in DeregisterWait.

Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Keno Fischer 2016-08-19 17:24:44 -04:00 committed by Alexandre Julliard
parent 710a58da79
commit 90173ce448
2 changed files with 7 additions and 0 deletions

View File

@ -1245,6 +1245,10 @@ static void test_RegisterWaitForSingleObject(void)
ret = pUnregisterWait(wait_handle); ret = pUnregisterWait(wait_handle);
ok(ret, "UnregisterWait failed with error %d\n", GetLastError()); 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; static DWORD LS_main;

View File

@ -637,6 +637,9 @@ NTSTATUS WINAPI RtlDeregisterWaitEx(HANDLE WaitHandle, HANDLE CompletionEvent)
TRACE( "(%p)\n", WaitHandle ); TRACE( "(%p)\n", WaitHandle );
if (WaitHandle == NULL)
return STATUS_INVALID_HANDLE;
NtSetEvent( wait_work_item->CancelEvent, NULL ); NtSetEvent( wait_work_item->CancelEvent, NULL );
if (wait_work_item->CallbackInProgress) if (wait_work_item->CallbackInProgress)
{ {