On Thu, 2005-03-03 at 08:24, Dmitry Timoshkov wrote: > "Paul Vriens" <[EMAIL PROTECTED]> 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. OK,
make sense, that crossed my mind before especially when I wrote "It appears...". So the approach should be something like: SetLastError(0xdeadbeef) 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"); return; } if (rc != 0 && (GetLastError()==0xdeadbeef)) { /* API did not change the last error to 0 */ what_do_we_do_here? } if (rc != 0 && (GetLastError()==0)) { /* API changed the last error to 0 */ do_nothing! } 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. Cheers, Paul.