This answer assumes that you want to parse a standard Windows executable that is dynamically linked to other import libraries (.lib and assoicated.dll files that are not statically linked), and if so, you want PE (Portable Executable).
Here's a good article to get you started, with sample code for resetting the PE header.
You want to focus on the import table (.idata section) for external library calls and the export table (.edata section) for calls defined inside the executable and marked as exportable (this usually only exists in .dll files).
For static libraries, their format is called COFF, and there is the DUMPBIN utility that comes with Visual Studio, which you can use to quickly map to your lib files and even reset code parsing if you want.
The DUMPBIN utility, which is provided with the 32-bit version of Microsoft Visual C ++, combines LINK, LIB, and EXEHDR utilities. The combination of these tools shows the ability to provide information about the format and characters represented in executable, library and DLL files.
For information on the structure of COFF files, see.
Finding out if a function call was called from the lib library or not, but because I remember, most of the static lib calls in the code are actually thunk calls (simple jmp calls for the actual object code copied from lib) and are small in size size (usually around 5 bytes), while user-defined are not thunks and are based on bp frame calls.
source share