[PATCH 2/4] kernel32: fix WaitForMultipleObjectsEx for handles with lower 2 bits set
Peter Oberndorfer
kumbayo84 at arcor.de
Wed Sep 22 12:53:16 CDT 2010
Handles with the 2 lower bits set can still be valid.
We recognized the 2 lower bits set as a console handle,
but later when finding out it is no real console handle
the function returned early.
---
dlls/kernel32/sync.c | 7 ++-----
dlls/kernel32/tests/sync.c | 4 ++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index eac08c8..b65b626 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -180,11 +180,8 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
*/
if (is_console_handle(hloc[i]))
{
- if (!VerifyConsoleIoHandle(hloc[i]))
- {
- return FALSE;
- }
- hloc[i] = GetConsoleInputWaitHandle();
+ if (VerifyConsoleIoHandle(hloc[i]))
+ hloc[i] = GetConsoleInputWaitHandle();
}
}
diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c
index 3e791b6..6832857 100644
--- a/dlls/kernel32/tests/sync.c
+++ b/dlls/kernel32/tests/sync.c
@@ -979,7 +979,7 @@ static void test_WaitForSingleObject(void)
SetLastError(0xdeadbeef);
ret = WaitForSingleObject(modify_handle(invalid, 3), 0);
- todo_wine ok(ret == WAIT_FAILED, "expected WAIT_FAILED, got %d\n", ret);
+ ok(ret == WAIT_FAILED, "expected WAIT_FAILED, got %d\n", ret);
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
/* valid handle with different values for lower 2 bits */
@@ -1000,7 +1000,7 @@ static void test_WaitForSingleObject(void)
SetLastError(0xdeadbeef);
ret = WaitForSingleObject(modify_handle(nonsignaled, 3), 0);
- todo_wine ok(ret == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %d\n", ret);
+ ok(ret == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %d\n", ret);
todo_wine ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
/* valid handle with different values for lower 2 bits */
--
1.7.0.4
More information about the wine-patches
mailing list