I’m having a lot of fun these days disassembling x86 code. I haven’t had this much fun since the good old days when me and some friends produced the first annotated disassembly of the ROM’s inside the venerable Commodore 4040 dual disk drive in 1981. This led to the creation of various disk drive utilities like sector manipulation programs, a fast replacement for the disk drive’s formatting routines (which were really brain-dead), and some high-speed disk copying programs. It also led to the creation of a bunch of fun “products”, the most interesting of them being the CCC Bit Bug’s Sing-Song program that made Commodore 1541 disk drives play a song by ramming the disk drive head against the head stop at varying frequencies. Aaahh, those were the days.
Enough nostalgia. I’m rather new to the world of disassembling x86 code, but I figured that its high time that I scratched this particular itch. I’ve been spending some time reading the documentation for WinDBG. In particular, there is one particularly great article in there that shows an annotated disassembly of some typical C++ code. This code even calls some methods on COM interfaces so that you can see what that looks like. Since its buried inside of the WinDBG help file (and I can’t link to it from here), I’ve reproduced it here for your convenience.