locked
Adress explain RRS feed

  • Question

  • public static Process myExample = Process.GetProcessesByName("MyGame")[0]; public static uint Mana = 0x7ABFE0 - 0x400000 + baseAdress; public static uint XOR = 0x7ABF8C - 0x400000 + baseAdress; public static uint GetMana() { return Convert.ToUInt32(ReadInt32(myExample, .Mana) ^ ReadInt32(myExample, XOR)); }

           public static int ReadInt32(Process proc, uint Address)
           {
               IntPtr ptrBytesRead;
               byte[] buffer = new byte[4];
               APIs.ReadProcessMemory(proc.Handle, new IntPtr(Address), buffer, 4, out ptrBytesRead);
               return BitConverter.ToInt32(buffer, 0);
           }

    Can someone explain me, what this code is doing? I do not have any knowledge on this


    If you get your question answered, please come back and Alternate TextMark As Answer.
    Web Developer


    • Edited by Norkk Monday, April 15, 2013 6:48 PM
    Monday, April 15, 2013 6:47 PM

Answers

  • It is a bitwise XOR operation. See operators reference here: http://msdn.microsoft.com/en-us/library/6a71f45d(v=VS.80).aspx

    • Proposed as answer by Jason Dot Wang Wednesday, April 17, 2013 2:52 AM
    • Marked as answer by Norkk Friday, April 19, 2013 1:54 PM
    Monday, April 15, 2013 8:04 PM
  • APIs isn't part of the .Net Framework so we can only guess what's going on inside there but it looks like the code is attempting to read the value of the Mana variable derictly from the memory space of the "MyGame" process.
    • Marked as answer by Norkk Friday, April 19, 2013 1:54 PM
    Monday, April 15, 2013 7:31 PM

All replies

  • APIs isn't part of the .Net Framework so we can only guess what's going on inside there but it looks like the code is attempting to read the value of the Mana variable derictly from the memory space of the "MyGame" process.
    • Marked as answer by Norkk Friday, April 19, 2013 1:54 PM
    Monday, April 15, 2013 7:31 PM
  • APIs isn't part of the .Net Framework so we can only guess what's going on inside there but it looks like the code is attempting to read the value of the Mana variable derictly from the memory space of the "MyGame" process.

    Hmm, and whats this specific part is doing?

    return Convert.ToUInt32(ReadInt32(myExample, .Mana) ^ ReadInt32(myExample, XOR));

    It's the first time that i see  ^  between values, so i really don't know what operation is happening.


    If you get your question answered, please come back and Alternate TextMark As Answer.
    Web Developer

    Monday, April 15, 2013 7:35 PM
  • It is a bitwise XOR operation. See operators reference here: http://msdn.microsoft.com/en-us/library/6a71f45d(v=VS.80).aspx

    • Proposed as answer by Jason Dot Wang Wednesday, April 17, 2013 2:52 AM
    • Marked as answer by Norkk Friday, April 19, 2013 1:54 PM
    Monday, April 15, 2013 8:04 PM