On Friday, 27 March 2015 at 01:27:25 UTC, Belly wrote:
If anyone reading this can save me some time and help me with
this: How to declare a byte pattern, for example to pass to
WriteProcessMemory?
I guess it's uint[] bytes;
How do I set it to 0x12345678 ?
Since WriteProcessMemory accepts a LPCVOID (that is const void*),
you can use any type of array (provided that you will take care
of endianess):
uint[] ints = [0x12345678];
ushort[] shorts = [0x1234, 0x5678];
ubyte[] bytes = [0x12, 0x34, 0x56, 0x78];
WriteProcessMemory(processHandle, address, ints.ptr, ints.length
* 4 null);
WriteProcessMemory(processHandle, address, shorts.ptr,
shorts.length * 2, null);
WriteProcessMemory(processHandle, address, bytes.ptr,
bytes.length, null);