The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::Process::User - Perl extension for to get the user and domain name of a process

SYNOPSIS

  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";
  }

DESCRIPTION

Win32::Process::User is a module to get the the user and domain name of a running process.

FUNCTIONS

new()

The constructor. There are no parameters.

GetByPid()

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.

GetByName()

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.

GetError()

returns the error string on if one of the both functions are faild.

EXPORT

None by default.

AUTHOR

Reinhard Pagitsch, <rpirpag@gmx.at<gt>

SEE ALSO

perl and Win32::Process::List.