Results 1 to 4 of 4
  1. #1
    chochang_262's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0

    moduleName+offset?

    I've got an external trainer I've made with the Help of Fleep and his tutorials. I have found the static address of the value I'm trying to edit using the pointer scanner seeing as whenever I attempt to manually find the pointer, CE comes up with 0 results on the first scan every time. The address I have found however is in module+address form ("client.dll"+00571BBC) I was wondering if there is a way to convert this either in CE or by some code in my program.

    I have been looking up how to do this and have found people saying to use getModuleHandle, however either I am doing something wrong or this is just not what I am looking for.


    Sample of my code for reference
    Code:
    BYTE MoneyValue[]= {0xA3, 0x1c, 0x0, 0x0};
    DWORD MoneyBaseAddress = {0x????????};
    DWORD MoneyOffsets[] = {0xD4, 0x4C};
    Code:
    void WriteToMemory(HANDLE hProcHandle)
    {
    	if(MoneyStatus)
    	{
    		DWORD AddressToWrite = FindDmaAddy(2, hProcHandle, MoneyOffsets, MoneyBaseAddress);
    		WriteProcessMemory(hProcHandle,(BYTE*) AddressToWrite, &MoneyValue, sizeof(MoneyValue),NULL);
    	}
    }

    Or, if someone has any alternative way of writing to the memory that involves using this format, I would be open to learning that way as well.

    Keep in mind I'm still a beginner to C++, however I do grasp what everything in this program does. I've been going through some online classes, and have been looking for a book to buy(Suggestions?).

    If I left something out please tell me and the next time I check, I'll update. thanks in advance for any help

  2. #2
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    GetModuleHandle only works for modules inside the calling process (i.e. you can't use it to get a handle to another process' module).

    You need to either use EnumProcessModules or Module32First + Module32Next to iterate through all modules on the process find the one you want.

    Luckily for you I needed the same thing yesterday, so here's a sample code using Module32First/Next:

    Code:
    #include <tlhelp32.h>
    
    DWORD GetModuleBase( std::string name ) {
        MODULEENTRY32 entry;
        entry.dwSize = sizeof( MODULEENTRY32 );
        HANDLE snapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, _Id );
    
        if( Module32First( snapshot, &entry ) == TRUE ) {
            do {
                if( _stricmp( entry.szModule, name.c_str() ) == 0 ) {
                    CloseHandle( snapshot );
                    return entry.modBaseAddr;
                }
            } while( Module32Next( snapshot, &entry ) );
        }
        return 0;
    }
    You need to replace _Id with the ID of the target process.
    Last edited by MarkHC; 04-13-2015 at 12:27 PM.


    CoD Minion from 09/19/2012 to 01/10/2013

  3. #3
    greyb1t's Avatar
    Join Date
    Apr 2015
    Gender
    male
    Posts
    63
    Reputation
    10
    Thanks
    91
    My Mood
    Bored
    -InSaNe-'s post is great.
    But I suggest not just copy and pasting it into your code, you better study it and understand how it works. You'll learn alot from it.
    Go to MSDN aswell and read about the functions.

    Bai

  4. #4
    chochang_262's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Thanks for y'alls input.

    I was able to get the program to work with the help of this thread

Similar Threads

  1. need help with offset problem
    By qplazm in forum General Game Hacking
    Replies: 1
    Last Post: 12-31-2008, 01:45 PM
  2. offsets
    By silent1990 in forum Combat Arms Hacks & Cheats
    Replies: 0
    Last Post: 12-03-2008, 06:01 AM
  3. CombatArms addys pointers & offsets?
    By nitro107 in forum Combat Arms Hacks & Cheats
    Replies: 4
    Last Post: 08-20-2008, 05:31 AM
  4. Offset addresses
    By thomtim in forum WarRock - International Hacks
    Replies: 0
    Last Post: 07-22-2008, 02:21 AM
  5. Offsets
    By radnomguywfq3 in forum Visual Basic Programming
    Replies: 2
    Last Post: 09-01-2007, 09:50 AM