From: Steve Hay Date: Fri, 21 Sep 2007 07:39:02 +0000 (+0000) Subject: Upgrade to Win32-0.32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=166cd87e025da3b73833dbe6f3ac8a9279710d12;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Win32-0.32 p4raw-id: //depot/perl@31935 --- diff --git a/ext/Win32/Win32.pm b/ext/Win32/Win32.pm index be3fd98..acdd4fd 100644 --- a/ext/Win32/Win32.pm +++ b/ext/Win32/Win32.pm @@ -8,7 +8,7 @@ BEGIN { require DynaLoader; @ISA = qw|Exporter DynaLoader|; - $VERSION = '0.31_01'; + $VERSION = '0.32'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -310,9 +310,10 @@ a name that can be passed to system calls and external programs. =item Win32::DomainName() -[CORE] Returns the name of the Microsoft Network domain that the -owner of the current perl process is logged into. This function does -B work on Windows 9x. +[CORE] Returns the name of the Microsoft Network domain or workgroup +that the owner of the current perl process is logged into. The +"Workstation" service must be running to determine this +information. This function does B work on Windows 9x. =item Win32::ExpandEnvironmentStrings(STRING) diff --git a/ext/Win32/Win32.xs b/ext/Win32/Win32.xs index 6587cf2..9d0142d 100644 --- a/ext/Win32/Win32.xs +++ b/ext/Win32/Win32.xs @@ -1178,8 +1178,10 @@ XS(w32_DomainName) DWORD wki100_ver_major; DWORD wki100_ver_minor; } *pwi; + DWORD retval; + retval = pfnNetWkstaGetInfo(NULL, 100, &pwi); /* NERR_Success *is* 0*/ - if (0 == pfnNetWkstaGetInfo(NULL, 100, &pwi)) { + if (retval == 0) { if (pwi->wki100_langroup && *(pwi->wki100_langroup)) { WideCharToMultiByte(CP_ACP, 0, pwi->wki100_langroup, -1, (LPSTR)dname, dnamelen, NULL, NULL); @@ -1193,6 +1195,7 @@ XS(w32_DomainName) XSRETURN_PV(dname); } FreeLibrary(module); + SetLastError(retval); } else { /* Win95 doesn't have NetWksta*(), so do it the old way */ diff --git a/ext/Win32/t/GetFileVersion.t b/ext/Win32/t/GetFileVersion.t index 0129ce1..b9e51f8 100644 --- a/ext/Win32/t/GetFileVersion.t +++ b/ext/Win32/t/GetFileVersion.t @@ -12,5 +12,7 @@ plan tests => 2; my @version = Win32::GetFileVersion($^X); my $version = $version[0] + $version[1] / 1000 + $version[2] / 1000000; -ok($version, $]); +# numify $] because it is a version object in 5.10 which will stringify with trailing 0s +ok($version, 0+$]); + ok($version[3], int(Win32::BuildNumber())); diff --git a/ext/Win32/t/Names.t b/ext/Win32/t/Names.t index 414c479..bfe8797 100644 --- a/ext/Win32/t/Names.t +++ b/ext/Win32/t/Names.t @@ -15,8 +15,11 @@ plan tests => $tests; # test Win32::DomainName() if (Win32::IsWinNT()) { my $domain = eval { Win32::DomainName() }; - is( $@, '', "Win32::DomainName()" ); - like( $domain, '/^[a-zA-Z0-9!@#$%^&()_\'{}.~-]+$/', " - checking returned domain" ); + SKIP: { + skip 'The Workstation service has not been started', 2 if $^E == 2138; + is( $@, '', "Win32::DomainName()" ); + like( $domain, '/^[a-zA-Z0-9!@#$%^&()_\'{}.~-]+$/', " - checking returned domain" ); + } } # test Win32::GetArchName() @@ -38,9 +41,9 @@ cmp_ok( length($osname), '>', 3, " - checking returned OS name" ); # - list context my ($osname2, $desc) = eval { Win32::GetOSName() }; is( $@, '', "Win32::GetOSName() in list context" ); -cmp_ok( length($osname), '>', 3, " - checking returned OS name" ); -cmp_ok( length($desc ), '>', 3, " - checking returned description" ); -is( $osname2, $osname, " - checking that OS name is the same in both calls" ); +cmp_ok( length($osname2), '>', 3, " - checking returned OS name" ); +ok( defined($desc), " - checking returned description" ); +is( $osname2, $osname, " - checking that OS name is the same in both calls" ); # test Win32::LoginName() my $login = eval { Win32::LoginName() };