I actually teach a malware analysis class and have done this as well. Please contact me and I can give you some pointers and / or source code. tyler at hudakville dot com
"How many teamsters does it take to screw in a light bulb?" "FIFTEEN!! YOU GOT A PROBLEM WITH THAT?"