Win32::Process::User - Perl extension for to get the user and domain name of a process
use Win32::Process::User; my $USER = Win32::Process::User->new(); my %h = $USER->GetByPID($ARGV[0]) if $ARGV[0]; if(!%h) { print "Error: " . $USER->GetError() . "\n"; exit; } foreach (keys %h) { print "$_=" . $h{$_} . "\n"; } %h=$USER->GetByName("hamster.exe"); if(!%h) { print "Error: " . $USER->GetError() . "\n"; exit; } foreach (keys %h) { print "$_=" . $h{$_} . "\n"; }
Win32::Process::User is a module to get the the user and domain name of a running process.
The constructor. There are no parameters.
This function takes the process ID of the process you want to get the domain and user name. It returns a hash on success and undef on failur. Use GetError to get the error message.
This function takes the name of the process e.g. explorer.exe and returns also a hash on success and undef on failur. Use GetError to get the error message. GetByName uses my module Win32::Process::List to translate the process name to the process ID. Therefore Win32::Process::List is a pre requiste to use Win32::Process::User.
returns the error string on if one of the both functions are faild.
None by default.
Reinhard Pagitsch, <rpirpag@gmx.at<gt>
perl and Win32::Process::List.
To install Win32::Process::User, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::Process::User
CPAN shell
perl -MCPAN -e shell install Win32::Process::User
For more information on module installation, please visit the detailed CPAN module installation guide.