Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/kernel32/tests/process.c | 23 +++++++++++++++++++++++ dlls/ntdll/tests/om.c | 16 ++++++++++++++++ 2 files changed, 39 insertions(+)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index e729bca87ef..ce7de563d9d 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -4972,6 +4972,28 @@ static void test_job_list_attribute(HANDLE parent_job) ok(ret, "SetInformationJobObject error %u\n", GetLastError()); }
+static void test_CloseHandle(void) +{ + BOOL ret; + + SetLastError(0xdeadbeef); + ret = CloseHandle(INVALID_HANDLE_VALUE); +todo_wine { + ok(ret, "Unexpected return value %d.\n", ret); + ok(GetLastError() == 0xdeadbeef, "Unexpected error.\n"); +} + + SetLastError(0); + ret = CloseHandle(UlongToHandle(0xdeadbee1)); + ok(!ret, "Unexpected return value %d.\n", ret); + ok(GetLastError() == ERROR_INVALID_HANDLE, "Unexpected error.\n"); + + SetLastError(0); + ret = CloseHandle(0); + ok(!ret, "Unexpected return value %d.\n", ret); + ok(GetLastError() == ERROR_INVALID_HANDLE, "Unexpected error.\n"); +} + START_TEST(process) { HANDLE job, hproc, h, h2; @@ -5101,6 +5123,7 @@ START_TEST(process) test_parent_process_attribute(0, NULL); test_handle_list_attribute(FALSE, NULL, NULL); test_dead_process(); + test_CloseHandle();
/* things that can be tested: * lookup: check the way program to be executed is searched diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index af5e014f069..3d518af5f3a 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2944,6 +2944,21 @@ static void test_get_next_thread(void) CloseHandle(thread); }
+static void test_close_handle(void) +{ + NTSTATUS status; + + status = NtClose(INVALID_HANDLE_VALUE); +todo_wine + ok(!status, "Unexpected status %#x.\n", status); + + status = NtClose(0); + ok(status == STATUS_INVALID_HANDLE, "Unexpected status %#x.\n", status); + + status = NtClose(UlongToHandle(0xdeadbee1)); + ok(status == STATUS_INVALID_HANDLE, "Unexpected status %#x.\n", status); +} + START_TEST(om) { HMODULE hntdll = GetModuleHandleA("ntdll.dll"); @@ -3020,4 +3035,5 @@ START_TEST(om) test_duplicate_object(); test_object_types(); test_get_next_thread(); + test_close_handle(); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
Reported by Sergey Bychkow as https://bugs.winehq.org/show_bug.cgi?id=51529.
dlls/kernel32/tests/process.c | 2 -- dlls/ntdll/tests/om.c | 1 - dlls/ntdll/unix/server.c | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index ce7de563d9d..31d758f076d 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -4978,10 +4978,8 @@ static void test_CloseHandle(void)
SetLastError(0xdeadbeef); ret = CloseHandle(INVALID_HANDLE_VALUE); -todo_wine { ok(ret, "Unexpected return value %d.\n", ret); ok(GetLastError() == 0xdeadbeef, "Unexpected error.\n"); -}
SetLastError(0); ret = CloseHandle(UlongToHandle(0xdeadbee1)); diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 3d518af5f3a..3e4993171c3 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2949,7 +2949,6 @@ static void test_close_handle(void) NTSTATUS status;
status = NtClose(INVALID_HANDLE_VALUE); -todo_wine ok(!status, "Unexpected status %#x.\n", status);
status = NtClose(0); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 986eb6c3250..84a51d42aa3 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1728,6 +1728,8 @@ NTSTATUS WINAPI NtClose( HANDLE handle ) NTSTATUS ret; int fd;
+ if (handle == INVALID_HANDLE_VALUE) return STATUS_SUCCESS; + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset );
/* always remove the cached fd; if the server request fails we'll just
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=95416
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w7u_adm (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w7u_el (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w8 (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w8adm (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w864 (32 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w864 (64 bit report) ===
kernel32: process.c:4981: Test failed: Unexpected return value 0. process.c:4982: Test failed: Unexpected error.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w7u_adm (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w7u_el (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w8 (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w8adm (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w864 (32 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
=== w864 (64 bit report) ===
ntdll: om.c:2952: Test failed: Unexpected status 0xc0000008.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=95415
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w7u_adm (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w7u_el (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w8 (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w8adm (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w864 (32 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w864 (64 bit report) ===
kernel32: process.c:4982: Test failed: Unexpected return value 0. process.c:4983: Test failed: Unexpected error.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w7u_adm (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w7u_el (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w8 (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w8adm (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w864 (32 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
=== w864 (64 bit report) ===
ntdll: om.c:2953: Test failed: Unexpected status 0xc0000008.
Apparently it only happens on Windows 10, according to test results. Better to ignore then.