kernel32/tests: Test deletion of synchronization objects after handle close.

This commit is contained in:
Jinoh Kang 2022-07-19 00:00:18 +09:00 committed by Alexandre Julliard
parent 60a84d0e66
commit e613992cee

View file

@ -182,6 +182,51 @@ static void test_signalandwait(void)
CloseHandle(file);
}
static void test_temporary_objects(void)
{
HANDLE handle;
SetLastError(0xdeadbeef);
handle = CreateMutexA(NULL, FALSE, "WineTestMutex2");
ok(handle != NULL, "CreateMutex failed with error %ld\n", GetLastError());
CloseHandle(handle);
SetLastError(0xdeadbeef);
handle = OpenMutexA(READ_CONTROL, FALSE, "WineTestMutex2");
ok(!handle, "OpenMutex succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
handle = CreateSemaphoreA(NULL, 0, 1, "WineTestSemaphore2");
ok(handle != NULL, "CreateSemaphore failed with error %ld\n", GetLastError());
CloseHandle(handle);
SetLastError(0xdeadbeef);
handle = OpenSemaphoreA(READ_CONTROL, FALSE, "WineTestSemaphore2");
ok(!handle, "OpenSemaphore succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
handle = CreateEventA(NULL, FALSE, FALSE, "WineTestEvent2");
ok(handle != NULL, "CreateEvent failed with error %ld\n", GetLastError());
CloseHandle(handle);
SetLastError(0xdeadbeef);
handle = OpenEventA(READ_CONTROL, FALSE, "WineTestEvent2");
ok(!handle, "OpenEvent succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
handle = CreateWaitableTimerA(NULL, FALSE, "WineTestWaitableTimer2");
ok(handle != NULL, "CreateWaitableTimer failed with error %ld\n", GetLastError());
CloseHandle(handle);
SetLastError(0xdeadbeef);
handle = OpenWaitableTimerA(READ_CONTROL, FALSE, "WineTestWaitableTimer2");
ok(!handle, "OpenWaitableTimer succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
}
static void test_mutex(void)
{
DWORD wait_ret;
@ -2825,6 +2870,7 @@ START_TEST(sync)
test_QueueUserAPC();
test_signalandwait();
test_temporary_objects();
test_mutex();
test_slist();
test_event();