Created
August 23, 2012 11:34
-
-
Save dockimbel/3435800 to your computer and use it in GitHub Desktop.
DLL loading testing program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <Windows.h> | |
int (*foo)(int) = NULL; | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
HMODULE handle = LoadLibraryA("temp.dll"); | |
printf("error: %i\n", GetLastError()); | |
printf("hModule: %i\n", handle); | |
foo = (int (*)(int)) GetProcAddress(handle, "f1"); | |
printf("error: %i\n", GetLastError()); | |
printf("&f1: %x\n", foo); | |
printf("%i\n", foo(123)); | |
printf("error: %i\n", GetLastError()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment