Results 1 to 10 of 10
  1. #1
    D@nny's Avatar
    Join Date
    Jul 2016
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired

    DLL Hack not workig

    Hey Community,
    I've been trying to make a basic dll ammo hack for Assault Cube. Using Cheat Engine I found the basepointer that is also working everytime I use Cheat Engine to modify the Value but if im injecting my Dll file nothing is happening. :/
    Here's my Code I hope someone can tell my what I did wrong(I'm total noob at hacking and C++ xD):

    Code:
    #include <windows.h>
    
    
    
    
    
    DWORD FindAddress()
    {
        HMODULE hClient = GetModuleHandleA("ac_client.exe");
        DWORD basePointer = (DWORD)hClient + 0x00109B74;
        DWORD ammoAddress = basePointer + 0x150;
    
    
        return ammoAddress;
    }
    
    
    
    
    void hackFunction(DWORD Address)
    {
        DWORD* pAddress = (DWORD*)Address;
        *pAddress = 1337;
    }
    
    
    DWORD WINAPI HackThread(LPVOID unused)
    {
        DWORD targetAddress = NULL;
        targetAddress = FindAddress();
    
    
        BOOL hackEnabled = false;
        for (;;)
        {
            
            if (GetAsyncKeyState(VK_F1))
            {
                if (hackEnabled == true)
                {
                    hackEnabled = false;
                }
                else { hackEnabled = true; }
    
    
                Sleep(50);
            }
            if (hackEnabled == true)
            {
                hackFunction(targetAddress);
            }
    
    
        }
    
    
    }
    
    
    
    
    
    
    
    
    
    
    BOOL WINAPI DllMain(HINSTANCE mod, DWORD Attached, LPVOID res)
    {
    
    
        switch (Attached)
        {
        case DLL_PROCESS_ATTACH:
            MessageBoxA(0, "Loaded!", "Info", 0);
            CreateThread(0, 0, &HackThread, 0, 0, 0);
            break;
        case DLL_PROCESS_DETACH:
            MessageBoxA(0, "Not Loaded", "Info", 0);
            break;
        }
    
    
    
    
        return TRUE;
    }

  2. #2
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    You need to revisit what a pointer is. Adding multiple values to an offset does not dereference the value stored.

    DWORD ammoAddress = *PDWORD( basePointer ) + 0x150;

  3. The Following User Says Thank You to Hitokiri~ For This Useful Post:

    D@nny (08-23-2016)

  4. #3
    Threadstarter
    New Member
    D@nny's Avatar
    Join Date
    Jul 2016
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    Thanks I will

  5. #4
    xjay_cc's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    Do not create a thread in DllMain . if u want create a thread .Use SetWindowLong or SetWindowsHookEx to hook the windowproc , then you can post a message to do it.
    And you do not need for(;; ) to catch the keyboard message , do it on your windowproc function.
    Last edited by xjay_cc; 09-16-2016 at 04:40 AM.

  6. #5
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by xjay_cc View Post
    Do not create a thread in DllMain . if u want create a thread .Use SetWindowLong or SetWindowsHookEx to hook the windowproc , then you can post a message to do it.
    And you do not need for(;; ) to catch the keyboard message , do it on your windowproc function.
    Creating a thread in DllMain via CreateThread is just fine.

  7. #6
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    Quote Originally Posted by xjay_cc View Post
    Do not create a thread in DllMain
    And why not? Will something bad like deadlocks happen? ( Nope. )

  8. #7
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Best practice is to not do anything in DllMain, because libraries may be loaded as dependency for other libraries, or it might be loaded just for a single function call, so anything automatically happening upon loading is not something that is wanted.

    However, since this is for gamehacking it doesn't matter, noone will ever be using your dll without intending for it to start up shit when it gets loaded(and the game itself won't be calling them functions for you)

    ~ Hell_Demon
    Ah we-a blaze the fyah, make it bun dem!

  9. #8
    xjay_cc's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by Hell_Demon View Post
    Best practice is to not do anything in DllMain, because libraries may be loaded as dependency for other libraries, or it might be loaded just for a single function call, so anything automatically happening upon loading is not something that is wanted.

    However, since this is for gamehacking it doesn't matter, noone will ever be using your dll without intending for it to start up shit when it gets loaded(and the game itself won't be calling them functions for you)

    ~ Hell_Demon
    yeah .i agree about that

  10. #9
    __readgsqword's Avatar
    Join Date
    Mar 2016
    Gender
    female
    Posts
    39
    Reputation
    10
    Thanks
    13
    Quote Originally Posted by Hell_Demon View Post
    Best practice is to not do anything in DllMain, because libraries may be loaded as dependency for other libraries, or it might be loaded just for a single function call, so anything automatically happening upon loading is not something that is wanted.

    However, since this is for gamehacking it doesn't matter, noone will ever be using your dll without intending for it to start up shit when it gets loaded(and the game itself won't be calling them functions for you)

    ~ Hell_Demon
    You know ahead of time which libraries will be loaded and which libraries you need loaded. It's already been pointing out that you do not cause a dead lock simply by creating a thread in the main, which is perfectly fine. Yes it's unorthodox to do it this way, where as libraries are merely meant to export functions for the main module but this is "hacking" after-all and we can not be completely orthodox.

  11. #10
    homevcc's Avatar
    Join Date
    Oct 2016
    Gender
    male
    Location
    Skype: homevcc@gmail.com
    Posts
    12
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    since this is for gamehacking it doesn't matter, noone will ever be using your dll without intending for it to start up shit when it gets loaded(and the game itself won't be calling them functions for you)

Similar Threads

  1. [Help Request] DLL Hack Not Working On Different Computer
    By stfnz in forum C++/C Programming
    Replies: 2
    Last Post: 05-13-2012, 11:30 AM
  2. [Solved] sxs.dll hacks not working.......
    By *HACKER* in forum CrossFire Help
    Replies: 2
    Last Post: 12-02-2011, 05:07 AM
  3. [Solved] Dll hacks not working?
    By bug_NOT_ME in forum CrossFire Help
    Replies: 7
    Last Post: 10-12-2011, 01:54 PM
  4. [Help Request] Egypt.dll hack not working for me
    By abdoabdo123 in forum CrossFire Help
    Replies: 36
    Last Post: 06-02-2011, 06:04 PM
  5. WireFrame hack DLL/Tut. Not Detected As of 5/11/09
    By acolem in forum Soldier Front Hacks
    Replies: 11
    Last Post: 05-24-2009, 04:35 PM