How to calculate the first 4 bytes of an Address ex: 00F28758

0

I would like to understand how to calculate the 4 Bytes of an address and then use a ReadProcessMemory .

I just wanted to understand how to calculate this because every time I try it goes wrong.

Let's say I have a Address 181BA700 and I need to get the 4 bytes to calculate with an offset. But I do not understand how to do that.

    
asked by anonymous 25.10.2015 / 04:06

1 answer

1

What do you want is something like this?

using System;

public class Test
{
    public static void Main()
    {
        int Address = 0x181BA700;
        int byte1 = Address >> 24;
        int byte2 = (Address >> 16) & 0xFF;
        int byte3 = (Address >> 8) & 0xFF;
        int byte4 = Address & 0xFF;
        Console.WriteLine("A: " + byte1.ToString("X")
            + ", B: " + byte2.ToString("X")
            + ", C: " + byte3.ToString("X")
            + ", D: " + byte4.ToString("X"));
    }
}

Here's the output:

A: 18, B: 1B, C: A7, D: 0

See working on ideone.

    
25.10.2015 / 10:42