Daniel Lehman : ntdll: Return success for magic handles.
Alexandre Julliard
julliard at winehq.org
Thu Apr 7 16:19:08 CDT 2022
Module: wine
Branch: master
Commit: 1a18f3b916ef0735c5dd526251cd18a1866e2e1d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1a18f3b916ef0735c5dd526251cd18a1866e2e1d
Author: Daniel Lehman <dlehman25 at gmail.com>
Date: Sun Apr 3 00:13:36 2022 -0700
ntdll: Return success for magic handles.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51529
Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/exception.c | 8 --------
dlls/ntdll/unix/server.c | 3 +++
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 8af8d6b70da..42722e7b952 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -1223,7 +1223,6 @@ static void test_debugger(DWORD cont_status)
}
else if (stage == 13)
{
- todo_wine
ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n");
continuestatus = DBG_EXCEPTION_NOT_HANDLED;
}
@@ -3923,7 +3922,6 @@ static void test_debugger(DWORD cont_status)
}
else if (stage == 13)
{
- todo_wine
ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n");
continuestatus = DBG_EXCEPTION_NOT_HANDLED;
}
@@ -6627,7 +6625,6 @@ static void test_debugger(DWORD cont_status)
}
else if (stage == 13)
{
- todo_wine
ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n");
continuestatus = DBG_EXCEPTION_NOT_HANDLED;
}
@@ -7881,7 +7878,6 @@ static void test_debugger(DWORD cont_status)
}
else if (stage == 13)
{
- todo_wine
ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n");
continuestatus = DBG_EXCEPTION_NOT_HANDLED;
}
@@ -8624,24 +8620,20 @@ static void test_closehandle(DWORD numexc, HANDLE handle)
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;
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);
}
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index ab9d99c4f47..77e8d5c7566 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -1704,6 +1704,9 @@ NTSTATUS WINAPI NtClose( HANDLE handle )
NTSTATUS ret;
int fd;
+ if (HandleToLong( handle ) >= ~5 && HandleToLong( handle ) <= ~0)
+ return STATUS_SUCCESS;
+
server_enter_uninterrupted_section( &fd_cache_mutex, &sigset );
/* always remove the cached fd; if the server request fails we'll just
More information about the wine-cvs
mailing list