ntdll/tests: Test return values from CloseHandle.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bae702a0ee
commit
18f46e5a57
|
@ -8606,7 +8606,9 @@ static inline BOOL is_magic_handle(HANDLE handle)
|
|||
|
||||
static void test_closehandle(DWORD numexc, HANDLE handle)
|
||||
{
|
||||
NTSTATUS status, expect;
|
||||
PVOID vectored_handler;
|
||||
BOOL ret, expectret;
|
||||
|
||||
if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler || !pRtlRaiseException)
|
||||
{
|
||||
|
@ -8618,18 +8620,28 @@ static void test_closehandle(DWORD numexc, HANDLE handle)
|
|||
ok(vectored_handler != 0, "RtlAddVectoredExceptionHandler failed\n");
|
||||
|
||||
invalid_handle_exceptions = 0;
|
||||
CloseHandle(handle);
|
||||
todo_wine_if(is_magic_handle(handle))
|
||||
expectret = is_magic_handle(handle) || broken(numexc && sizeof(handle) == 4); /* < Win10 */
|
||||
ret = CloseHandle(handle);
|
||||
ok(expectret || (GetLastError() == ERROR_INVALID_HANDLE),
|
||||
"CloseHandle had wrong GetLastError(), got %lu for %p\n", GetLastError(), handle);
|
||||
todo_wine_if(is_magic_handle(handle)) {
|
||||
ok(ret == expectret || broken(HandleToLong(handle) < 0) /* < Win10 */,
|
||||
"CloseHandle expected %d, got %d for %p\n", expectret, ret, handle);
|
||||
ok(invalid_handle_exceptions == numexc || broken(!numexc && is_magic_handle(handle)), /* < Win10 */
|
||||
"CloseHandle generated %ld exceptions, expected %ld for %p\n",
|
||||
invalid_handle_exceptions, numexc, handle);
|
||||
}
|
||||
|
||||
invalid_handle_exceptions = 0;
|
||||
pNtClose(handle);
|
||||
todo_wine_if(is_magic_handle(handle))
|
||||
expect = expectret ? STATUS_SUCCESS : STATUS_INVALID_HANDLE;
|
||||
status = pNtClose(handle);
|
||||
todo_wine_if(is_magic_handle(handle)) {
|
||||
ok(status == expect || broken(HandleToLong(handle) < 0), /* < Win10 */
|
||||
"NtClose returned unexpected status %#lx, expected %#lx for %p\n", status, expect, handle);
|
||||
ok(invalid_handle_exceptions == numexc || broken(!numexc && is_magic_handle(handle)), /* < Win10 */
|
||||
"CloseHandle generated %ld exceptions, expected %ld for %p\n",
|
||||
invalid_handle_exceptions, numexc, handle);
|
||||
}
|
||||
|
||||
pRtlRemoveVectoredExceptionHandler(vectored_handler);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue