Advertisement
AbsoluteGamer

Tiny DLL Injector

Sep 2nd, 2017
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2.  
  3. BOOL InjectDLL(HANDLE hProcess, const char *dll_path) {
  4.     LPVOID alloc = VirtualAllocEx(hProcess, NULL, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  5.     WriteProcessMemory(hProcess, alloc, dll_path, MAX_PATH, NULL);
  6.     return (BOOL)CreateRemoteThread(hProcess, 0, 0, (LPTHREAD_START_ROUTINE)LoadLibraryA, alloc, 0, 0);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement