Lesson Learned: Don’t use outdated software

December 22, 2006

Actually there’s another episode behind the KeygenMe blog entry….

It begin, as I am tired of using Visual C++’s inline assembler to code KeygenMe. Thus, I decided that, it’s time for me to code real assembly, and it should be assembled with real assembler! ( not crappy cl.exe… LoL )

As an open source supporter, my first choice is nasm, also known as Netwide Assembler by Peter H. Anvin. I didn’t try GAS (GNU Assembler) because I don’t really like AT&T assembly syntax, I just use it for jokes.. ( not funny :P ) At the end, I didn’t use nasm as nasm is not really suited to Windows, I would definatly use nasm on Linux. With nasm, most APIs are not supported, and it doesn’t even come with a linker! ( On windows, of course… )

My next try would be something that is designed for Windows. So that’s either masm, also known as Microsoft Macro Assembler, or tasm, also know as Turbo Assembler, by Inprise/Borland. I don’t have masm with me, or rather, it comes with Windows XP Driver Development Kit, and doesn’t have complete support for all the usual user mode calls like printf, VirtualAlloc.. etc

Turbo Assembler comes with Borland Developer Studio, and the path is already set up, so I gave tasm a try. In fact, I gave it more than a try, I downloaded many sample code and read them. I also read many tutorials. The KeygenMe in my previous blog entry is assembeld with Turbo Assembler.

However, there’s an unexpected problem, after uploading it. Xentar messaged me that the file is missing one critical DLL — cc3270.dll. I instantly know that it’s a borland DLL. After some googling, I found out that I used the RTL .lib (cw32i.dll), instead, I should use the static .lib (cw32.lib) to link my KeygenMe. I happily modified my makefile and assembled it again, then uploaded it. I reckon that there’s not going to be anymore trouble…

However, the trouble is not over yet, after uploading it, I tried it myself. My KeygenMe terminated immediately after running. Something is very wrong. As it is late, I have no choice but to sleep first and solve the problem tomorrow. I uploaded the old KeygenMe with cc3270.dll from my system32/

The next day, after a whole morning of debugging with OllyDbg…

I found out that the stream is not initialize. with the static build. Unfortunately, the cw32.lib’s routine isn’t documented, I have no choice but to give up.

The main problem I have with Turbo Assembler is that:
- Many routines undocumented
- New Windows NT APIs are not completely supported
- Not much tutorial ( comparing to masm )
- Not much sample codes ( comparing to masm )

All this, is because Turbo Pascal is no longer supported by Borland, and they are not releasing new assemblers. This taught me a lesson, don’t use obsolete software.

Another conclusion about assembly programming:
Use gas if you want to be called a nerd. Just kidding :P ( LoL, brian )
Use gas if you need to be compatible with gcc, or you are working with Linux Kernel….
Use tasm if it’s year 2000 now.
Use nasm if you are with any POSIX system.
Use masm, if the above doesn’t fit….

You can expect my next KeygenMe to be assembled with masm. :D