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

Asked

Viewed 48 times

0

I wish I could figure out how to calculate the 4 bytes of a address and then use a ReadProcessMemory.

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

Let’s say I have one Address 181BA700 and I need to take the 4 bytes to calculate with an offset. But I don’t understand how to do this.

1 answer

1


What 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 way out:

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

See it working on ideone.

  • vlw.. That’s just what we needed..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.