C Dll injection Failing to modify static address on AssaultCube Game

44 views Asked by At

after some headache, i finally got my DLL running inside AssaultCube game, but i am having problems modifying a static pointer with C, I dont think i am being able to achieve the right address according to cheat engine, when i run this code, nothing changes in the game itself. the pointer does work in cheat engine, but not in my code, here's the problematic piece of it:

if (LOWORD(wParam) == AMMO_BUTTON ) {

    //                   |            process address       |  address   |       offsets      |
    HMODULE baseAddress = GetModuleHandleA("ac_client.exe") + 0x00183828 + 0x8 + 0x190 + 0x428;



    char buffer[20];
    sprintf(buffer, "0x%llx", baseAddress);  // converts the address to a string
    MessageBox(hwnd,buffer, "thing", MB_OK);

    int ammo = 1000;
    WriteProcessMemory(GetCurrentProcess(), (LPVOID)baseAddress, &ammo, sizeof(int), NULL);
    MessageBox(hwnd, "Button pressed!", "pog", MB_OK);
}

Please notice that the line MessageBox(hwnd,buffer, "thing", MB_OK); returns me 0x800a00a0f7a0 and not 0x006DFAA8 like it's pictured down here:

Cheatengine

I am sure there's an easy fix to this problem, but i'm quite new to this, please dont be rude. Thanks in advance.

0

There are 0 answers