moduleName+offset?

Posts 1–4 of 4 · Page 1 of 1
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
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.
-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
Thanks for y'alls input.

I was able to get the program to work with the help of this thread
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us