Reputation: 425
from ReadWriteMemory import ReadWriteMemory
rwm = ReadWriteMemory()
process = rwm.get_process_by_name('AoE2DE_s.exe')
process.open()
villagerPointer = process.get_pointer('AoE2DE_s.exe+2BFCA10', offsets=[0x18, 0x4*0x2+0x9228])
villagerCount = process.read(villagerPointer)
print (villagerCount)
Always returning 0 but should be returning 119. Used cheat engine to find the pointer and offsets, but can't replicate it in Python. Super frustrated, I couldn't get anything to work.
Upvotes: 2
Views: 1941
Reputation: 6857
You're passing the string value 'AoE2DE_s.exe+2BFCA10'
to get_pointer()
, but that's apparently not a valid input, according to the source code of the library you're using. You have to actually pass the hex value of that address. So, I'd get the base address of the .exe first, then add that hex value, but again, you ultimately have to pass only a hex address to read()
or get_pointer()
.
The reason you aren't getting any errors is just because that library isn't doing much input validation; hence the "garbage in, garbage out" concept applies.
Edit: According to the source code of that library, there's seemingly no way to get the base address of a process.
However you can get the base address by bypassing the library and doing it yourself via this method. Then, once you have the hex value of the base address, you can then simply add an offset to it, then use RWM's read()
or get_pointer()
.
Upvotes: 1