Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ReadProcessMemmory Newb :)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kennny2004
Advanced Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 59
Location: Canada

PostPosted: Fri May 11, 2007 11:31 am    Post subject: ReadProcessMemmory Newb :) Reply with quote

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
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Fri May 11, 2007 11:36 am    Post subject: Reply with quote

HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pID);
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri May 11, 2007 12:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Fri May 11, 2007 12:55 pm    Post subject: Reply with quote

Yeah I realised about the security issue there while I was posting it but was too lazy to change it. Cool
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
kennny2004
Advanced Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 59
Location: Canada

PostPosted: Fri May 11, 2007 9:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat May 12, 2007 9:52 am    Post subject: Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat May 12, 2007 10:13 am    Post subject: Reply with quote

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
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat May 12, 2007 10:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites