Hey guys I want to get some memory from a process that I already know with CheatEngine. I defined a region that I want to scan (0x190D186FF->0x190D1870A) but the address is too big to be stored in a simple int. That's why I use an __int64 but with that modification ReadProcessMemory doesn't seems to handle the address anymore.
When I compile I got 3 warnings for VirtualProtectEx and ReadProcessMemory: cast to pointer from integer of different size
How can I read really big address from the memory ?
int main( int argc, char *argv[] ) {
HWND hWnd;
DWORD PID;
HANDLE hProc;
__int64 address;
char mem = 0;
PDWORD oldProtect = 0;
int valid = 0;
char inputPID[4];
printf( "What is the program PID ?\n" );
fgets( inputPID, sizeof( inputPID ), stdin );
PID = (DWORD)atoi( inputPID );
hProc = OpenProcess( PROCESS_VM_READ, false, PID );
if ( !hProc ) {
printf( "Error: Couldn't open process '%i'\n", PID );
return 0;
}
for ( address = 0x190D186FF; address <= 0x190D1870A; address++ ) {
VirtualProtectEx( hProc, (PVOID)address, (SIZE_T)sizeof( address ), PAGE_READONLY, oldProtect );
valid = ReadProcessMemory( hProc, (PCVOID)address, &mem, (DWORD)sizeof( char ), NULL );
if ( valid ) {
printf( "Memory value at 0x%I64x: '%c'\n", address, mem );
}
VirtualProtectEx( hProc, (PVOID)address, (SIZE_T)sizeof( address ), (DWORD)oldProtect, NULL );
}
system( "pause" );
}