dynamic win32

Started by
11 comments, last by rmsimpson 18 years, 4 months ago
OK, forget actually calling the functions for now, if you load a module say mylib.dll with LoadModule and want to get all the function names, what would you do next? This, really, is the main bit I am having difficulty with. I couldn't find DUMPBIN anywhere.
Advertisement
Your best bet for what you apparently want to do (list all functions somewhere) would be to write a C parser. All the functions you want (that you can really use) will be defined in various header files. All you need to do, then is parse the information out of there. While not a trivial task, it shouldn't be too difficult either since you only need to find types (to know what parameters should be) and function declarations (to know what functions there are) and can, for the most part, ignore any other information that may be present. If you want to match this list to a DLL, you'll have to extract the list and include it in your program (perhaps as a data file of some kind) and then match the function names to those you find in the DLL. To find them in the DLL, you can either use an API (which I can't remeber) or you just need to know the DLL format, called 'PE' for portable executable. You can find a description on wotsit

I mention C becaue none of the windows API or OpenGL API uses C++ specific features, and while DirectX does, it also works with C. You'll likely have to make a lot of exceptions in your compiler, though, since microsoft is fond of comlier extension and the like and I imagine that they used quite a few in their definition of the windows API.

For this task, I suggest you get the Dragon Book that covers how to create compilers, and a working paper on the C Standard.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
DUMPBIN comes with Visual Studio.

Peering Inside the PE: A Tour of the Win32 Portable Executable File Format

That'll explain everything you ever wanted to know about the PE file format and how to extract exports from a library.

Robert

This topic is closed to new replies.

Advertisement