| View previous topic :: View next topic |
| Author |
Message |
kennny2004 Advanced Cheater
Reputation: 0
Joined: 22 Jan 2006 Posts: 59 Location: Canada
|
Posted: Fri May 11, 2007 11:31 am Post subject: ReadProcessMemmory Newb :) |
|
|
ok well i learned C++ like a year ago and now i would like to make something simple for example i want to start of just outputting the score in pinball. In my first attempt i made a pointer and assigned the address to it and that came up with an error and i could not find anything that would fix that. So i tried a different approach which was the ReadProcessMemory(
the problem i got with it is HANDLE hProcess i got no idea how i can find the hProcess so if someone could help me find a way i can do that. Thank you
So right now i got something like
ReadProcessMemory(
whatGOEShere?, // handle to the process which you want to patch
(void*)0x01005194, // offset to the function you want to read
(int*)p, // pointer to get the function offset e.g. origin function
4, // size to read most of the time this is 4 or 6 the sizeof(DWORD)
0 ); // number bytes read not really needed // Read it, "assign the address of x to p"
_________________
Hey was up! lol, simple heh |
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Fri May 11, 2007 11:36 am Post subject: |
|
|
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pID);
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri May 11, 2007 12:48 pm Post subject: |
|
|
you should only ask for PROCESS_VM_READ permission, if you ask for all access
1) you might be denied because thats suspicious
2) security risk
p.s if you find yourself using lots of typecasts you're probably doing something wrong
|
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Fri May 11, 2007 12:55 pm Post subject: |
|
|
Yeah I realised about the security issue there while I was posting it but was too lazy to change it.
_________________
|
|
| Back to top |
|
 |
kennny2004 Advanced Cheater
Reputation: 0
Joined: 22 Jan 2006 Posts: 59 Location: Canada
|
Posted: Fri May 11, 2007 9:58 pm Post subject: |
|
|
I am sorry just because i am not to good at c++ and i want to see how much i need to learn
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pID);
does not tell me to much for example Pid i am taking a guess i would need to find that but where is that at, looked it up and it says dwProcessId which still does not help me much.
and PROCESS_VM_READ does that mean i should use
HANDLE hProcess = OpenProcess(PROCESS_VM_READ,FALSE,pID);
It might help if you just let me know what this whole things is called and ill look up some tutorial.
Thank you
_________________
Hey was up! lol, simple heh |
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sat May 12, 2007 9:52 am Post subject: |
|
|
I'm not sure what you are trying to do, but I guess your trying to get the PID? If yes then look at this:
| Code: | unsigned long PID; //<= pid buffer
HANDLE hProcess;
HWND hWindow = FindWindow(NULL, " Your window name");
CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);
GetWindowThreadProcessId(hWindow, &PID);
hProcess = OpenProcess(PROCESS_VM_READ, TRUE, PID); |
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat May 12, 2007 10:13 am Post subject: |
|
|
| That's not a good way to get the PID, because you'll always need a window. instead use EnumProcesses to get your PID by processname.
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sat May 12, 2007 10:17 am Post subject: |
|
|
Yes but if hes trying to get pinball pid, Pinball has a window. But yes your right. (Never heard of this way of gettin it)
_________________
|
|
| Back to top |
|
 |
|