Paul Gofman (@gofman) commented about dlls/kernel32/tests/sync.c:
- timeout.QuadPart = -1000000; - status = pNtWaitForSingleObject(GetCurrentProcess(), FALSE, &timeout); - ok(status == STATUS_TIMEOUT, "expected STATUS_TIMEOUT, got %08lx\n", status); + /* non-waitable pseudo-handles return STATUS_INVALID_HANDLE */ + for (i = 0; i < ARRAY_SIZE(non_waitable_pseudohandles); i++) + { + SetLastError(0xdeadbeef); + ret = WaitForSingleObject(non_waitable_pseudohandles[i], 100); + ok(ret == WAIT_FAILED, "expected WAIT_FAILED, got %ld\n", ret); + ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError()); + + timeout.QuadPart = -1000000; + status = pNtWaitForSingleObject(non_waitable_pseudohandles[i], FALSE, &timeout); + todo_wine_if(non_waitable_pseudohandles[i] == NtCurrentProcessToken() || + non_waitable_pseudohandles[i] == NtCurrentEffectiveToken()) + ok(status == STATUS_INVALID_HANDLE, "expected STATUS_INVALID_HANDLE, got %08lx\n", status); It is best to add '&& status == <wine_error_code>' to todo_wine_if, to test and illustrate clearly that Wine wait doesn't succeed in this special case but returns a different error code.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9305#note_120170