Mon Nov 25 12:38:31 2013: Request 90807 was acted upon.
Transaction: Ticket created by thoke
       Queue: Win32
     Subject: Win32::GetOSVersion() broken in Windows 8.1 and Windows Server
 2012 R2
   Broken in: 0.48
    Severity: (no value)
       Owner: Nobody
  Requestors: th...@northpeak.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=90807 >


>From Microsoft:  In Windows 8.1, the GetVersion(Ex) APIs have been deprecated. 
>That means that while you can still call the APIs, if your app does not 
>specifically target Windows 8.1, you will get Windows 8 versioning (6.2.0.0).

Here are just a few resources:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074(v=vs.85).aspx

This can be seen in practice on  Windows Server 2012 R2 with Win32 vs 
Win32::OLE as follows:

---
use Win32;
use Win32::OLE;

my ( $desc, $major, $minor, $build, $id, undef, undef, $suitemask,
    $producttype ) = Win32::GetOSVersion();

printf "%20s: %10s\n", "Win32 Version", "$major.$minor.$build";

my $wmi = Win32::OLE->GetObject( "WinMgmts://./root/cimv2" ) or die "Failed 
GetObject: $!\n";
my $list = $wmi->InstancesOf( "Win32_OperatingSystem" ) or die "Failed 
InstancesOf: $!\n";

for my $item ( Win32::OLE::in $list ) { 
    printf "%20s: %10s\n", "Win32::OLE Version", $item->{Version};
}
---
          Win32 Version:   6.2.9200
  Win32::OLE Version:   6.3.9600

Reply via email to