简体   繁体   中英

Overflow exception when reading data from memory

I'm reading data from the memory using a combination of the process base address + base pointer + offsets. So far, it works as intented for 4 out of 5 cases.

My 5:th try throws the exception below. Is it because of the address argument value?

OverflowExceptption: Arithmetic operation resulted in an overflow

public static int ReadInt(long address)
{
    byte[] buffer = new byte[sizeof(int)];
    ReadProcessMemory(PHandle, (UIntPtr)address, buffer, 
                     (UIntPtr)4, IntPtr.Zero);

    //(UIntPtr)address: -1482250587

    return BitConverter.ToInt32(buffer, 0);
}

This is failing because your value of address is negative.

Which process base address + base pointer + offsets gives this value?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM