Commit 365bc308 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move normalize_std_handle call to NtUserMsgWaitForMultipleObjectsEx.

parent 69ab9568
......@@ -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? */
{
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment