Paul Gofman (@gofman) commented about dlls/kernel32/tests/sync.c:
maxevents[0] = pseudohandles[i];SetLastError(0xdeadbeef);r = WaitForMultipleObjects(1, maxevents, FALSE, 100);ok(r == WAIT_FAILED, "expected WAIT_FAILED, got %lu\n", r);ok(GetLastError() == ERROR_INVALID_HANDLE,"expected ERROR_INVALID_HANDLE, got %lu\n", GetLastError());
- maxevents[0] = GetCurrentThread();
- SetLastError(0xdeadbeef);
- r = WaitForMultipleObjects(1, maxevents, FALSE, 100);
- ok(r == WAIT_FAILED, "expected WAIT_FAILED, got %lu\n", r);
- ok(GetLastError() == ERROR_INVALID_HANDLE,
"expected ERROR_INVALID_HANDLE, got %lu\n", GetLastError());
timeout.QuadPart = -1000000;status = pNtWaitForMultipleObjects(1, maxevents, WaitAny, FALSE, &timeout);ok(status == STATUS_INVALID_HANDLE, "expected STATUS_INVALID_HANDLE, got %08lx\n", status);
For completeness, I'd also add the same test with WaitAll after that (I checked locally that it works the same way at least on Win11).