develooper Front page | perl.perl5.porters | Postings from July 2003

Re: [PATCH] Extend Win32::GetOSVersion() to return additional inf ormation

From:
Jan Dubois
Date:
July 30, 2003 09:18
Subject:
Re: [PATCH] Extend Win32::GetOSVersion() to return additional inf ormation
Message ID:
cbrfivgi4dseono01c08jqati25nugf64d@4ax.com
On Wed, 30 Jul 2003 15:51:01 +0100, "Orton, Yves" <yves.orton@de.mci.com> wrote:


>Also while you are on the subject GetOSName needs to be updated in Win32.pm,
>which I can do if you like.

I already did this, but didn't submit to p5p because it is part of libwin32.
Whenever Sarathy makes a new libwin32 release (probably when we make another
ActivePerl release) this will be included.

I've attached the trivial patch below.  I removed the links to MSDN as they
are broken once again.  It just doesn't seem to be possible to get long-living
links to that information; just use Google to search for OSVERSIONINFOEX with
a site:microsoft.com qualifier.

>Incidentally the whole idea of GetOSName is to provide a central and
>consistant way to be able to resolve the various
>version numbers from GetOSVersion() down to the "normal" concept of OS
>version. The handling of the different values isnt exactly straight forward
>and requires information not published in one location by MS.

Only the legacy stuff is non-intuitive.  Everything released after Windows NT 4
seems to be numbered sensibly.  Well, except for the RC1 of Windows .NET Server.

>If it gets moved to core by the way, will it still be possible to install it
>independently?

Just like any other core module, I would think.  It will need some special code
in the libwin32 MakeMaker.PL to make sure it still gets installed into older
versions of Perl.

Cheers,
-Jan

Change 72367 by jand@jand-tofino on 2003/07/29 17:46:54

libwin32: Add Win2003 support to Win32::GetOSName.  I decided to
          *not* change the value returned for Windows XP
          ("WinXP/.Net") to avoid breaking existing code.
          http://bugs.activestate.com/show_bug.cgi?id=26302

Affected files ...

... src/Modules/libwin32/Win32.pm#25 edit

Differences ...

==== src/Modules/libwin32/Win32.pm#25 (text) ====
Index: src/Modules/libwin32/Win32.pm
--- src/Modules/libwin32/Win32.pm.~1~	Tue Jul 29 17:50:00 2003
+++ src/Modules/libwin32/Win32.pm	Tue Jul 29 17:50:00 2003
@@ -186,16 +186,11 @@
         ($desc, $major, $minor, $build, $id) = Win32::GetOSVersion();
 
         # If id==0 then its a win32s box -- Meaning Win3.11
-        #  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_49iw.asp
         unless($id) {
             $os = 'Win32s';
         }
 	else {
 	    # Magic numbers from MSDN documentation of OSVERSIONINFO
-	    # Here is some mickeysoft code that tells the story as well:
-	    # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_92jy.asp
-	    # Caution with the above code as it uses functions unavailable
-	    # to us in Perl.
 	    # Most version names can be parsed from just the id and minor
 	    # version
 	    $os = {
@@ -207,6 +202,7 @@
 		2 => {
 		    0  => "2000",
 		    1  => "XP/.Net",
+                    2  => "2003",
 		    51 => "NT3.51"
 		}
 	    }->{$id}->{$minor};
End of Patch.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About