This is a piece one of my programs.
I wrote it to perform a software inventory.
Piece below runs a Windows function GetComputerNameA using Win32::API
module.
Make sure you have Win32::API  module downloaded on your machine (see
ActivePerl Documentation came with ActivePerl).

use Win32API::Registry;
use Win32::TieRegistry;
use Win32::API;

print "Getting computer name...\n";

$GetComputerName = new Win32::API("kernel32", "GetComputerNameA", [P, P],
N);
$lpBuffer = " " x 16;

$N=pack ("c4", 16,0,0,0);

$return = $GetComputerName->Call($lpBuffer,$N);

$TempPath = $lpBuffer;
$TempPath = substr($TempPath,0,ord $N);

print  "Name is '$TempPath'\n";

print "Getting software ...\n";
...............
...............

----- Original Message -----
From: "Jenda Krynicky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 30, 2000 6:10 PM
Subject: Re: Getting Workstation Name


> > I'm wanting to trap the name of the workstation that hit my web page so
> > that I know who made a change.  I can get the IP address by using the
> > $ENV{REMOTE_ADDR} environment variable, but with DHCP a user's IP
> > address could change.  Is there a way using Perl to get that?
>
> Well, the name could be in $ENV{REMOTE_HOST}, but it's not
> guarantied. If you do not find it there you will have to do a reverse
> DNS lookup for the address in $ENV{REMOTE_ADDR}. (use Net::DNS :)
>
> Jenda
>
>
> == [EMAIL PROTECTED] == http://Jenda.McCann.cz ==
>             FUCK THE ARMY!
>                        Myself
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
>

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to