How to determine under which user account a process runs
HI,
I enumerated all currently running processes with the psapi functions.
(enumprocesses, openprocess etc.)
I would like to know under which user account (System, userx...) a specific process is running.
I'm really new in microsoft world, so I din't find the right function call....
Best regards
Andre
Re: How to determine under which user account a process runs
Re: How to determine under which user account a process runs
you could access environment variables. under XP (so i think also 2K and NT) the variable is USERNAME.
with the C function getenv you can gain access to the env variables:
Code:
char uid[ 256 ];
strncpy( uid, getenv("USERNAME"), sizeof(uid));
Re: How to determine under which user account a process runs
no because that gives you the username who is logged on to the system, which is not necessarily the user who is running the specified process.
Look at the thread AdaraCD posted because he knows the correct answer.