[PATCH] user32: Fix error handling in MapWindowPoints, ClientToScreen and ScreenToClient and add tests for them.

Christian Costa titan.costa at gmail.com
Sat Oct 20 00:16:45 CDT 2012


Le 20/10/2012 03:59, Dmitry Timoshkov a écrit :
> Christian Costa <titan.costa at gmail.com> wrote:
>
>> -BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
>> +BOOL WINAPI ClientToScreen( HWND wnd, LPPOINT point )
>>   {
>> -    MapWindowPoints( hwnd, 0, lppnt, 1 );
>> +    DWORD error = GetLastError();
>> +
>> +    if (!wnd)
>> +    {
>> +        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
>> +        return FALSE;
>> +    }
>> +
>> +    SetLastError( 0xdeadbeef );
>> +    MapWindowPoints( wnd, 0, point, 1 );
>> +
>> +    if (GetLastError() != 0xdeadbeef)
>> +        return FALSE;
>> +
>> +    SetLastError(error);
>>       return TRUE;
>>   }
> All this logic with saving/restoring last error code is wrong (here and
> in another places), there is no need for that.
>
I'm not it is wrong but I can do certainly do it differently.



More information about the wine-devel mailing list