Jump to content

Use a handle to get username?


Recommended Posts

How can I get the owner of a process when all I have is a handle from WinGetHandle()? Most everything I've seen has been trying to from PIDs to handles. I'm guessing that this needs to go in the opposite direction, and then take the PID and find the user... But I'm not sure how to do it. 

Link to comment
Share on other sites

Hi,

Here you go:

#include <Array.au3>
#include <WinAPIEx.au3>

Run("notepad.exe")

Local $iPID = 0
Do
    $iPID = WinGetProcess("[CLASS:Notepad]")
Until $iPID > 0

Local $aUser = _WinAPI_GetProcessUser($iPID)
_ArrayDisplay($aUser)
Note: This is an example, you only need the WinGetProcess, _WinAPI_GetProcessUser functions ;)

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...