#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#include <windows.h>
int main(int argc, char** argv) {
  HMODULE hModule = 0;
  FARPROC pFunction = 0;
  if (argc < 2 || argc > 3) {
    printf("Usage:\r\n  %s module_name [function_name]\r\n", argv[0]);
  } else {
    hModule = LoadLibraryEx(argv[1], NULL, DONT_RESOLVE_DLL_REFERENCES);
    if (!hModule) {
      printf("Module not found!\r\n");
    } else {
      printf("Module base     : %08X\r\n", (UINT)hModule);
      if (argc == 3) {
        pFunction = GetProcAddress(hModule, argv[2]);
        if (!pFunction) {
          printf("Function not found!\r\n");
        } else {
          printf("Function offset : %+8X\r\n", (UINT)pFunction - (UINT)hModule);
        }
      }
    }
  }
}
