AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GetCommandLine
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu Nov 20, 2008 12:44 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message Send e-mail
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Nov 21, 2008 1:13 am    Post subject: Re: GetCommandLine Reply with quote

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 ?
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Nov 21, 2008 10:11 am    Post subject: Re: GetCommandLine Reply with quote

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)
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Nov 21, 2008 10:30 am    Post subject: Reply with quote

Thank you Sean. Very Happy

BTW, is following correct:

Code:
 If ! ( NumGet(bi,4) & 0x43a )
    MsgBox, hProcess does not have enough rights
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Nov 21, 2008 11:36 am    Post subject: Reply with quote

SKAN wrote:
BTW, is following correct:

It Should be:
Code:
If   NumGet(bi,4) & 0x43A <> 0x43A
   MsgBox, hProcess does not have enough rights
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Nov 21, 2008 5:21 pm    Post subject: Reply with quote

Thank you Sean. Smile
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group