Skip Menu |

This queue is for tickets about the Win32-IPHelper CPAN distribution.

Report information
The Basics
Id: 59790
Status: patched
Priority: 0/
Queue: Win32-IPHelper

People
Owner: Nobody in particular
Requestors: temp1002 [...] debusschere.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: A few functions are not valid in a Perl64 environment.
Functions such as GetNetworkParams(),GetAdaptersInfo() fail in a Perl64 environment. The windows 'C' structures have pointers which change the size and slack bytes get introduced. I have updated the pm file to accommodate both Perl32 and Perl64. It works for at least the two f()s above in the Perl64 environment. I haven't back tested it in Perl32. Can I just attach the file or do I have to attach a patch file ? Mark D.
From: lwsitu [...] yahoo.com
Here is my patch in case anyone else runs into this problem. I ended up here from trying to use Net::DNS in 64bit Strawberry 5.12.1.
Subject: Win32_IPHelper_64bit.diff
--- IPHelper.pm.1 2008-07-23 19:35:36.000000000 -0400 +++ IPHelper.pm 2011-02-09 22:05:58.000000000 -0500 @@ -9,6 +9,7 @@ use Win32; use Win32::API; use enum; +use Config (); require Exporter; @@ -60,6 +61,7 @@ my $GetExtendedTcpTable = new Win32::API ('Iphlpapi', 'GetExtendedTcpTable', ['P', 'P', 'N', 'N', 'N', 'N'], 'N'); my $GetExtendedUdpTable = new Win32::API ('Iphlpapi', 'GetExtendedUdpTable', ['P', 'P', 'N', 'N', 'N', 'N'], 'N'); +my $PTR_SIZE = $Config::Config{ptrsize}; # Preloaded methods go here. @@ -1451,12 +1453,12 @@ sub _IP_ADAPTER_INFO { my ($buffer, $pos) = @_; - my $size = 640; + my $size = $PTR_SIZE + 636; my %hash; my @array; my $next; - ($pos, $next) =_shiftunpack($buffer, $pos, 4, "P".$size); + ($pos, $next) =_shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); ($pos, $hash{'ComboIndex'}) = _shiftunpack($buffer, $pos, 4, "L"); ($pos, $hash{'AdapterName'}) = _shiftunpack($buffer, $pos, (MAX_ADAPTER_NAME_LENGTH + 4), "Z" . (MAX_ADAPTER_NAME_LENGTH + 4)); @@ -1499,6 +1501,29 @@ } ####################################################################### +# _ADDR_STRING_STRUCT_SIZE +# +# Constant for the size of a IP_ADDR_STRING/PIP_ADDR_STRING struct. +# This varies depending on whether it is running in 32bit or 64bit perl +# +####################################################################### +# Usage: +# $size = _ADDR_STRING_STRUCT_SIZE; +# +# Output: +# $size - size of the structs +# +# Input: +# None +####################################################################### +sub _ADDR_STRING_STRUCT_SIZE() { + return $PTR_SIZE # struct * + + 16 # char[16] + + 16 # char[16] + + 4; # DWORD +} + +####################################################################### # _IP_ADDR_STRING() # # Decodes an _IP_ADDR_STRING data structure and returns data @@ -1533,12 +1558,12 @@ sub _IP_ADDR_STRING { my ($buffer, $pos) = @_; - my $size = 40; + my $size = _ADDR_STRING_STRUCT_SIZE; my %hash; my @array; my $next; - ($pos, $next) = _shiftunpack($buffer, $pos, 4, "P".$size); + ($pos, $next) = _shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); ($pos, $hash{'IpAddress'}) = _shiftunpack($buffer, $pos, 16, "Z16"); ($pos, $hash{'IpMask'}) = _shiftunpack($buffer, $pos, 16, "Z16"); @@ -1695,7 +1720,8 @@ ($pos, $hash{'DomainName'}) = _shiftunpack($buffer, $pos, MAX_DOMAIN_NAME_LEN + 4, "Z".(MAX_DOMAIN_NAME_LEN + 4)); my $CurrentDnsServer; - ($pos, $CurrentDnsServer) = _shiftunpack($buffer, $pos, 4, "P40"); + my $size = _ADDR_STRING_STRUCT_SIZE; + ($pos, $CurrentDnsServer) = _shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); if ($CurrentDnsServer) { @{ $hash{'CurrentDnsServer'} } = _IP_ADDR_STRING(\$CurrentDnsServer, 0);
Subject: Win32_IPHelper_64bit_fixed_CR-LF.diff Re: A few functions are not valid in a Perl64 environment.
From: vvm [...] tut.by
On Wed Feb 09 22:15:59 2011, lwsitu [ . . . ] yahoo.com wrote: Show quoted text
> Here is my patch in case anyone else runs into this problem. >I ended up here from trying to use Net::DNS in 64bit Strawberry 5.12.1.
Youre patch: --- IPHelper.pm.1 2008-07-23 19:35:36.000000000 -0400 +++ IPHelper.pm 2011-02-09 22:05:58.000000000 -0500 work and work very fine: For error-free operation of the module Net-Dns in Perl64 on Windows x64 You need to fix the module Win32-IPHelper using patch Win32_IPHelper_64bit.diff http://vvm.blog.tut.by/2011/05/25/for-ok-net-dns-in-perl64-on-windows- x64-need-to-fix-win32-iphelper-using-patch-win32_iphelper_64bit-diff/ Full enviroment: Mini How-To: practical method to install ASSP v2.X on Windows x64 using Strawberry Perl v5.12.X x64 http://vvm.blog.tut.by/2011/05/18/mini-how-to-practically-method-to- install-assp-v2-x-on-windows-x64-by-strawberry-perl-v5-12-2-x64/ But file https://rt.cpan.org/Ticket/Attachment/895196/464097/Win32_IPHelper_64bit .diff need be fixed as descrited here: HowTo fix: Halt with patch.c Line 354 if file has CRs and CR-LFs need convert the line endings to CR-LF http://vvm.blog.tut.by/2011/05/25/howto-fix-halt-with-patch-c-line-354- if-file-has-crs-and-cr-lfs-need-convert-the-line-endings-to-cr-lf/
Subject: Win32_IPHelper_64bit_fixed_CR-LF.diff
--- IPHelper.pm.1 2008-07-23 19:35:36.000000000 -0400 +++ IPHelper.pm 2011-02-09 22:05:58.000000000 -0500 @@ -9,6 +9,7 @@ use Win32; use Win32::API; use enum; +use Config (); require Exporter; @@ -60,6 +61,7 @@ my $GetExtendedTcpTable = new Win32::API ('Iphlpapi', 'GetExtendedTcpTable', ['P', 'P', 'N', 'N', 'N', 'N'], 'N'); my $GetExtendedUdpTable = new Win32::API ('Iphlpapi', 'GetExtendedUdpTable', ['P', 'P', 'N', 'N', 'N', 'N'], 'N'); +my $PTR_SIZE = $Config::Config{ptrsize}; # Preloaded methods go here. @@ -1451,12 +1453,12 @@ sub _IP_ADAPTER_INFO { my ($buffer, $pos) = @_; - my $size = 640; + my $size = $PTR_SIZE + 636; my %hash; my @array; my $next; - ($pos, $next) =_shiftunpack($buffer, $pos, 4, "P".$size); + ($pos, $next) =_shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); ($pos, $hash{'ComboIndex'}) = _shiftunpack($buffer, $pos, 4, "L"); ($pos, $hash{'AdapterName'}) = _shiftunpack($buffer, $pos, (MAX_ADAPTER_NAME_LENGTH + 4), "Z" . (MAX_ADAPTER_NAME_LENGTH + 4)); @@ -1499,6 +1501,29 @@ } ####################################################################### +# _ADDR_STRING_STRUCT_SIZE +# +# Constant for the size of a IP_ADDR_STRING/PIP_ADDR_STRING struct. +# This varies depending on whether it is running in 32bit or 64bit perl +# +####################################################################### +# Usage: +# $size = _ADDR_STRING_STRUCT_SIZE; +# +# Output: +# $size - size of the structs +# +# Input: +# None +####################################################################### +sub _ADDR_STRING_STRUCT_SIZE() { + return $PTR_SIZE # struct * + + 16 # char[16] + + 16 # char[16] + + 4; # DWORD +} + +####################################################################### # _IP_ADDR_STRING() # # Decodes an _IP_ADDR_STRING data structure and returns data @@ -1533,12 +1558,12 @@ sub _IP_ADDR_STRING { my ($buffer, $pos) = @_; - my $size = 40; + my $size = _ADDR_STRING_STRUCT_SIZE; my %hash; my @array; my $next; - ($pos, $next) = _shiftunpack($buffer, $pos, 4, "P".$size); + ($pos, $next) = _shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); ($pos, $hash{'IpAddress'}) = _shiftunpack($buffer, $pos, 16, "Z16"); ($pos, $hash{'IpMask'}) = _shiftunpack($buffer, $pos, 16, "Z16"); @@ -1695,7 +1720,8 @@ ($pos, $hash{'DomainName'}) = _shiftunpack($buffer, $pos, MAX_DOMAIN_NAME_LEN + 4, "Z".(MAX_DOMAIN_NAME_LEN + 4)); my $CurrentDnsServer; - ($pos, $CurrentDnsServer) = _shiftunpack($buffer, $pos, 4, "P40"); + my $size = _ADDR_STRING_STRUCT_SIZE; + ($pos, $CurrentDnsServer) = _shiftunpack($buffer, $pos, $PTR_SIZE, "P".$size); if ($CurrentDnsServer) { @{ $hash{'CurrentDnsServer'} } = _IP_ADDR_STRING(\$CurrentDnsServer, 0);
Hi LMASARA, Would it be okay if I add the patched IPHelper.pm to Net::DNS?
On Wed Oct 05 10:28:05 2011, WILLEM wrote: Show quoted text
> Hi LMASARA, > > Would it be okay if I add the patched IPHelper.pm to Net::DNS?
I uploaded a 0.07 version that includes the requested patch. Thanks. Luigino.