The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Win32::Process::CommandLine - Perl extension for getting win32 process command line parameters

SYNOPSIS

  use Win32::Process::CommandLine;
  Win32::Process::CommandLine::GetPidCommandLine($pid, $str);

DESCRIPTION

In windows, there is no existing tool for finding out the process's parameters. From task manager, only process names are displayed. So starting a program with different parameters several times, it's hard to tell a process with what options.

Win32::Process::CommandLine takes process id($pid) as input, the program name and command line parameters will be returned in $str. This module supports multi-byte languages.

METHODS

Win32::Process::CommandLine::GetPidCommandLine($pid, $str)

Get process's command line string

    Args:

        $pid            Process ID
        $str            program name and command line parameters

Returns length of $str on success, 0 on failure.

EXPORT

None by default.

SUMMARY

This is a good example for who wants to write perl extensions in C. See README in details. The C program covers concepts and usages of Unicode, WCHAR, WideCharToMultiByte, CreateFile, WriteFile, dynamic loading dll, etc...

If compiling the module with _DEBUG, it will print more information - open Makefile.PL, put _DEBUG in DEFINE.

If you don't have compiler, look for pv.exe and write some code to wrap it. pv.exe -l -i pid

AUTHOR

Jing Kang <kxj@hotmail.com>