One of the most confusing things about Microsoft's OLE (and COM, which is based on it), is that they reverse the values of true and false.

It took me about a week to find this problem with some code I was writing. There was a function in a DLL I was writing that was to be called by the Windows Explorer to determine if the module could be safely unloaded. The function was called DllCanUnloadNow. So, the function returns false until it is done doing what it needs to do, at which point it lets the shell unload it by returning true. Except that the module kept on getting unloaded over and over again when it wasn't supposed to. This is because my function was returning TRUE and FALSE, the standard Windows boolean values, defined to 1 and 0, respectively. Because this was a COM environment, I was supposed to be using S_OK and S_FALSE, defined to 0 and 1 respectively--the exact reverse of what you would expect. Clearly this is based on the convention that a zero return code indicates success... except that I'm not indicating success, I'm just answering a question. Naturally, this is not an error that cannot be picked up at compile time. Oh, Microsoft, what are you doing to me?