Windows function address to identifier



  • Long time reader, first time poster here! I have a question regarding me porting a *nix command-line application (C) to windows.

    My application keeps track of memory errors in a program. While the program runs, it prints out memory usage info and function stack pointers to an external file. Then whenever I run a report program (passing the client program and the external file as command-line parameters), it will print out information about all memory leaks, including function stack traces for when memory was leaked.

    The function stack traces are printed as a list of function identifiers, but they are stored in the external file as pointers. I use popen() and pass it the "nm" command to translate function pointers to function identifiers at runtime. I can compile the program on Windows alright, but I am unable to do function pointer to string translation at runtime. So my question is this:

    1. Is there some other windows-specific method I can used to translate function pointers to function identifiers, given the name of the executable file?
    2. Is there some command that I can use with _popen() which is similar to "nm"?

    Thanks in advance for any help/advice/comments!



  • AFAIK, the function names on Windows get crunched away, when the executable is linked (except the imports/exports, obviously). So, unless you have debugging symbols, you're boned. If you have them, try looking up the DbgHelp library in MSDN Library.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.