Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "windows.h"
- #include <iostream>
- using namespace std;
- typedef short (CALLBACK* DoAThing)();
- int main()
- {
- HINSTANCE hGetProcIDDLL = LoadLibrary(L"kernel32.dll");
- if (hGetProcIDDLL != NULL) cout << "loaded DLL" << endl;
- else
- {
- cout << "did not load DLL" << endl;
- return 1;
- }
- DoAThing DoAThingPtr = (DoAThing)GetProcAddress(hGetProcIDDLL, "GetCurrentProcessId");
- cout << DoAThingPtr();
- FreeLibrary(hGetProcIDDLL);
- cout << DoAThingPtr();
- DoAThingPtr = (DoAThing)GetProcAddress(hGetProcIDDLL, "GetCurrentProcessId");
- cout << DoAThingPtr();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement