[C++ DLL] ReadProcessMemory

03/11/2013 22:24 Kingrap#1
OK I HAVE SOLVED, THANK TO ALL :D
03/11/2013 22:45 snow#2
Well, I guess your DLL is injected into the target process? Then you don't need to get a handle for the process or use OpenProcess.

One way would be memcpy(address, value, sizeof(value)), another way:

DWORD *ptr = 0x004DE898;
DWORD *secondptr = *ptr + 20; /* sure that it's 20 or is it 0x20? */
value = *secondptr;

Don't know which way is better. ¯\_(ツ)_/¯
03/11/2013 23:33 Kingrap#3
Quote:
Originally Posted by snow911 View Post
Well, I guess your DLL is injected into the target process? Then you don't need to get a handle for the process or use OpenProcess.

One way would be memcpy(address, value, sizeof(value)), another way:

DWORD *ptr = 0x004DE898;
DWORD *secondptr = *ptr + 20; /* sure that it's 20 or is it 0x20? */
value = *secondptr;

Don't know which way is better. ¯\_(ツ)_/¯
yes 0x20

This is correct?

Code:
private: System::Void button17_Click(System::Object^  sender, System::EventArgs^  e) {

			 HANDLE phandle; 
                         DWORD *ptr = 0x004DE898;
                         DWORD *s_ptr = *ptr + 0x20;
                         int value = *s_ptr;

				ReadProcessMemory(phandle, (LPVOID)value, &value, 4, 0);

				label14->Text = System::Convert::ToString(value);
			 }

			 
		 }
03/11/2013 23:44 snow#4
I'm sorry, but I'm not sure if I understand exactly what you want:
What do you mean with DLL? Do you want to write a DLL that gets injected into a process? If yes: The way I showed above should work.

If not: This is, as far as I know, some Microsoft-Styled C++, right? If that's within your application and you want to read the value of another process, you'll have to use that ReadProcessMemory Function.
Don't forget that you'll have to add the base module address to your Pointer, you can either add it as a constant value which should be 0x40000 in most cases or you can get the address dynamically via GetModuleHandle("NAMEOFYOURGAME")
03/12/2013 09:12 Mi4uric3#5
Quote:
Originally Posted by Kingrap View Post
yes 0x20
Well then you need to write 0x20, not 20 if it is 0x20.

Quote:
Originally Posted by Kingrap View Post
ReadProcessMemory(phandle, (LPVOID)(value+0x20), &value, 4, 0);
But first of all. Like snow911 already said. Do you inject your dll into the game-process which contains the code you posted above, or is this an external hack which uses Read- / WriteProcessMemory()?
03/12/2013 15:58 Kingrap#6
Ehm, i inject DLL in game process, i need read from memory the value of pointer ( 0x004DE898 + 0x20 )
03/12/2013 16:11 phize#7
Quote:
Originally Posted by Kingrap View Post
Ehm, i inject DLL in game process, i need read from memory the value of pointer ( 0x004DE898 + 0x20 )
You need to go back to reading programming books and get a clue before attempting to make hacks.
03/12/2013 16:39 Kingrap#8
OK I HAVE SOLVED, THANK TO ALL :D
03/15/2013 12:13 Mi4uric3#9
Quote:
Originally Posted by Kingrap View Post
Ehm, i inject DLL in game process, i need read from memory the value of pointer ( 0x004DE898 + 0x20 )
Why would you use ReadProcessMemory to read in the own addressspace [IMG]http://www.*************.me/forum/images/smilies/jackie.gif[/IMG]

PHP Code:
DWORD value = *(DWORD*)(*(DWORD*)0x4DE898 0x20); 
would do the job