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

Zebediah Figura z.figura12 at gmail.com
Wed Sep 11 19:24:41 CDT 2019


On 9/11/19 4:23 PM, Alexandre Julliard wrote:
> 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.
> 

Thanks for the review; will do.



More information about the wine-devel mailing list