View previous topic :: View next topic |
Author |
Message |
Winter_Snake How do I cheat? Reputation: 0
Joined: 22 Jul 2019 Posts: 8
|
Posted: Fri Jul 26, 2019 4:55 pm Post subject: Cheat Engine Base Module Address |
|
|
I've noticed two inconsistencies between my C++ doe and cheat engine.
To start with, I am working on OpenRA - Red Alert. At this moment, cycling through the modules either doesn't return the right address or doesn't find the module at all.
1) Not returning the right base module address --
Using Cheat Engine, getAddress('RedAlert.exe') show's the address at [0x00DD0000] However, my code returns [0x0083000].
Code: |
uintptr_t ProcMem::GetModuleStartAddress(const char* module_name)
{
uintptr_t address = 0;
HANDLE snapshot_handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, this->processID);
if (snapshot_handle != INVALID_HANDLE_VALUE)
{
MODULEENTRY32 module_entry;
module_entry.dwSize = sizeof(module_entry);
if (Module32First(snapshot_handle, &module_entry))
{
do
{
if (!_stricmp(module_entry.szModule, module_name))
{
address = (uintptr_t)module_entry.modBaseAddr;
break;
}
} while (Module32Next(snapshot_handle, &module_entry));
}
}
CloseHandle(snapshot_handle);
return address;
} |
(And here's how I am calling it)
Code: |
uintptr_t raCashMEM = raMEM.GetModuleStartAddress("RedAlert.exe");
std::cout << (void*)raCashMEM << std::endl; |
2) Module doesn't exist at all.
Another base module found in the game is a module "soft_oal.dll", however, std::cout'ing the failed modules that don't match (using the previous code) shows no mention of a soft_oal.dll existing/being found. Therefore the function returns a 0. The dll exists for sure, I can see it in the bin of the game.
Code: | uintptr_t raCashMEM = raMEM.GetModuleStartAddress("soft_oal.dll"); |
Any help with these two issues would be great.
Description: |
|
Filesize: |
19.62 KB |
Viewed: |
6429 Time(s) |
|
Description: |
|
Filesize: |
23.63 KB |
Viewed: |
6430 Time(s) |
|
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Sat Jul 27, 2019 12:09 am Post subject: |
|
|
Your app is printing the local address of the variable holding the value due to how you are printing it.
Try this instead:
Code: | printf_s("%08X\r\n", raCashMEM); |
_________________
- Retired. |
|
Back to top |
|
|
Winter_Snake How do I cheat? Reputation: 0
Joined: 22 Jul 2019 Posts: 8
|
Posted: Sat Jul 27, 2019 9:51 am Post subject: |
|
|
That still results in the wrong address.
Cheat Engine shows [0x002f0000] where as the print statement returns [0x00390000]
EDIT:
Quickly tested it, both my std::cout and your printf_s resulted in the same address being printed.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Sat Jul 27, 2019 7:56 pm Post subject: |
|
|
Assuming the target is 32bit, you should only need to use: 'TH32CS_SNAPMODULE' with CreateToolhelp32Snapshot.
Next, make sure your application is compiled as 32bit and not 64bit.
_________________
- Retired. |
|
Back to top |
|
|
|