fixup bogus SetLastError()

Alexandre Julliard julliard at winehq.com
Mon Jun 4 14:14:06 CDT 2001


520053692817-0001 at t-online.de (Andreas Mohr) writes:

> Now that's where I disagree !
> The caller can *not* always set it to another value.
> If it does and the program intends to read the LastError of a *previously*
> executed API that failed, then the LastError will be reset even though
> it shouldn't have been !

Then the caller needs to save/restore it across the GDI_GetObjPtr
call. That's trivial to do.

> In short: the SetLastError behaviour needs to match Windows behaviour very,
> very closely.

Definitely; but it's not clear to me that not setting last error is
anywhere closer to Windows than setting it to INVALID_HANDLE.
GDI_GetObjPtr should do what most callers need, and IMO this means
setting it. I may be wrong, I haven't checked the error returns of all
GDI functions (and of course this is nowhere documented).

> This would be SelectObject() in this case, BTW.

Which case?  Do you have evidence that a SelectObject() with an
invalid handle must not set last error?  If so then of course it needs
fixing.

-- 
Alexandre Julliard
julliard at winehq.com




More information about the wine-devel mailing list