[user/tests/sysparams.c] Added more SetLastError(0)'s

Paul Vriens Paul.Vriens at xs4all.nl
Thu Mar 3 02:05:02 CST 2005

On Thu, 2005-03-03 at 08:24, Dmitry Timoshkov wrote:
> "Paul Vriens" <Paul.Vriens at xs4all.nl> wrote:
> > as discussed a few times on wine-devel, there isa  need to clear the
> > last error before calling a SPI_{GET|SET} routine.
> > 
> > It appears that not every call resets the last error to 0 on succession
> > and thus errors will propagate and leave us in the dark.
> You have to set last error to some bogus value (usually 0xdeadbeef)
> in order to test whether an API really has changed it.

make sense, that crossed my mind before especially when I wrote "It

So the approach should be something like:

rc=SystemParametersInfoA( SPI_GET*, 0, &old_*, 0 );

if (rc == 0 && (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED || GetLastError()==ERROR_INVALID_SPI_VALUE))
  /* Call is not implemented apparently */
  trace("SPI_{GET,SET}* not supported on this platform\n");

if (rc != 0 && (GetLastError()==0xdeadbeef))
  /* API did not change the last error to 0 */

if (rc != 0 && (GetLastError()==0))
  /* API changed the last error to 0 */

should we have an 'ok' call for the fact whether the last error is set
or not? If yes then we first need a lot of tracing to show the results
on several platforms.



More information about the wine-devel mailing list