NAME
Win32::ToolHelp - Perl extension for obtaining information about currently executing applications (using the ToolHelp API on Win32)
SYNOPSIS
use Win32::ToolHelp;
# --- prints names of all processes
my @ps = Win32::ToolHelp::GetProcesses();
foreach my $p (@ps)
{ print $$p[8], "\n"; }
# --- prints names of the modules used by the current process
my @ms = Win32::ToolHelp::GetProcessModules($$);
foreach my $m (@ms)
{ print $$m[7], "\n"; }
# --- prints name of the current process
my @cp = Win32::ToolHelp::GetProcess($$);
print $cp[8], "\n";
# --- prints full path to the executable of the current process
my @cm = Win32::ToolHelp::GetProcessMainModule($$);
print $cm[8], "\n";
# --- prints full path to the executable of the first running perl
my @pl = Win32::ToolHelp::SearchProcessMainModule("perl.exe");
print $pl[8], "\n";
DESCRIPTION
The Win32::ToolHelp module provides a Perl interface to the ToolHelp API that is present on Windows 95 or higher or Windows 2000 or higher.
The module exposes functionality for obtaining information about currently executing applications (processes and modules used by the processes).
@processes = GetProcesses()
Retrieves list of all processes currently running on the system. The list is returned as an array or array references. See GetProcess
for the description of a nested array (information about a single process).
@modules = GetProcessModules($pid)
Retrieves list of all modules currently loaded and used by the processes identified by the process id (pid) passed into. The list is returned as an array or array references. See GetProcessModule
for the description of a nested array (information about a single module).
($ucnt, $pid, $hid, $mid, $tcnt, $aid, $prio, $flgs, $nam) = GetProcess($pid)
Retrieves information about the process identified by the process id (pid) passed into. The information is returned as an array of these scalars:
- cnt
-
number of references to the process
- pid
-
identifier of the process
- hid
-
identifier of the default heap for the process
- mid
-
module identifier of the process
- tcnt
-
number of execution threads started by the process
- aid
-
identifier of the process that created the process being examined
- prio
-
base priority of any threads created by this process
- flgs
-
reserved; do not use
- nam
-
path and filename of the executable file for the process
The information is the same as in the structure PROCESSENTRY32
filled by the ToolHelp API functions Process32First
and Process32Next
.
($mid, $pid, $gc, $pc, $ad, $sz, $h, $nm, $pt) = GetProcessModule($pid, $mid)
Retrieves information about a module of the process identified by the process id (pid) and the module id (mid) passed into. The information is returned as an array of these scalars:
- mid
-
module identifier in the context of the owning process
- pid
-
identifier of the process being examined
- gc
-
global usage count on the module
- pc
-
module usage count in the context of the owning process
- ad
-
base address of the module in the context of the owning process
- sz
-
size, in bytes, of the module
- h
-
handle to the module in the context of the owning process
- nm
-
string containing the module name
- pt
-
string containing the location (path) of the module
The information is the same as in the structure MODULEENTRY32
filled by the ToolHelp API functions Module32First
and Module32Next
.
($mid, $pid, $gc, $pc, $ad, $sz, $h, $nam, $pth) = GetProcessMainModule($pid)
Retrieves information about the main executable module of the process identified by the process id (pid) passed into. The information is returned as an array of scalars. See GetProcessModule
for the description of the array.
($uct, $pid, $hid, $mid, $tct, $aid, $pri, $fls, $nm) = SearchProcess($pname)
Retrieves information about the process identified by the process executable name (pname) passed into. The information is returned as an array of scalars. See GetProcess
for the description of the array.
($mid, $pid, $gc, $pc, $ad, $sz, $h, $n, $p) = SearchProcessModule($pid, $m)
Retrieves information about a module of the process identified by the process id (pid) and the module name (m) passed into. The information is returned as an array of scalars. See GetProcessModule
for the description of the array.
($mid, $pid, $gc, $pc, $ad, $sz, $h, $nm, $pt) = SearchProcessMainModule($p)
Retrieves information about the main executable module of the process identified by the process executable name (p) passed into. The information is returned as an array of scalars. See GetProcessModule
for the description of the array.
AUTHOR
Ferdinand Prantl <prantl@host.sk>
See http://prantl.host.sk/perl/modules/Win32/ToolHelp for the most recent version.
COPYRIGHT
Copyright (c) 2002, Ferdinand Prantl. All rights reserved.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Author makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
SEE ALSO
Win32::Process and Win32::Job.