Advertisement
Nattack

Untitled

Feb 26th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "windows.h"
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10. typedef short (CALLBACK* DoAThing)();
  11.  
  12.  
  13. int main()
  14. {
  15.     HINSTANCE hGetProcIDDLL = LoadLibrary(L"kernel32.dll");
  16.  
  17.     if (hGetProcIDDLL != NULL) cout << "loaded DLL" << endl;
  18.     else
  19.     {
  20.         cout << "did not load DLL" << endl;
  21.         return 1;
  22.     }
  23.  
  24.     DoAThing DoAThingPtr = (DoAThing)GetProcAddress(hGetProcIDDLL, "GetCurrentProcessId");
  25.  
  26.     cout << DoAThingPtr();
  27.     FreeLibrary(hGetProcIDDLL);
  28.     cout << DoAThingPtr();
  29.  
  30.     DoAThingPtr = (DoAThing)GetProcAddress(hGetProcIDDLL, "GetCurrentProcessId");
  31.  
  32.     cout << DoAThingPtr();
  33.     cin.get();
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement