fixup bogus SetLastError()

Andreas Mohr 520053692817-0001 at t-online.de
Mon Jun 4 14:43:15 CDT 2001


On Mon, Jun 04, 2001 at 12:14:06PM -0700, Alexandre Julliard wrote:
> 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.
Hmm, yeah.

> > 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).
Yep, you might have a point here. Most probably you do.

> > 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.
Hmm, not sure here.
I just noticed in a test program that it had 0 on windows and 6 on Wine.
Where exactly it did that SelectObject with a NULL handle is unknown to me.
Of course this does NOT mean that SelectObject needs fixing. It might be
the case, but it could just mean that Windows does not call SelectObject
with a NULL handle in the functionality needed by my program.
Testing SelectObject validity is trivial, of course ;-)
(I might even do that soon)

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604                http://home.germany.net/100-30936/




More information about the wine-devel mailing list