win32::pipe with vista x64

Posted by azdul on 2009-03-28 11:30

I used this script to extract data for some years on Win32 systems. Now I have a new Vista x64 system and after installing activeperl 5.10 (32bit and 64bit tested) the script doesn't work properly.
I don't have so much knowledge about perl to find the error on my own so it would be nice if someone here have some suggestions.

UAC is off. And cmd.exe has all needed rights.

use Win32::Pipe;

$VERSION= 1.64;
$sol="\% ";
$baseline[0] = 0;
$destpath = "C:\\Temp";
$logfile = $destpath . "\\WinPipe.log";
$pipename = "\\\\.\\pipe\\wperl.exe";
$buffersize = 16 * 1024 * 1024; # 16 MByte
$relax = 0;
$average = 1;

# some symbols:
$aqmSSFR= 0;
$aqmSSFB= 1;
$aqmDSFR= 2;
$aqmDSFB= 3;

#$pipename = sprintf ("\\\\.\\pipe\\%s", ($^X));

open( LOGFILE, "> $logfile") || die( "Cannot open $logfile !");
printf LOGFILE ("$0, using pipe: \"%s\"", ( $pipename ) );

$Pipe = new Win32::Pipe( $pipename, $NMPWAIT_WAIT_FOREVER ) || die "Can't Connect to the named pipe\n";

if ( $Pipe->Connect() == 0) {
print LOGFILE ", connected";
} else {
print LOGFILE ", not connected\n";
exit 1;
}

if ( $Pipe->ResizeBuffer( $buffersize ) == $buffersize ) {
print LOGFILE " and buffer resized\n";
} else {
print LOGFILE " but buffer resizing failed\n";
exit 1;
}

$c= 0;
while ( $c < @ARGV ) {
@b= split( /=/,$ARGV[$c] );

printf LOGFILE ("parameter[%d] = \"%s\" = \"%s\"\n",
( $c, $b[0], $b[1] ) );

if ( $b[0] eq "destpath" ) {
$destpath = $b[1];
printf LOGFILE ("destpath: %s\n", ($destpath));
}

if ( $b[0] eq "sol" ) {
$sol = $b[1];
printf LOGFILE ("sol: %s\n", ($sol));
}

if ( $b[0] eq "relax" ) {
$relax = $b[1];
if ( $relax == 1 ) {
printf LOGFILE ("relax: all spectra will be relaxed to last buffer\n");
} else {
printf LOGFILE ("relax: all spectra will be relaxed to average of the %d last buffers\n",($relax));
}
}

if ( $b[0] eq "average" ) {
$average = $b[1];
printf LOGFILE ("average: %d spectra\n", ( $average ) );
}

if ( $b[0] eq "baseline" ) {
@baseline = split( /-/,$b[1] );
printf LOGFILE ("baseline: %d - %d wavenumbers\n",
($baseline[0],$baseline[1]));
}
$c++;
}

$entry= 1;
$Data= &send_command("READ_FROM_ENTRY $entry");

...