[Request] WriteProcessMemory Example

Posts 1–6 of 6 · Page 1 of 1
[Request] WriteProcessMemory Example
I've been learning C++ for about a week now.. (I've also made the switch and am now using DevC++)

Thank's to a Friend who gave me a bit of help, I now know how to get a ProcessID and use HWND correctly to detect when a window is open (Yay?)

Well.. I'm having trouble with Writing memory, and pointers.

could someone give me tips/examples on how to do these two things? I know that pointers can be found via Cheat Engine. But i have no idea how.

I'm completely lost when it comes to WriteProcessMemory. I'm trying to make a simple hack (my first) that will change the score in pinball (windows XP).

Could anyone help? give me some examples or something if you can, or write a tutorial if you can?

Thanks in advance,

Psycho.
Quote Originally Posted by PlSlYlClHlO View Post
I've been learning C++ for about a week now.. (I've also made the switch and am now using DevC++)

Thank's to a Friend who gave me a bit of help, I now know how to get a ProcessID and use HWND correctly to detect when a window is open (Yay?)

Well.. I'm having trouble with Writing memory, and pointers.

could someone give me tips/examples on how to do these two things? I know that pointers can be found via Cheat Engine. But i have no idea how.

I'm completely lost when it comes to WriteProcessMemory. I'm trying to make a simple hack (my first) that will change the score in pinball (windows XP).

Could anyone help? give me some examples or something if you can, or write a tutorial if you can?

Thanks in advance,

Psycho.
I'm not going to write an article on how a computer manages memory, or how APIs work in windows, so if you don't understand what I'm saying you have a bit more research to do before doing this.

First of all, most windows APIs are documented, and are stored in the MSDN Library. Usage of the APIs is defined there. I will explain how to the required parameters.

WriteProcessMemory(
-Handle to destination virtual address space - Can be acquired via OpenProcess(possibly other APIs if you can locate them via the MSDN Library. ) usage of OpenProcess is defined in the MSDN Library.
-address - Address to write to.
-buffer - Pointer to a buffer. A buffer can be an array of bytes, or a single integer value. It can be anything you put in it.
-size- size of buffer. Use sizeof to acquire the size.
-Bytes Written - Pointer to an unsigned long that will hold(after the function call) the number of bytes that've been written to the address. Set to null if you don't want to make use of this
);

Example :
int* iMyVar;
WriteProcessMemory(procHandle, (LPVOID*)0x123456, &iMyVar, sizeof(iMyVar), 0);
Thanks for your quick reply

this helps, but i'm still sort of confused. is "0x123456" the address i would use to write? i see the 0xAddressHere in tutorials all the time, but it doesn't explain it very well. What does the 0x do/mean?
Quote Originally Posted by PlSlYlClHlO View Post
Thanks for your quick reply

this helps, but i'm still sort of confused. is "0x123456" the address i would use to write? i see the 0xAddressHere in tutorials all the time, but it doesn't explain it very well. What does the 0x do/mean?
0x is the prefix of a hexadecimal value.
You could have always pressed 'search' and found my WriteProcessMemory example, or even looked at my GameHacking101 tutorial for a ready-to-compile, with Dev-C++, example. It's good you're taking it slow, by the way, and trying to make sure you understand it, it's what seperates potential hackers from wannabes. So, if you trace your score decreasing, to the last address, beings that game doesn't use DMA, you could just write the score you want to it but, write in hex i.e. if you want 10 score, write 0A to it. If you use Cheat Engine and right click on the address and select 'view what writes here,' you'll probably find the actual in-game function for handling score, instead of just the address it's using to store score temporarily. You can then use a Debugger, like OllyDBG, to learn more. Good luck...
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us