AutoHotkey Community

It is currently May 26th, 2012, 1:14 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 20th, 2008, 1:44 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Thanks for the idea. I require to deal only with user-AHK-process.
Meanwhile, I have updated my post with SetDebugPrivilege(). Please have a look.

Thanks for all the help. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: GetCommandLine
PostPosted: November 21st, 2008, 2:13 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Sean wrote:
Code:
hProc := DllCall("OpenProcess", "Uint", 0x043A, "int", 0, "Uint", pid)



Desired Access 0x43a :
PROCESS_QUERY_INFORMATION=0x400 + PROCESS_CREATE_THREAD=0x2 + PROCESS_VM_READ=0x10 + PROCESS_VM_OPERATION=0x8 + PROCESS_VM_WRITE=0x20

Since I want to call GetCommandLine() from a loop, I might want to pass the hProc instead of PID to this function.

Is there a way to ascertain whether the hProc has enough rights ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: GetCommandLine
PostPosted: November 21st, 2008, 11:11 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
SKAN wrote:
Is there a way to ascertain whether the hProc has enough rights ?

I don't know if there is any other API in the standard dlls, but NtQueryObject is the one. It used to be classified as undocumented one, but seems (partially) documented now:
http://msdn.microsoft.com/en-us/library/bb432383.aspx

Code:
VarSetCapacity(bi,56,0)
DllCall("ntdll\NtQueryObject", "Uint", hProc, "Uint", 0, "Uint", &bi, "Uint", 56, "Uint", 0)
MsgBox % NumGet(bi,4)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2008, 11:30 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Thank you Sean. :D

BTW, is following correct:

Code:
 If ! ( NumGet(bi,4) & 0x43a )
    MsgBox, hProcess does not have enough rights


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2008, 12:36 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
SKAN wrote:
BTW, is following correct:

It Should be:
Code:
If   NumGet(bi,4) & 0x43A <> 0x43A
   MsgBox, hProcess does not have enough rights


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2008, 6:21 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Thank you Sean. :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: IsNull, Yahoo [Bot] and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group