Question: 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:

1. To your knowledge, it is possible to extract information about code/data position (address + length) only via DbgHelp?
2. 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)
3. 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.

Answer: 
There is a [PDB extractor](http://undocumented.rawol.com/win_pdbx.zip) for download at the page here: <http://undocumented.rawol.com>. It can extract all information when you use the /type option. There is also an article with PDB viewer here: <http://www.codeproject.com/KB/bugs/PdbParser.aspx> but it extracts less information.

Both utilities come with source code.
Well, I just happened to read the other day that [DIA is a lot easier to use from C#](http://msinilo.pl/blog/?p=425 "Crunching bytes | .mischief.mayhem.soap.:") (links to source for a simple program); another program that keeps coming up on my google searches is [PDB Cracker](http://www.ishani.org/pdb.php), which also has source code, and is probably more relevant to your intended application.