Solved RPM 64 Bit - Trouble Returning Value

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

dexmox

Newbie
Nov 19, 2013
2
354
0
Hi Everyone,

This is my first time here :)

Game in mention is R6:S
My OS: Win 10 Pro x64
IDE: MSVS2015

I have some excerpts of code below, truncated to be shorter, this code works for 32Bit games, its not for 64 bit games.
The offsets are valid and work with game restart / reboot (They are pointed at primary ammo in clip)

As its 64Bit its 8 Bytes not 4 Bytes, I have read along my way ReadProcessMemory is for 32 Bit processes

If thats true why is there a flag for lpNumberOfBytes ?
8 Byte : ReadProcessMemory(pHandle, (LPCVOID)Address, &Address, 8, NULL);
4 Byte : ReadProcessMemory(pHandle, (LPCVOID)Address, &Address, 4, NULL);

Is anyone able to point me in the right direction a tutorial, code, snippet or if willing point out what i am doing wrong.
Any and all help is appreciated.


C++:
moduleBaseAddress = 0x1F1E0000;

ReadProcessMemory(hProcess, (LPVOID)(moduleBaseAddress + 0x2AB8410), &offset1, sizeof(offset1), 0);
cout << "Offset 1: " << offset1 << endl;

ReadProcessMemory(hProcess, (LPVOID)(offset1 + 0x750), &offset2, sizeof(offset2), 0);
cout << "Offset 02: " << offset2 << endl;

ReadProcessMemory(hProcess, (LPVOID)(offset2 + 0x288), &offset3, sizeof(offset3), 0);
cout << "Offset 03" << offset3 << endl;

ReadProcessMemory(hProcess, (LPVOID)(offset3 + 0xc0), &offset4, sizeof(offset4), 0);
cout << "Offset 04 " << offset4 << endl;

ReadProcessMemory(hProcess, (LPVOID)(offset4 + 0x480), &offset5, sizeof(offset5), 0);
cout << "Offset 05" << offset5 << endl;

ReadProcessMemory(hProcess, (LPVOID)(offset5 + 0xfc), &offset6, sizeof(offset6), 0);
cout << "Offset 06" << offset6 << endl;
Output:
C++:
Game Window Handle: 0000000000030482
Process Id: 7156
Base Address[RainbowSix.exe]: 0x1F1E0000
------------------
Offset 01: 0
Offset 02: 0
Offset 03: 0
Offset 04: 0
Offset 05: 0
Offset 06: 0
------------------
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,298
37,938
269
print the error value of readprocessmemory ( GetLastError() ) to find out what the issue is.
 

dexmox

Newbie
Nov 19, 2013
2
354
0
Cause:
The cause was the moduleBaseAddress returned was the wrong type and gave incorrect address.
I was returning the HMODULE of the BaseAddress as a DWORD64 type.

Solution:
Returning base address as a DWORD_PTR

Additional Notes:

Assuming the first element of the array is what you want
C++:
moduleBaseAddress = (DWORD_PTR)modArray[0];
DWORD_PTR
An unsigned long type for pointer precision. Use when casting a pointer to a long type to perform pointer arithmetic. (Also commonly used for general 32-bit parameters that have been extended to 64 bits in 64-bit Windows.)

DWORD64
A 64-bit unsigned integer.
 
Last edited:
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods