Determining Vista Editions

2009-08-19 Thread Michael Cohen
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 = 0x;   # initialize with invalid value
my $prodInfoPtr = \$prodInfo;

if (($oslevel[1] == 6) && ($oslevel[2] == 0)) {
  my $GetProductInfo = new Win32::API("kernel32", "GetProductInfo",
  "P", "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 0x to ensure it is a 
double; however, the variable does not appear to be updated via the 
GetProductInfo() command (it remains 0x) 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


Re: need help from a new hand for perl

2009-08-19 Thread Fei Shi
Hi, All:
Thank you for all your inputs. They really help me a lot~~[?]
I downloaded the package "UnxUtils" and put my perl program under its "bin"
folder. After I changed the windows system "path" variable, I can run the
perl in the DOS system.

Only when I run the code below I have a little problem:
*cat ids_overlap_* | sort -u > "a file name"*

I have 3 files named as *ids_overlap_*(21Us/coding/ram)*. The error message
is:
*The system cannot find the file specified.
cat.exe: write error : invalid argument*

I wonder there is more than one version of "cat.exe or sort.exe" or the
calling code (_*?) is not right?
Again, thanks for all your inputs.
Have a nice day!
Fei

On Wed, Aug 19, 2009 at 10:20 AM, Daniel Bara <
daniel.b...@predictionlabs.com> wrote:

> Hi Fei,
> I had the same problem some time ago.
> I solved it with tools from the following resource.
> http://www.math.utah.edu/~beebe/gnu-on-windows.html
> Many DOS commands are different in UNIX. Like dir / ls or del rm.
> The other issue you will have to consider when modifying the script is how
> you move/direct to directories.
> I do not remember exactly but in some cases in windows // were necessary.
>
> I finally moved to Mac
>
> Hope it helps.
> *
> *
> Daniel
>
>
> On Aug 18, 2009, at 5:39 PM, Fei Shi wrote:
>
> Hi, Dear perl experts:
>
>  I am a new hand of perl. I use perl because I am trying to use a
> package called 
> "miRDeep".
> I install the *activeperl 5.10 for windows*. Then I used the MS DOS to try
> perl.
>
>  But there is an error coming out when I tried to run this command
> their demo: "perl auto_blast.pl 454_aligned.fa precursors. fa-b >
> signatures".
>
> The error message is as follows:
> *Copying subject file 'cp' is not recognized as an internal or external
> command, operable program or batch file.
> formatting subject file [NULL_Caption] ERROR: Could not open
> blast_dir_temp/file_subject
>
> Blasting query file against subject file
> [NULL_Caption] WARNING: readdb: wrong version of formatdb was used to make
> database blast_dir_temp/file_subject.
> [NULL_Caption] WARNING: bartel_100023_x1: readdb: wrong version of formatdb
> was used to make database blast_dir_temp/file_subject.
> Parsing blast output:
> 'cat' is not recognized as an internal or external command,
> operable program or batch file.
> 'cat' is not recognized as an internal or external command,
> operable program or batch file.
> 'cat' is not recognized as an internal or external command,
> operable program or batch file.
> 'rm' is not recognized as an internal or external command,
> operable program or batch file.
> 'rm' is not recognized as an internal or external command,
> operable program or batch file.
> *
> But I think the perl code "*auto_blast.pl*" is tested maturely by the
> author of the package so I am suspicious that there may be something wrong
> with my system?
> The *MS DOS is 5.1.2600 by windows XP*. I wonder if the above error
> message due to this or other reasons? I really appreciate if someone can
> point me out of this and give me a clue of the problem.
>
> Thank you very much for your time.
>
> Sincerely,
> Fei
> ___
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
>
<<330.gif>>___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: need help from a new hand for perl

2009-08-19 Thread Daniel Bara

Hi Fei,

I had the same problem some time ago.
I solved it with tools from the following resource.
http://www.math.utah.edu/~beebe/gnu-on-windows.html
Many DOS commands are different in UNIX. Like dir / ls or del rm.
The other issue you will have to consider when modifying the script is  
how you move/direct to directories.
I do not remember exactly but in some cases in windows // were  
necessary.


I finally moved to Mac

Hope it helps.

Daniel


On Aug 18, 2009, at 5:39 PM, Fei Shi wrote:


Hi, Dear perl experts:

 I am a new hand of perl. I use perl because I am trying to  
use a package called "miRDeep". I install the activeperl 5.10 for  
windows. Then I used the MS DOS to try perl.


 But there is an error coming out when I tried to run this  
command their demo: "perl auto_blast.pl 454_aligned.fa precursors.  
fa-b > signatures".


The error message is as follows:
Copying subject file 'cp' is not recognized as an internal or  
external command, operable program or batch file.
formatting subject file [NULL_Caption] ERROR: Could not open  
blast_dir_temp/file_subject


Blasting query file against subject file
[NULL_Caption] WARNING: readdb: wrong version of formatdb was used  
to make database blast_dir_temp/file_subject.
[NULL_Caption] WARNING: bartel_100023_x1: readdb: wrong version of  
formatdb was used to make database blast_dir_temp/file_subject.

Parsing blast output:
'cat' is not recognized as an internal or external command,
operable program or batch file.
'cat' is not recognized as an internal or external command,
operable program or batch file.
'cat' is not recognized as an internal or external command,
operable program or batch file.
'rm' is not recognized as an internal or external command,
operable program or batch file.
'rm' is not recognized as an internal or external command,
operable program or batch file.

But I think the perl code "auto_blast.pl" is tested maturely by the  
author of the package so I am suspicious that there may be something  
wrong with my system?
The MS DOS is 5.1.2600 by windows XP. I wonder if the above error  
message due to this or other reasons? I really appreciate if someone  
can point me out of this and give me a clue of the problem.


Thank you very much for your time.

Sincerely,
Fei
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: need help from a new hand for perl

2009-08-19 Thread Serguei Trouchelle
Fei Shi wrote:

> The error message is as follows:
> *Copying subject file 'cp' is not recognized as an internal or external 
> command, operable program or batch file.
> formatting subject file [NULL_Caption] ERROR: Could not open 
> blast_dir_temp/file_subject

Try to install MSYS: http://www.mingw.org/wiki/msys
It contains rm, cp and other unix-like commands.

-- 
Serguei Trouchelle
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs