Results 1 to 11 of 11
  1. #1
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored

    How to use Pointer + Offset in C#?

    Question in title ^_^

  2. #2
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    If your C# stuff is injected, use the Marshal class, such as:
    var basePtr = new IntPtr(0x12345678);
    var ptrVal = Marshal.ReadIntPtr(basePointer);
    Marshal.WriteByte(new IntPtr(ptrVal.ToInt32() + 0x123), 0x90);
    If you are externally reading/writing, then use ReadProcessMemory / WriteProcessMemory.
    pinvoke.net: readprocessmemory (kernel32)
    pinvoke.net: writeprocessmemory (kernel32)

    Read the pointer, convert it to an Int32 using BitConverter, then add the offset, read again etc. for each offset.
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  3. #3
    Threadstarter
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    Quote Originally Posted by atom0s View Post
    If your C# stuff is injected, use the Marshal class, such as:


    If you are externally reading/writing, then use ReadProcessMemory / WriteProcessMemory.
    pinvoke.net: readprocessmemory (kernel32)
    pinvoke.net: writeprocessmemory (kernel32)

    Read the pointer, convert it to an Int32 using BitConverter, then add the offset, read again etc. for each offset.
    Thanks this will help




    But how I can do this?

    So?

    ReadProcessMemory(bla, bla, bla);
    ...
    // Add ofsset
    WriteProcessMemory(bla, bla, bla);

    how to add it(offset)?

    Oh you mean so

    // Read pointer
    return (IntPtr)(BitConverter.ToInt32(memory, 0) + Offset);
    Last edited by _PuRe.LucK*; 06-15-2013 at 07:17 AM.

  4. #4
    rabir007's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Behind you...
    Posts
    2,323
    Reputation
    148
    Thanks
    1,925
    My Mood
    Bored
    Quote Originally Posted by Nik0815 View Post
    Thanks this will help




    But how I can do this?

    So?

    ReadProcessMemory(bla, bla, bla);
    ...
    // Add ofsset
    WriteProcessMemory(bla, bla, bla);

    how to add it(offset)?

    Oh you mean so

    // Read pointer
    return (IntPtr)(BitConverter.ToInt32(memory, 0) + Offset);

    As i see you are using External editing...
    So:
    Pointer + Offset looks like:
    Code:
    IntPtr Pointer = 0xEACBD
    int Offset = 0x555
    IntPtr PointTo = ReadMem(Pointer)
    WriteMem(
    Code:
    PointTo + Offset, 999)
    Edit: ^ Vbulletion auto-correction fuck up the post -_-
    Last edited by rabir007; 06-15-2013 at 02:11 PM.







  5. #5
    Threadstarter
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    Quote Originally Posted by rabir007 View Post



    As i see you are using External editing...
    So:
    Pointer + Offset looks like:
    Code:
    IntPtr Pointer = 0xEACBD
    int Offset = 0x555
    IntPtr PointTo = ReadMem(Pointer)
    WriteMem(
    Code:
    PointTo + Offset, 999)
    Edit: ^ Vbulletion auto-correction fuck up the post -_-

    Thanks you

    And with more Offsets?
    Last edited by _PuRe.LucK*; 06-15-2013 at 03:29 PM.

  6. #6
    Artak's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    new york
    Posts
    893
    Reputation
    35
    Thanks
    94
    OM me i ll help u

  7. #7
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    Quote Originally Posted by Nik0815 View Post
    Thanks this will help

    But how I can do this?

    So?

    ReadProcessMemory(bla, bla, bla);
    ...
    // Add ofsset
    WriteProcessMemory(bla, bla, bla);

    how to add it(offset)?

    Oh you mean so

    // Read pointer
    return (IntPtr)(BitConverter.ToInt32(memory, 0) + Offset);

    You'd loop each offset and keep reading the pointers. Heres some pseudo code on what you'd do:
    Code:
    var baseAddress     = new IntPtr(0x12345678);
    var offsetList      = new int[] { 0x12, 0x22, 0x033, 0x44, 0x55, 0x67 };
    var buffer          = new byte[4];
    var lpOutStorage    = IntPtr.Zero;
    
    // Read the base pointer..
    ReadProcessMemory( process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage );
    
    // Loop each offset and read the pointers..
    for (int x = 0; x < offsetList.Length - 1; x++)
    {
        baseAddress = BitConverter.ToInt32(buffer, 0) + offsetList[x];
        ReadProcessMemory( process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage );
    }
    
    // Read the last pointer+offset as the main value..
    var valueBuffer = new byte[255];
    baseAddress = BitConverter.ToInt32(btBuffer, 0) + offsetList[offsetList.Length - 1];
    ReadProcessMemory( process.Handle, baseAddress, valueBuffer, (uint)valueBuffer.Length, ref lpOutStorage );
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  8. #8
    Threadstarter
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    Quote Originally Posted by atom0s View Post
    You'd loop each offset and keep reading the pointers. Heres some pseudo code on what you'd do:
    Code:
    var baseAddress     = new IntPtr(0x12345678);
    var offsetList      = new int[] { 0x12, 0x22, 0x033, 0x44, 0x55, 0x67 };
    var buffer          = new byte[4];
    var lpOutStorage    = IntPtr.Zero;
    
    // Read the base pointer..
    ReadProcessMemory( process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage );
    
    // Loop each offset and read the pointers..
    for (int x = 0; x < offsetList.Length - 1; x++)
    {
        baseAddress = BitConverter.ToInt32(buffer, 0) + offsetList[x];
        ReadProcessMemory( process.Handle, baseAddress, buffer, (uint)buffer.Length, ref lpOutStorage );
    }
    
    // Read the last pointer+offset as the main value..
    var valueBuffer = new byte[255];
    baseAddress = BitConverter.ToInt32(btBuffer, 0) + offsetList[offsetList.Length - 1];
    ReadProcessMemory( process.Handle, baseAddress, valueBuffer, (uint)valueBuffer.Length, ref lpOutStorage );
    Works this without marshall class like Rabirs method

  9. #9
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    Marshal is only for if your dll is injected. It allows you to directly access the memory without needing 'unsafe' code.
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  10. #10
    rabir007's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Behind you...
    Posts
    2,323
    Reputation
    148
    Thanks
    1,925
    My Mood
    Bored
    Quote Originally Posted by Nik0815 View Post
    Works this without marshall class like Rabirs method
    With more offset:
    Pointer1 = Ptr + Offset1;
    Pointer2 = Pointer1 + Offset2;
    Pointer3 = Pointer2 + Offset3;
    Money = Pointer3 + MoneyOffset;

    Etc...
    You can use loops, it makes things easier...
    Good luck...







  11. The Following User Says Thank You to rabir007 For This Useful Post:

    _PuRe.LucK* (06-16-2013)

  12. #11
    Threadstarter
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,650
    My Mood
    Bored
    Quote Originally Posted by rabir007 View Post


    With more offset:
    Pointer1 = Ptr + Offset1;
    Pointer2 = Pointer1 + Offset2;
    Pointer3 = Pointer2 + Offset3;
    Money = Pointer3 + MoneyOffset;

    Etc...
    You can use loops, it makes things easier...
    Good luck...
    Ah okay thank you

Similar Threads

  1. [Request] How TO Find THis Offset Using OllyDbg!
    By Jhem in forum Piercing Blow Hack Coding/Source Code
    Replies: 6
    Last Post: 07-23-2013, 10:14 PM
  2. [Help Request] How to use OllyDGB to find offsets
    By super*eagle in forum Crossfire Coding Help & Discussion
    Replies: 1
    Last Post: 02-22-2013, 12:07 PM
  3. How to use pointer from CheatEngine in C#
    By pakistanihaider in forum Call of Duty Modern Warfare 3 Coding, Programming & Source Code
    Replies: 24
    Last Post: 08-06-2012, 02:15 PM
  4. [Release] How to use GameStatus Pointer!
    By seeplusplus in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 14
    Last Post: 11-27-2010, 04:17 PM
  5. Replies: 5
    Last Post: 07-22-2009, 04:26 PM