From: Jan Dubois Date: Mon, 22 Aug 2005 15:37:09 +0000 (-0700) Subject: Add Windows Vista support to Win32::GetOSName() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b76aa5af2840585626e18c84f60feb97c68abd14;p=p5sagit%2Fp5-mst-13.2.git Add Windows Vista support to Win32::GetOSName() From: "Jan Dubois" Message-Id: <200508222237.j7MMbFPA027764@smtp3.ActiveState.com> p4raw-id: //depot/perl@25321 --- diff --git a/win32/ext/Win32/Win32.pm b/win32/ext/Win32/Win32.pm index 3844c63..af3f2fe 100644 --- a/win32/ext/Win32/Win32.pm +++ b/win32/ext/Win32/Win32.pm @@ -195,9 +195,9 @@ sub GetOSName { 90 => "Me" }, 2 => { - 0 => "2000", + 0 => "NT4", 1 => "XP/.Net", - 2 => "2003", + 2 => "2003", 51 => "NT3.51" } }->{$id}->{$minor}; @@ -212,9 +212,9 @@ sub GetOSName { my $tag = ""; - # But distinguising W2k from NT4 requires looking at the major version - if ($os eq "2000" && $major != 5) { - $os = "NT4"; + # But distinguising W2k and Vista from NT4 requires looking at the major version + if ($os eq "NT4") { + $os = {5 => "2000", 6 => "Vista"}->{$major} || "NT4"; } # For the rest we take a look at the build numbers and try to deduce @@ -483,6 +483,7 @@ Currently known values for ID MAJOR and MINOR are as follows: Windows 2000 2 5 0 Windows XP 2 5 1 Windows Server 2003 2 5 2 + Windows Vista 2 6 0 On Windows NT 4 SP6 and later this function returns the following additional values: SPMAJOR, SPMINOR, SUITEMASK, PRODUCTTYPE.