Results 1 to 3 of 3
  1. #1
    CaET's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    71
    Reputation
    10
    Thanks
    697

    Cool [C++] Get address value as Array of Bytes





    Hi, i'm using this code to read a process memory address:

    Code:
    DWORD address 0xPSEUDUMADDY;
    int myint;
    ReadProcessMemory(pHandle, (LPVOID)address, &myint, sizeof(myint), 0);

    I need to change it from (example) "F3 0F 7E 41" to "F3 0F 7E 45", how do i get the value of address in Array of Bytes in c++?

  2. #2
    Ren4rd's Avatar
    Join Date
    Feb 2018
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    4
    Quote Originally Posted by CaET View Post
    "F3 0F 7E 41" to "F3 0F 7E 45"
    if you just need to change 4th byte you don't need to read/write array of bytes, just add offset of 3 to your address:
    Code:
    DWORD address 0x...;
    BYTE buf = 0x45;
    WriteProcessMemory(pHandle, (LPVOID)(address + 3), (LPCVOID)&buf, sizeof(buf), 0);
    if it is just a bad example (so you really need write array of bytes), then you could do it like this
    Code:
    DWORD address 0x...;
    BYTE buf[] = { 0xF3, 0x0F, 0x7E, 0x45 };
    WriteProcessMemory(pHandle, (LPVOID)address, (LPCVOID)buf, sizeof(buf), 0);
    and for read:
    Code:
    DWORD address 0x...;
    BYTE buf[4];
    ReadProcessMemory(pHandle, (LPVOID)address, (LPCVOID)buf, sizeof(buf), 0);
    btw, if you need just 4 bytes you still can use unsigned int (DWORD) because it can contain 4 bytes, for example (for write F3 0F 7E 45 to ur address):
    Code:
    DWORD address 0x...;
    DWORD buf = 0x457E0FF3;
    WriteProcessMemory(pHandle, (LPVOID)address, (LPCVOID)&buf, sizeof(buf), 0);
    (you need to use it in reversed order, because int uses little-endian bytes order)

    not sure, did I answer ur question, whatever..
    Last edited by Ren4rd; 02-11-2018 at 08:31 PM. Reason: .

  3. The Following 2 Users Say Thank You to Ren4rd For This Useful Post:

    CaET (02-12-2018),Hell_Demon (02-12-2018)

  4. #3
    CaET's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    71
    Reputation
    10
    Thanks
    697
    Yeah , that's it. Thank you =)

Similar Threads

  1. [Solved] C# memory - get address of a pointer and set it's value
    By Nicer960 in forum C# Programming
    Replies: 2
    Last Post: 12-07-2016, 09:38 AM
  2. [Help] How to get the value of the address, a pointer is pointing at? [Solved]
    By Arnibold in forum C++/C Programming
    Replies: 12
    Last Post: 09-05-2011, 02:23 AM
  3. Getting address
    By neavea288 in forum MapleStory Hacks, Cheats & Trainers
    Replies: 3
    Last Post: 06-26-2007, 11:49 AM
  4. ADDRESS & VALUE LISTS(put here)
    By jokuvaan11 in forum WarRock - International Hacks
    Replies: 6
    Last Post: 06-09-2007, 05:22 PM
  5. address value pls?
    By jkmacnak in forum WarRock - International Hacks
    Replies: 2
    Last Post: 06-03-2007, 10:17 AM