[PATCH] user32: Fail if an invalid window handle is passed to GetMessage().

Alexandre Julliard julliard at winehq.org
Wed Sep 11 16:23:57 CDT 2019


Zebediah Figura <z.figura12 at gmail.com> writes:

> diff --git a/dlls/user32/message.c b/dlls/user32/message.c
> index 860ceefc38d..b0ab5be902b 100644
> --- a/dlls/user32/message.c
> +++ b/dlls/user32/message.c
> @@ -3836,6 +3836,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT
>      HANDLE server_queue = get_server_queue_handle();
>      unsigned int mask = QS_POSTMESSAGE | QS_SENDMESSAGE;  /* Always selected */
>  
> +    if (hwnd && !IsWindow( hwnd ))
> +    {
> +        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
> +        return -1;
> +    }

It needs to accept at least -1, and probably also 0xffff.

It would also be interesting to check other functions like
PeekMessage(), and maybe move the test to some inner function.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list