win32u: Move normalize_std_handle call to NtUserMsgWaitForMultipleObjectsEx.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-03 12:43:13 +02:00 committed by Alexandre Julliard
parent 69ab9568b2
commit 365bc308be
2 changed files with 14 additions and 22 deletions

View file

@ -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? */
{

View file

@ -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,