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.
--- 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);