On Di, 2006-10-03 at 20:40 +0300, Saulius Krasuckas wrote:
It makes sense to check last error value only if an API has failed, while you are adding last error checks everywhere. Unless you have an application that depends on it, that's wrong.
Well, thanks. I'll change that, but is it wrong just because it slightly increases code complexity for no direct benefit? I just want to know for future.
For the normal case, SetLastError() is called only on failure.
http://msdn.microsoft.com/library/en-us/debug/base/setlasterror.asp
There might be some broken Applications, that expect GetLastError() to return a special Value, even when a Function returns success, but they will fail very fast on native Windows with a different version of Windows, SP, Hotfix or Driver.
Do you have such a Application?