Writeprocessmemory syntax

Posts 1–12 of 12 · Page 1 of 1
Writeprocessmemory syntax
Ok hello MPGH community i am having some C++ troubs
I am making a stand alone hack (not a dll that needs to be injected) and i have a question that deals with the syntaxing of WriteProcessMemory.
Code:
WriteProcessMemory(ProcessHandle,(LPVOID*)(DWORD)address, &value , MY QUESTION,NULL);
How do i know how many bytes i just wrote? For instance, for an ammo address, (which lets just say is 0x0FAA458B) i write the value 99. What would my bytes be?

Also i have another quick question. Looking at some pointers for Combat Arms, they use something that is cshell.dll+0xHexAddress. Would i use the same kind of method for the address? i am very new to game hacking, so sorry if this is really simple
Quote Originally Posted by djtrickdog View Post
Ok hello MPGH community i am having some C++ troubs
I am making a stand alone hack (not a dll that needs to be injected) and i have a question that deals with the syntaxing of WriteProcessMemory.
Code:
WriteProcessMemory(ProcessHandle,(LPVOID*)(DWORD)address, &value , MY QUESTION,NULL);
How do i know how many bytes i just wrote? For instance, for an ammo address, (which lets just say is 0x0FAA458B) i write the value 99. What would my bytes be?

Also i have another quick question. Looking at some pointers for Combat Arms, they use something that is cshell.dll+0xHexAddress. Would i use the same kind of method for the address? i am very new to game hacking, so sorry if this is really simple
You should use sizeof linkyⓘ
Quote Originally Posted by Xealot View Post
You should use sizeof linky
of so if i just use sizeof(myvaluevariable) it should be found automaticly? Sweet. And what if my hex address is something like 0x0f0f0f (6 hex digits long) or 0x0f0f0f0f (8 long) does this matter about anything?
No it doesn't matter, just do sizeof(int) or sizeof( long ) where int and long are your variable types
I think it has something to do with the HANDLE being passed into WriteProcessMemory.

Try modifying this function first from:

Code:
void GetProcess(LPSTR windowname)
to

Code:
HANDLE GetProcess( LPSTR windowname )
{
// Keep everything as it is but at the end :

return processHandle;
}
Then in the function:

Code:
void ModifyAddr(int address, int value)

//  change it to 

void ModifyAddr( HANDLE handle, int address, int value )
{
WriteProcessMemory(handle,(LPVOID*)address, &value , sizeof(value) ,NULL);
}
Then when using these two modified functions you can:

Code:
HANDLE handle = GetProcess(....);

ModifyAddr( handle, ...... );
Let me know if that works. Fingers crossed :P
ill try it thanks
Here is after fixing with your edits, my code looks like:
C++ pastebin - collaborative debugging tool

ok i get errors:
Code:
 C:Dev-Cpptester.cpp In function `void* GetProcess(CHAR*)': 
21 C:Dev-Cpptester.cpp `ProcessHandle' undeclared (first use this function) 
  (Each undeclared identifier is reported only once for each function it appears in.) 
 C:Dev-CppMakefile.win [Build Error]  [venom.o] Error 1
change ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);

into

HANDLE ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);

and change vid GetProcess(..)

into

HANDLE GetProcess(...)

The first error is because you are going to return a handle so the return TYPE is HANDLE. The second error was you weren't declaring ProcessHandle as a HANDLE it was just nothing.
vid GetProcess(..) ? if you mean void Getprocess, i dont have that anywhere in my code
cool it works! Thanks alot! You have msn or aim?
I have msn but I'm not on it a lot, if ya want you can PM on here
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us