qutiques

C++ injector template

Sep 5th, 2025
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. // dllmain.cpp : Defines the entry point for the DLL application.
  2. #include "pch.h"
  3. #include <Windows.h>
  4.  
  5. // Your hack thread
  6. DWORD WINAPI HackThread(HMODULE hModule)
  7. {
  8.  
  9.     // Get base address of ac_client.exe
  10.     HMODULE hMod = GetModuleHandle(NULL); // NULL gives the main exe module
  11.     if (!hMod) {
  12.         MessageBoxA(0, "Failed to gett module handle", "Error", MB_OK);
  13.         return 0;
  14.     }
  15.  
  16.     uintptr_t moduleBase = (uintptr_t)hMod;
  17.     uintptr_t PlayerAddress = *(uintptr_t*)(moduleBase + 0x0018AC00);
  18.  
  19.     int* ammo = (int*)(PlayerAddress + 0x140);
  20.  
  21.     FreeLibraryAndExitThread(hModule, 0);
  22.     return 0;
  23. }
  24.  
  25. // DllMain entry point
  26. BOOL APIENTRY DllMain(HMODULE hModule,
  27.     DWORD  ul_reason_for_call,
  28.     LPVOID lpReserved
  29. )
  30. {
  31.     switch (ul_reason_for_call)
  32.     {
  33.     case DLL_PROCESS_ATTACH:
  34.         // Spawn your hack thread when DLL is injected
  35.         CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr);
  36.         break;
  37.  
  38.     case DLL_THREAD_ATTACH:
  39.     case DLL_THREAD_DETACH:
  40.     case DLL_PROCESS_DETACH:
  41.         break;
  42.     }
  43.     return TRUE;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment