From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/win32u/driver.c | 22 +--------------------- dlls/win32u/message.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 175fde1fa40..ebc512bb4ee 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -792,35 +792,15 @@ static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout return time; }
-static HANDLE normalize_std_handle( HANDLE handle ) -{ - if (handle == (HANDLE)STD_INPUT_HANDLE) - return NtCurrentTeb()->Peb->ProcessParameters->hStdInput; - if (handle == (HANDLE)STD_OUTPUT_HANDLE) - return NtCurrentTeb()->Peb->ProcessParameters->hStdOutput; - if (handle == (HANDLE)STD_ERROR_HANDLE) - return NtCurrentTeb()->Peb->ProcessParameters->hStdError; - - return handle; -} - static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags ) { NTSTATUS status; - HANDLE hloc[MAXIMUM_WAIT_OBJECTS]; LARGE_INTEGER time; - unsigned int i;
if (!count && !timeout) return WAIT_TIMEOUT; - if (count > MAXIMUM_WAIT_OBJECTS) - { - SetLastError(ERROR_INVALID_PARAMETER); - return WAIT_FAILED; - } - for (i = 0; i < count; i++) hloc[i] = normalize_std_handle( handles[i] );
- status = NtWaitForMultipleObjects( count, hloc, !(flags & MWMO_WAITALL), !!(flags & MWMO_ALERTABLE), + status = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL), !!(flags & MWMO_ALERTABLE), get_nt_timeout( &time, timeout ) ); if (HIWORD(status)) /* is it an error code? */ { diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index d43dca723d2..67990e7b1f4 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1963,6 +1963,18 @@ static DWORD wait_objects( DWORD count, const HANDLE *handles, DWORD timeout, return ret; }
+static HANDLE normalize_std_handle( HANDLE handle ) +{ + if (handle == (HANDLE)STD_INPUT_HANDLE) + return NtCurrentTeb()->Peb->ProcessParameters->hStdInput; + if (handle == (HANDLE)STD_OUTPUT_HANDLE) + return NtCurrentTeb()->Peb->ProcessParameters->hStdOutput; + if (handle == (HANDLE)STD_ERROR_HANDLE) + return NtCurrentTeb()->Peb->ProcessParameters->hStdError; + + return handle; +} + /*********************************************************************** * NtUserMsgWaitForMultipleObjectsEx (win32u.@) */ @@ -1979,7 +1991,7 @@ DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handl }
/* add the queue to the handle list */ - for (i = 0; i < count; i++) wait_handles[i] = handles[i]; + for (i = 0; i < count; i++) wait_handles[i] = normalize_std_handle( handles[i] ); wait_handles[count] = get_server_queue_handle();
return wait_objects( count+1, wait_handles, timeout,