John Lam 1997 — 2026

More assembly language fun

My work on reverse-engineering the P/Invoke call stub continues. Don Box’s posting of some annotated disassembly for the key It Just Works (IJW) thunk on the DOTNET list helped me figure out what a key instruction sequence did. However, the thunk that Don posted is not the only thunk that gets invoked. It’s considerably more complex than this, hence the delay in getting my P/Invoke internals article finished. Stay tuned for further updates.

I found that I had to brush up on a lot of stuff that I haven’t had to use for a long time. The last time I did any significant reverse-engineering of x86 code was when I had to disassemble shell32.dll to figure out how to write Explorer namespace extensions before Microsoft semi-documented how to do this. Here’s a collection of more resources to check out as you begin diving into x86 code:

  1. Matt Pietrek’s excellent Just Enough Assembly Language to Get By Under the Hood column from February 1998 that gives you just enough assembly language to get by.
  2. Matt’s Just Enough Assembly Language to Get By Part II.
  3. Steve Loughran’s excellent Code for Speed paper. This is a great look at lots of pieces of the performance puzzle that often get overlooked. From CPU architecture to memory to tools to threading issues to C++ coding practices, this is a great introduction to the zen of performance measurement.
  4. Chapter 6 of John Robbins most excellent Debugging Applications book from MS Press.