WaxfordSqueers
December 25th, 2006, 11:07
Quote:
[Originally Posted by cse_india;63365]1)what is ImpRec doing here. is it just rebuilding the Import table ( fixing IAT) or is it fixing the exe as a whole. |
You'll get much better technical answers than mine, but I'd like to suggest you trace into your app to watch the IAT being formed. You'll see that the IAT has values (pointers) that point to addresses further into the IAT and that the initial stage is subdivided into groups of system functions like Kernel32, User32, etc. (XP will no doubt have different functions listed, but I haven't worked on XP IATs).
While the app is being loaded, it replaces the pointers and writes the actual names of the functions being pointed to. If you did that by hand, it would be a lot of work and take a lot of time. Tools like Imprec and Revirgin do that work for you, for the most part, and are able to pump out an IAT that can be pasted to your app.
It is an interactive process, however, since the tools can't always properly identify all of the functions correctly. You have to find those functions and tell Imprec about them. Sometimes that is by design, since the program writer doesn't want you to find them. They hold certain functions out of the IAT and use GetProcAddress to look up the functions as required. To answer your question, then, Imprec is saving you a lot of time and effort by finding what it can of the IAT, assembling it and giving you the option to write it as a bin file.
Unless Imprec has been changed recently, it doesn't fix up the PE header for you. If you add a section to paste the IAT, you have to tell the PE header what you did. There are tools that will add a section for you and fix up the PE header, like Lord PE. I would think you'd still have to redirect the app to your new IAT, however.
As an exercise, you might try tracing into your app till the IAT is loaded. Watch where the app is writing it to, dump it, print it and study it. Then look at whatever Imprec is able to recreate and see what might be missing. I'm sure modern apps are onto these tricks and are not going to make it that easy for you. So, you should start with a tutorial on an older app. There are some really good ones in the archives.