The MASM Forum

Specialised Projects => CoderStudio => Topic started by: Vortex on June 02, 2024, 06:04:38 AM

Title: Verifying exported functions
Post by: Vortex on June 02, 2024, 06:04:38 AM
This small code verifies if a function is exported by a specific DLL :

#include <stdio.h>
#include <windows.h>

int main(int argc, char *argv[])
{

char *report[] = {"%s is exporting %s","%s does not export the function %s"};

HMODULE hDll;
FARPROC func;
int rv;

if (argc!=3){
printf("Usage : VerifyExport32 DLLname FuncName\n");
return 2;
}

hDll=LoadLibrary(argv[1]);

if (!hDll) {
printf("%s could not be loaded.",argv[1]);
return 3;
}

func=GetProcAddress(hDll,argv[2]);

rv=!func;

printf(report[rv],argv[1],argv[2]);

FreeLibrary(hDll);

return rv;
}