What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Retrieving a process handle

[?] Retrieving a process handle
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. [?] Retrieving a process handle
Hi,

I'm looking for a way to retrieve a process handle to feed into WriteProcessMemory. I do not want to retrieve the Messenger process (which can be done by GetCurrentProcess).

Does anyone know how-to?
02-21-2009 06:11 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Retrieving a process handle
What handle are you trying to retrieve?
02-21-2009 06:56 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Retrieving a process handle
The hProcess parameter to pass to WriteProcessMemory.
02-21-2009 06:59 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Retrieving a process handle
But are you trying to write to the Messenger process? If so GetCurrentProcess will work.
02-22-2009 03:53 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Retrieving a process handle
As I said in the first post, I'm not trying to retrieve the Messenger process handle.

BTW, I know the window title, (and by using FindWindow(Ex) I can get the window handle) and the EXE name.
02-22-2009 05:14 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: [?] Retrieving a process handle
If you know the window handle, then GetWindowThreadProcessId (returning a process id) and OpenProcess (returning a process handle from process id) should help.

However I don't know if you can write to arbitrary process's memory space :S...(I don't think you can :P)

This post was edited on 02-22-2009 at 05:31 PM by Mnjul.
02-22-2009 05:31 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Retrieving a process handle
Well, it appears to work, except for the writing part. Access denied :S
02-23-2009 09:16 AM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: [?] Retrieving a process handle
quote:
Originally posted by SmokingCookie
Well, it appears to work, except for the writing part. Access denied :S
er, is your process higher than the one you're writing to?

with winamp i do
GetWindowThreadProcessId
then
OpenProcess with the PROCESS_ALL_ACCESS flag
then you should be able to call
VirtualAllocEx (if you want to allocate memory within its space)
then
WriteProcessMemory
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-23-2009 10:41 AM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Retrieving a process handle
I can't seem to find PROCESS_ALL_ACCESS. I tried PROCESS_VM_WRITE instead. Still I receive the message "access denied".

Unless PROCESS_ALL_ACCESS is all these flags together (e.g. "FLAG1 | FLAG2" etc.), it's nowhere to be found.


Thanks mate :)

This post was edited on 02-23-2009 at 03:41 PM by SmokingCookie.
02-23-2009 03:33 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On