Originally Posted by
CaET
"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..