Am I Doing This Correctly?

Posts 1–5 of 5 · Page 1 of 1
Am I Doing This Correctly?
So, I'm currently learning how to use WriteProcessMemory correctly (used to use mouse_event and keybd_event), however, the explanation on MSDN isn't exactly easy for me to grasp.

For instance, I'm currently trying to make a bunnyhop cheat, and this is how I'm using WPM:
Code:
WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)fProcess.__dwordClient + jump, &jump, 1, NULL);
Any help would be appreciated.

Thanks,
Yiyi.
Code:
WriteProcessMemory(MyHandle, (LPVOID)(MyAddress), &MyBuffer, sizeof(MyBuffer), NULL);
If you do
Code:
(PBYTE*)fProcess.__dwordClient + jump
you will cast fProcess.__dwordClient into a PBYTE*, but completely ignore jump.
Thats why you want to use () around it to cast the whole thing.
Code:
(LPVOID)(MyAddress + SomeOffset)
Quote Originally Posted by WasserEsser View Post
Code:
WriteProcessMemory(MyHandle, (LPVOID)(MyAddress), &MyBuffer, sizeof(MyBuffer), NULL);
If you do
Code:
(PBYTE*)fProcess.__dwordClient + jump
you will cast fProcess.__dwordClient into a PBYTE*, but completely ignore jump.
Thats why you want to use () around it to cast the whole thing.
Code:
(LPVOID)(MyAddress + SomeOffset)
So, I basically would want to do the sizeof() of what I wrote to, along with cast the entire address into LPVOID?
Quote Originally Posted by YiyiCSGO View Post
So, I basically would want to do the sizeof() of what I wrote to, along with cast the entire address into LPVOID?
sizeof(MyBuffer) just makes sure the size you are writing is really the size you want to write. If you know the size of your buffer yourself, you can insert that aswell.
Code:
int iJump = 5;

WriteProcessMemory(fProcess.__HandleProcess, reinterpret_cast<LPVOID>(fProcess.__dwordClient + jump), &iJump, sizeof(iJump), nullptr);
fProcess.__HandleProcess = The handle you have opened to the game.
reinterpret_cast<LPVOID>(fProcess.__dwordClient + jump) = The pointer to the address you want to write.
&iJump = The data you are writing, 5 in this case.
sizeof(iJump) = The size, number of bytes, you are writing.
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us