Obtaining information about executable code from exe/pdb
Posted
by Miro Kropacek
on Stack Overflow
See other posts from Stack Overflow
or by Miro Kropacek
Published on 2009-06-09T14:39:15Z
Indexed on
2010/03/15
23:09 UTC
Read the original article
Hit count: 472
Hello,
I need to extract code (but not data!) from classic win32 exe/dll files. It's clear I can't do this only with extraction of code segment content (because code segment contains also the data -- jump tables for example) and that I need some help from compiler.
*.map files are nice but they only contain addresses of functions, i.e. the safest thing I can do is to start at that address and to process until the first return / jump instruction (because part of the function could be mentioned data)
*.pdb files are better but I'm not sure what tools to use to extract information like this -- I took a look at DbgHelp and DIA SDK, the latter one seems to be the right tool but it doesn't look very simple. So my question/questions:
- To your knowledge, it is possible to extract information about code/data position (address + length) only via DbgHelp?
- If the DIA SDK is the only way, any idea what should I call for getting information like that? (that COM stuff is pretty heavy)
- Is there any other way?
Of course my concern is about Visual Studio, C/C++ source compilation in the first place.
Thanks for any hint.
© Stack Overflow or respective owner