To whomever knows the answer:

I have been using the Win32::GetOSVersion() function for many years in 
order to pull the Windows OS level.  However, I now have a new need to 
determine whether or not the OS is Windows Vista Home Basic (or for that 
matter, other various editions).  I do not see how to pull that 
information from GetOSVersion().  From what I can find on the web, I 
somehow need to use the "GetProductInfo" call from the "kernel32" DLL.

I have tried the following code to try to pull the information from my 
Vista 32 Ultimate, but cannot seem to get a valid response:

---- Cut here ----
#!/usr/bin/perl -w

use Win32;
use Win32::API;
use strict;

my @oslevel = Win32::GetOSVersion();

my ($osMaj, $osMin, $spMaj, $spMin);

printf("OS String:       %s\n", $oslevel[0]);
printf("OS ID:           %s\n", $oslevel[4]);
printf("OS Major:        %d\n", $osMaj = int($oslevel[1]));
printf("OS Minor:        %d\n", $osMin = int($oslevel[2]));
printf("OS Build:        %s\n", $oslevel[3]);
printf("OS SP Major:     %d\n", $spMaj = int($oslevel[5]));
printf("OS SP Minor:     %d\n", $spMin = int($oslevel[6]));
printf("OS SuiteMask:    0x%08x\n", $oslevel[7]);
printf("OS ProductType:  %s\n", $oslevel[8]);

my $prodInfo = 0xFFFFFFFF;   # initialize with invalid value
my $prodInfoPtr = \$prodInfo;

if (($oslevel[1] == 6) && ($oslevel[2] == 0)) {
  my $GetProductInfo = new Win32::API("kernel32", "GetProductInfo",
                                      "NNNNP", "I");
  my $rc = $GetProductInfo->Call($osMaj, $osMin, 
                                 $spMaj, $spMin, $prodInfoPtr);

  printf("\nRC =             %d\n", $rc);
  printf("Product Info:    0x%x\n", $prodInfo);
  printf("Product Info:    0x%x\n", $$prodInfoPtr);
}

---- Cut here ----


The information about this call is from this link:
    http://msdn.microsoft.com/en-us/library/ms724358(VS.85).aspx

Since the response from the GetProductInfo() command is put into the DW 
pointer, I have initialized the variable to 0xFFFFFFFF to ensure it is a 
double; however, the variable does not appear to be updated via the 
GetProductInfo() command (it remains 0xFFFFFFFF) and the $rc is set to 1. 
FWIW, I have also tried to pass the variable directly (i.e., not the ptr).

What am I doing wrong?  Is there a better way to get this information 
instead of using the GetProductInfo() command from the "kernel32" DLL?

Any help would greatly be appreciated.

Regards,
Michael Cohen
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to