Make Code For Dll Inject

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • ► You must register to download attachments!
Swift Games Accounts
Nov 16, 2013
Hello Fleep,
first i wanna thx for the tutor, its very helpfull 4 me, btw i already watch how to make any hack game, & and i success to follow ur totur until finish..
btw in ur tutor u make a console for hack & interface for DLL, but i just want to make an Hotkey for the DLL inject, not using a interface, iam sorry
in this case iam a noob in C++ and making hack, i already change some code here but after i build and inject to game AssaultCube nothing happen, cant u help me
whats wrong in that code?
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>

DWORD FindDmaAddy (int PointerLevel, HANDLE hProcHandle, DWORD Offset[], DWORD BaseAddress);
void WriteToMemory(HANDLE hProcHandle);

std::string GameName = "AssaultCube";
LPCSTR LGameWindow ="AssaultCube";

bool IsGameAvail;
bool UpdateOnNextRun;

//----------AMMO Base---------------
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3, 0x1C, 0x0, 0x0 };
DWORD AmmoBaseAddress = {0x00509B74};
DWORD AmmoOffset[]= {0x384, 0x14, 0x0};

//----------Helaty Base-----------
bool HealthStatus;
BYTE HealthValue[] = {0x39, 0x5, 0x0, 0x0 };
DWORD HealthBaseAddress = {0x00509B74};
DWORD HealthOffset[]= {0xF8};

DWORD FindDmaAddy (int PointerLevel, HANDLE hProcHandle, DWORD Offset[], DWORD BaseAddress)
    DWORD pointer = BaseAddress;
    DWORD pTemp;

    DWORD pointerAddr;
    for(int c =0; c < PointerLevel; c++)
        if(c == 0)
            ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof (pTemp), NULL);

        pointerAddr = pTemp + Offset[c];
        ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof (pTemp), NULL);
    return pointerAddr;

void WriteToMemory(HANDLE hProcHandle)

    DWORD AddressToWrite;
        AddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffset, AmmoBaseAddress);
        WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);

        AddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffset, HealthBaseAddress);
        WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &HealthValue, sizeof(HealthValue), NULL);

DWORD WINAPI Main_Thread (LPVOID lpParam)
    HWND hGameWindow = NULL;
    int OnePressTMR = clock();

    if(clock() - OnePressTMR > 400)
            MessageBeep (100);
            OnePressTMR = clock();
            AmmoStatus = !AmmoStatus;

    return NULL;

bool APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
    if(dwReason == DLL_PROCESS_ATTACH)
        CreateThread(NULL, NULL, (Main_Thread), NULL, NULL, NULL);
    return TRUE;
thx 4 ur kindness to replay...
Mar 14, 2013
main thread returns null just after being created. Your if(IsGameAvail) is messed, set to false jumps over you getasynckeystate loop and returns null