So, I had some free time earlier this afternoon and decided to work on a dll I need for a custom action for a MSI install package. In the past I've created spaghetti code because I was learning an interface and coding it for production at the same time. Then I had to go back and try to refactor the mess later. So this time I decided to only add the new code as a separate project just to learn from then I would write the production code afterward.
I fired up my code editor and started coding the test code. The first function was a very simple bit of code to get the RootDSE information from a domain. It is standard code that I've used dozens on times. So I compile the code and upload it to my test platform where...It crashes Hmm. That's weird, so I spent the next hour staring at these few lines of code. "Maybe my test platform has a problem," I thought. So I then wrote equivalent code in VBScript. It worked perfectly. So out of frustration I started looking on the web at the possibility of using a VBScript as a custom action in an MSI package. Turns out it is doable, but not advisable. That was a nice time wasting diversion. Back to staring at the C++ code. Now after an hour the problem jumps out at me. It was dumb. ADSI(The interface for talking to active directory) is COM based and I had forgotten to call CoIntialize. Now I can actually start working on the code I want to work on, but oops times up. I have other weekend obligations to got take care, so I just wasted all my development time this afternoon.
No one else was in the room, but it didn't stop me from being embarrassed.