Search code examples
dllshared-librariesdllexport

How to check if loaded address from dll is function or variable?


So I am loading functions with this syntax:

typedef void* (*unknownf)(
#ifdef __cplusplus
...
#endif
);
unknown funci=(unknownf*)GetProcAddress(dll, "SomeFunction");`

and data with this

typedef void* (*unknownd);
conversiontype *some=(unknownd*)GetProcAddress(dll,"SomeData");

How to check if address contains data or function? What else can be there?

Edit: Please is there some programmatical way how to check it?


Solution

  • I found a way I check IMAGE_DOS_HEADER of DLL for sections .data .edata .rdata and .reloc and then I try to determine in which section is the name.