Unc3nZureD Posted May 28, 2013 Posted May 28, 2013 How could I check the running privileges of a process? I mean if it's System level, Local service, Network service or simply user-level. Just like in the task manager
Solution kylomas Posted May 28, 2013 Solution Posted May 28, 2013 Unc3nZureD, This is the example from winapiex.au3 for func _WinAPI_GetProcessUser()... #RequireAdmin #Include <APIConstants.au3> #Include <Array.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hToken, $Data, $aAdjust, $aList = 0 ; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes $hToken = _WinAPI_OpenProcessToken(BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY)) _WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust) ; Retrieve user names for all processes the system If Not (@error Or @extended) Then $aList = ProcessList() For $i = 1 To $aList[0][0] $Data = _WinAPI_GetProcessUser($aList[$i][1]) If IsArray($Data) Then $aList[$i][1] = $Data[0] Else $aList[$i][1] = '' EndIf Next EndIf ; Enable SeDebugPrivilege privilege by default _WinAPI_AdjustTokenPrivileges($hToken, $aAdjust, 0, $aAdjust) _WinAPI_CloseHandle($hToken) _ArrayDisplay($aList, '_WinAPI_GetProcessUser') kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now