Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

windows XP  pro/home edition


7 replies to this topic

saar netzer

saar netzer
  • Members
  • 17 posts

Posted 13 January 2002 - 11:57

i'm trying to find out if the windows xp is pro or home.
the API function "GetVersionEx(&lpVersionInfo)"
returns the same value on both platforms.
according to MSDN the value that should be returned from PRO
in the var. VER_SUITE_PERSONAL = 0
and on home eddition it should be VER_SUITE_PERSONAL = 200 (hex.)

but on both of them i recive VER_SUITE_PERSONAL=0.
please help me.


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 13 January 2002 - 19:03

When I was in seek of information on how to distinguish the two I posted the question to a newsgroup and here are two replies:

1.  THE PREFERED WAY
>>  "Call the GetVersionEx Windows API. If the VER_SUITE_PERSONAL flag =
is set in the OSVERSIONINFOEX structure, it's XP Home."  <<

That is close.  Searching the MS site for GetVersionEx I found Platform SDK: Windows System Information

 GetVersionEx
 The GetVersionEx function obtains extended information about the version of the operating system that is currently running.

 Windows 2000/XP: To compare the current system version to a required version, use the VerifyVersionInfo function instead of using GetVersionEx to perform the comparison yourself.

Go to VerifyVersionInfo at
http://msdn.microsof...rary....usv.asp
for more info.

2.  A POSSIBLE WAY
Here is a possible hint:
HKLM\Software\Microsoft\Windows\CurrentVersion and the ProductId field.  I would imagine there is a different product ID for the Pro version and the HE version.

---

However, I've not actually tried any of these techniques to see if they actually work.  From the sounds of it, GetVersionEx has problems.  It's worth giving VerifyVersionInfo a try, but I would think the two would use the same information.  Just the latter returns the answer in a cleaner  format.

If I have time this week at work, I'll try them out 'cause I'll need to be able to do this in the future.  Hopefully someone else has an idea though.

(Edited by TacoBell00 at 1:04 pm on Jan. 13, 2002)


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 13 January 2002 - 19:17

In the meatime, I tried using some Sample MSDN code in Visual C++, but it won't compile.  It seems I need to apply the latest Platform SDK toolkit.

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 16 January 2002 - 19:13

Any updates on this?  'cause it probably won't be 'til next week that I get a chance to try this stuff.

jmathison

jmathison
  • Members
  • 6 posts

Posted 27 June 2002 - 02:39

This topic is a bit old but I am running into the same issue with GetVersionEx.  Every member of the data structure OSVERSIONINFOEX past the service pack string szCSDVersion has a zero value.  Interestingly, this is also every member added since OSVERSIONINFO.  The five new guys are WORD wServicePackMajor; WORD wServicePackMinor; WORD wSuiteMask; BYTE wProductType; BYTE wReserved.

In my typedef block these are all of type NUMBER as everything I've read states IS does not differentiate between short and long and such.  Is this correct?

I've tested the code on NT, 2000, and XP and can't get any of them to cough up the additional info.  Any help would be much appreciated.  Thank you.

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 27 June 2002 - 05:20

It is a bit old, but certainly still relevant.  Fortunately for me, **woohoo**, I didn't need to worry about distinquishing the two anymore, so I have yet to pursue it any further.

For the sake of curiosity though, and due to possible future needs, I would still like to find out the answer.

Unfortunately these next few weeks are somewhat hellish, so I won't have spare/free time to properly investigate this.
user posted image

jmathison

jmathison
  • Members
  • 6 posts

Posted 24 July 2002 - 01:58

I THINK I may have this one sorted out.  There were two problems with my code:

For one, in my data structure OSVERSIONINFOEX I had the string szCSDVersion defined as length 256.  I believe I picked this up from IS KB Q101144, an old IS 5.x article, but at any rate it needs to be 128 as per the MSDN documentation.  (That'll teach me to read old KB articles.)

So then I was poking around and found that OSVERSIONINFO is defined in IS\Script\ISRT\Include\winapi.h (with a szCSDVersion string length of 128, the bastards).  It happens that I bought and installed (but haven't even played with) IS Developer 7 yesterday so I checked its winapi.h and sure enough, OSVERSIONINFOEX is defined.  It looks like this:

typedef OSVERSIONINFOEX
begin
   long   nOSVersionInfoSize;
   long   nMajorVersion;
   long   nMinorVersion;
   long   nuildNumber;
   long   nPlatformId;
   string szCSDVersion[ 128 ];
   short  nServicePackMajor;
   short  nServicePackMinor;
   short  nSuiteMask;
   short  nReserved;
end;

Notice that the author bothered to specify LONG and SHORT rather than just NUMBER.  (Now go back and read the IS help file on SHORT: "Equivalent to the NUMBER type; provided for convenience."  Mmm, yes, a successful API call would be convenient...)

Notice also that there is one member missing compared to the MSDN docs -- nProductType should appear after nSuiteMask.  I'm not sure why this is.

I changed my typedef to use SHORT for the WORD and BYTE members in the MSDN docs (nServicePackMajor, nServicePackMinor, nSuiteMask, nProductType, nReserved) and voila, instant suite mask and product type values.  I believe the numbers I'm getting are correct but need to do more platform testing after I take a break to go and play application programmer.  I'll be a very happy camper if this is it.

jmathison

jmathison
  • Members
  • 6 posts

Posted 30 July 2002 - 01:37

The code from my last post appears to be working, with one modification. I was wondering about nProductType, why it was not listed in the Developer 7 OSVERSIONINFOEX definition. The issue with nProductType appears to be that the call returns a short, which is two bytes, and you only want one.

I defined the structure member as nProductTypeBig and then made a local variable nProductType. As IS does not support floating point numbers this slightly unpleasant code seems to work:

nProductType = structVerInfoEx.nProductTypeBig -
 (structVerInfoEx.nProductTypeBig / 512) * 512;

Whee. Best of luck on this one.