Friday 28 November 2003

This is (not) broken

Whoo, might as well start somewhere.

So I found a link to This Is Broken from Brad Abrams’ blog (one of my regular reads, we'll try OPML out later to update links). Having a bit of a read, I found this article on software errors.

I suppose this is my field ;-)

I think what's happening here is that a Windows API call has failed. Most Windows APIs return a BOOL, that is, non-zero if succeeded, zero if failed. To get extended error information, you add a call to GetLastError. You can FormatMessage to get a human-readable version of the error.

In this case, GetLastError has returned ERROR_SUCCESS (0), which in English locales becomes “The operation completed successfully.”

There are two possible reasons for this that I can think of: either the API didn't call SetLastError when it failed, or the programmer called another API which called SetLastError with 0 (which it shouldn't, but there are some APIs that do) between the failed API and the call to GetLastError.

Windows 9x and Me don't always call SetLastError when things fail, so you tend to see this more on those platforms. Windows XP family (I'm not going to type NT/2000/XP/Server 2003 every time) operating systems are better at setting the error code.

Conclusion: might be Macromedia’s fault; might be Microsoft’s.

No comments: