Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > values for Windows version (dwMajorVersion, wServicePackMajor stuff)

Reply
Thread Tools Display Modes

values for Windows version (dwMajorVersion, wServicePackMajor stuff)

 
 
crystal160@gmail.com
Guest
Posts: n/a

 
      09-05-2007
i am working with these,

dwMajorVersion
dwMinorVersion
dwBuildNumber
dwPlatformId
wServicePackMajor
wServicePackMinor

1) So, dwMinorVersion (1) could only be Windows XP and dwMajorVersion
(6) could only be Windows Vista or Windows Server

2008?

2) So, if I had dwMinorVersion (1) and wServicePackMajor (1) that
could only be Windows XP SP1?

3) So, if I had dwMinorVersion (1) and wServicePackMajor (2) that
could only be Windows XP SP2?

4) Would dwMajorVersion (6) and wServicePackMajor (1) be possible?

Thank you. I am hoping these scattered questions will help me
understand this.

Crystal

 
Reply With Quote
 
 
 
 
Andrew McLaren
Guest
Posts: n/a

 
      09-05-2007
<> wrote ...
>i am working with these,
> dwMajorVersion
> dwMinorVersion
> dwBuildNumber
> dwPlatformId
> wServicePackMajor
> wServicePackMinor
> 1) So, dwMinorVersion (1) could only be Windows XP and dwMajorVersion
> (6) could only be Windows Vista or Windows Server 2008?
> 2) So, if I had dwMinorVersion (1) and wServicePackMajor (1) that
> could only be Windows XP SP1?
> 3) So, if I had dwMinorVersion (1) and wServicePackMajor (2) that
> could only be Windows XP SP2?
> 4) Would dwMajorVersion (6) and wServicePackMajor (1) be possible?


Hi Crystal,

It sounds like a trick question :-). You're saying, in effect: "I want to
examine a subset of my OSVERSIONINFOEX struct, and extrapolate the value of
other OSVERSIONINFOEX fields based on this subset". That's always going to
be risky programming: basically, it's trying to conjure information out of
thin air.

I suspect that dwMajorVersion (6) and wServicePackMajor (1) will certainly
be possible and common, once Service Pack 1 for Vista has been released.

dwMinorVersion (1) and wServicePackMajor (1) could easily prove to be an
as-yet unnanounced version of Windows like Vista R2 SP1, or similar -
there's no gurantee it will always be limited to Windows XP SP1.

Likewise, dwMinorVersion (1) and wServicePackMajor (2) may end up equalling
both XP SP2 *and* Windows Server 2008 R2, SP2. We just don't know.

We already saw huge bugs in 3rd party applications for Windows 3.1, which
did:

if (MinorVersion < 10) {
Error("This program requires Windows 3.1");
}
Windows 95 required a special comptibility fix to let all these programs
run. The programs had no technical incompatibility with Windows 95; but they
refused to run because of their broken MinorVersion check. Meanwhile, users
blasted Microsoft for "breaking compatibility".

So, my question for you is: how are you getting these dwMajorVersion, etc
values? I'm assuming that you are calling GetVersionEx() or
VerifyVersionInfo(). If you call weither of thee functions you will get a
fully populated OSVERSIONINFOEX struct. This gives you all the information
you need to determine the exact version of Windows - even versions which
don't exist yet. So, what are you trying to achieve, by manipulating a
subset of this information? What resource are you trying to conserve, while
making you application more fragile and error prove in its version checking?

--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
crystal160@gmail.com
Guest
Posts: n/a

 
      09-05-2007
> So, my question for you is: how are you getting these dwMajorVersion, etc
> values? I'm assuming that you are calling GetVersionEx() or
> VerifyVersionInfo(). If you call weither of thee functions you will get a
> fully populated OSVERSIONINFOEX struct. This gives you all the information
> you need to determine the exact version of Windows - even versions which
> don't exist yet. So, what are you trying to achieve, by manipulating a
> subset of this information? What resource are you trying to conserve, while
> making you application more fragile and error prove in its version checking?


Very Interesting! I think see what you mean....

I am indeed using GetVersionEx() to get the fully populated
OSVERSIONINFOEX.

So, based on this data, how can I pluck it to come to the conclusion I
am dealing with, 1) a Windows XP version less than Windows XP2, and 2)
a Windows Vista machine? I want to limit constraints to 1 & 2, so...
like server editions, Windows 2003 or whatnot should be ignored/not
identified. Can that be done?

Crystal

 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a

 
      09-05-2007
> I am indeed using GetVersionEx() to get the fully populated
> OSVERSIONINFOEX.
>
> So, based on this data, how can I pluck it to come to the conclusion I
> am dealing with, 1) a Windows XP version less than Windows XP2, and 2)
> a Windows Vista machine? I want to limit constraints to 1 & 2, so...
> like server editions, Windows 2003 or whatnot should be ignored/not
> identified. Can that be done?



Of course! :-) The trick is that you must *never* make decisions based on
dwMinorVersion alone, without an explicit dwMajorVersion context for it.
Generally, you'd want to use dwMajorVersion and dwMinorVersion togther, to
make sure the version context is clear:

if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
printf ("Gee, it must be Vista Service Pack 1!");

if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
printf ("It is Windows Vista");
else printf ("It is Windows Server 2008" );
}

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
printf ("It is Microsoft Windows XP ");

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
printf ("It is Microsoft Windows 2000 ");

There are many code samples in MSDN, see here for a good starting point:
http://msdn2.microsoft.com/en-us/library/ms724429.aspx

Hope it helps,
--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
crystal160@gmail.com
Guest
Posts: n/a

 
      09-05-2007

> if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
> printf ("It is Microsoft Windows XP ");


Ah! Very good and I do believe I have a clear understanding.

Just to verify, within the subset of Windows XP, am I right in my
logic below?

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
printf ("It is Microsoft Windows XP Home or Professional
SP1");

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
printf ("It is Microsoft Windows XP Home or Professional
SP2");

 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a

 
      09-06-2007
<> wrote ...
> Just to verify, within the subset of Windows XP, am I right in my
> logic below?
>
> if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
> printf ("It is Microsoft Windows XP Home or Professional
> SP1");
>
> if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
> printf ("It is Microsoft Windows XP Home or Professional
> SP2");



No! No, no, no. That code will give you the wrong results.

(dwMajorVersion == 5 && dwMinorVersion == 1) includes *all* releases of
32-bit XP; including RTM, SP1, SP2; and SP3 when it finally ships.

(dwMajorVersion == 5 && dwMinorVersion == 2) is Windows Server 2003 R2,
Server 2003, or XP x64.

dwMinorVersion does not give you any information about Service Pack level.
It indicates the minor version, that is all. The Service Pack version is
indicated by wServicePackMajor and wServicePackMinor.

Did you look at the code sample in the URL I sent you? -
http://msdn2.microsoft.com/en-us/library/ms724429.aspx

Everything you need to know, is there.

if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
{
printf ("It is Microsoft Windows XP Home or Professional ");
{
if ( osvi.wServicePackMajor == 0 )
printf ("with no Service Pack");
else if ( osvi.wServicePackMajor == 1 )
printf ("with Service Pack 1");
else if ( osvi.wServicePackMajor == 2 )
printf ("with Service Pack 2");
else printf ("unrecognised Service Pack");
}
}

You need to read and understand the MSDN documentation. That is more
reliable, than trusting random fools in newsgroups:
http://msdn2.microsoft.com/en-us/library/ms724833.aspx

--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
purposegreen@gmail.com
Guest
Posts: n/a

 
      09-06-2007
> than trusting random fools in newsgroups

L0L, you don't seem like one

Finally, I want to ask,

please look at this:

if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
printf ("Gee, it must be Vista Service Pack 1!");

Can one determine Windows Vista service pack releases the same way as
calculated with Windows XP?

so, like

if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
{
printf ("It is Microsoft Windows Vista All Versions");
{
if ( osvi.wServicePackMajor == 0 )
printf ("with no Service Pack");
else if ( osvi.wServicePackMajor == 1 )
printf ("with Service Pack 1");
else if ( osvi.wServicePackMajor == 2 )
printf ("with Service Pack 2");
else if ( osvi.wServicePackMajor == 3 )
printf ("with Service Pack 3");
else if ( osvi.wServicePackMajor == 4 )
printf ("with Service Pack 4");
else printf ("unrecognised Service Pack");
}
}

It is slightly exaggerated, but will it work? I noted you have this:

if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
printf ("It is Windows Vista");
else printf ("It is Windows Server 2008" );
}

Is above just an alternative way to get to the same information?




 
Reply With Quote
 
passssifit@gmail.com
Guest
Posts: n/a

 
      09-06-2007
On Sep 5, 9:25 pm, purposegr...@gmail.com wrote:
> > than trusting random fools in newsgroups

>
> L0L, you don't seem like one
>
> Finally, I want to ask,
>
> please look at this:
>
> if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
> printf ("Gee, it must be Vista Service Pack 1!");
>
> Can one determine Windows Vista service pack releases the same way as
> calculated with Windows XP?
>
> so, like
>
> if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
> {
> printf ("It is Microsoft Windows Vista All Versions");
> {
> if ( osvi.wServicePackMajor == 0 )
> printf ("with no Service Pack");
> else if ( osvi.wServicePackMajor == 1 )
> printf ("with Service Pack 1");
> else if ( osvi.wServicePackMajor == 2 )
> printf ("with Service Pack 2");
> else if ( osvi.wServicePackMajor == 3 )
> printf ("with Service Pack 3");
> else if ( osvi.wServicePackMajor == 4 )
> printf ("with Service Pack 4");
> else printf ("unrecognised Service Pack");
> }
> }
>
> It is slightly exaggerated, but will it work? I noted you have this:
>
> if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
> {
> if( osvi.wProductType == VER_NT_WORKSTATION )
> printf ("It is Windows Vista");
> else printf ("It is Windows Server 2008" );
> }
>
> Is above just an alternative way to get to the same information?


i hope this different view is satisfactory -- no?

 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a

 
      09-07-2007
> Finally, I want to ask,
> please look at this:
> Is above just an alternative way to get to the same information?


Is there some specific technical question you are not clear about? Or are
you just looking for general confirmation?

Everything you need to know about GetVersionEx() is in the MSDN URLs I gave
you. If the answer is not obvious from those links, read them again; repeat,
until the answer is obvious.

I can answer questions forever; but eventually you need exercise your own
analytical powers.

--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
crystal160@gmail.com
Guest
Posts: n/a

 
      09-07-2007

> Andrew McLaren
> amclar (at) optusnet dot com dot au


No worries Andrew, thank you for your time and I appreciate it. I am
assuming you are singing off -- it is critical to me to get
confirmations, (like I was trained by a guy from Singapore -- who
always preached, 'trust, but re-confirm'". therefore, when there are
blank spaces, I try not to play word volleyball, just be polite and
understand sometimes conversationalists on-balance sometimes one
wishes.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need some registry values Michael Windows Vista General Discussion 5 03-13-2007 03:01 AM
running windows xp stuff on vista programs Windows Vista General Discussion 5 01-29-2007 01:55 PM
Re: Getting WLX_NOTIFICATION_INFO values Michael Jennings Windows Vista General Discussion 0 01-13-2007 02:44 AM
By installing Windows Vista RC1, am I going to lose my stuff? David Iniguez Windows Vista Installation 1 09-24-2006 01:55 AM
Tip: CRC and MD5 values for Vista John Barnes Windows Vista General Discussion 2 09-07-2006 12:41 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59