Archive: Determine which vista edition is installed


Determine which vista edition is installed
Is it possible to determine which edition of vista has been installed using the GetVersion library or similar?

Thanks


call GetProductInfo with the system plugin

or even better, if you have a real need for some specific api or something you can check if the exported api exists by calling GetProcAddress on the dll with the system plugin


Pardon my ignorance but how do I that?

I assume something like

System::Call 'kernel32::GetProductInfo...'

but now i am lost...

Essentially I like to allow Windows 2000, XP Pro 32-bit, Windows Server 2003, and Windows Vista Business, Vista Enterprise, and Vista Ultimate only.

Mainly I am reworking a function (which I previously asked help on...)


Function .onInit


;; denied
GetVersion::WindowsName
Pop $R0

${If} $R0 == "XP"
Goto xp
${ElseIf} $R0 == "2000"
Goto go_away
${ElseIf} $R0 == "Server 2003"
Goto go_away
${Elseif} $R0 == "Server 2003 R2"
Goto go_away
${Elseif} $R0 == "Vista" ; no idea if this works
Goto go_away
${Else}
Goto error
${EndIf}

xp:
GetVersion::WindowsType
Pop $R0
GetVersion::WindowsPlatformArchitecture
; Pop $R1
StrCmp $R0 "Home Edition" xp_home_error go_away
; StrCmp $R1 "64" xp_64 go_away

xp_home_error:
MessageBox MB_OK|MB_ICONSTOP "Windows XP Home Edition is not supported!" IDOK
Quit

error:
MessageBox MB_OK|MB_ICONSTOP "Windows $R0 is not supported!" IDOK
Quit


go_away:

; ... rest of code


The GetVersion plug-in has basic Vista detection. I have plans to implement GetProductInfo when I have time.

Stu


Untested.

System::Call kernel32::GetProductInfo(i6,i0,i0,i0,*i.r0)
# $0 is 5 for Home Basic N
See MSDN for all possible return values.

Okay. Anyway to incorporate this into the main winver libraries?

http://msdn2.microsoft.com/en-us/library/ms724429.aspx

...

Mainly, does this return hex or the dwtype value?
So that I can put if type = say 0x00000005, then throw error/abort.


It returns a number. No need to compare to 0x000xxxx. You can take a look in WinVer.nsh and add this as another operator for LogicLib.


So for 0x0000001A i can just see if $0 is 26 in this case?


Yes. You can also compare it with IntCmp or LogicLib's integer comparison and use 0x1A.


Ok, so I am trying to differentiate between Vista32 and Vista64. I've included this system call in .onInit:

System::Call kernel32::GetProductInfo(i6,i0,i0,i0,*i.r0)
MessageBox MB_OK "Windows Version: $0"
or
MessageBox MB_OK "Windows Version: $R0"


but the message Box prints:

"Windows Version: 0"
or
"Windows Version: "


Am I missing something?


0 means PRODUCT_UNDEFINED, which is weird. Try adding i.r1 in the end and check out the error code.

But if all you want is to determine if whether or not you're running on x64, all you need is x64.nsh and then ${If} ${RunningX64}.


GetVersion now uses GetProductInfo on Vista.

Stu


Hi,

i tried with GetProductInfo, but the Return Value is -1412584499 ??? In MSDN you can read, that it also seems that the return value is different if Vista is activated or not.

I tried the GetVersion plugin but it shows me not the edition, but in the wiki plugins section the date of the GetVersion.dll is 24-07-2007 (so it seems to be older than Stu's posting.

I dont know how to determine the different Vista Editions ... May be is there a way over WMI with the Win32_OperatingSystem Class over the OperatingSystemSKU Value (http://msdn2.microsoft.com/en-us/library/aa394239(VS.85).aspx)?

Is it possible ... and does anybody how to call this WMI Function (or another working way to determine the edition)?

Thx


Originally posted by Afrow UK
GetVersion now uses GetProductInfo on Vista.

Stu
I downloaded http://nsis.sourceforge.net/File:GetVersion.zip today but it only identifies Vista Home Basic as "Vista".

The ReadMe.txt file inside the zip file says
GetVersion.dll v0.8 (5kB) by Afrow UK

Last build: 24th July 2007
so the wiki appears to have an out-of-date version of the GetVersion plugin.

Not quite sure where v0.9 went but it's on there now.

Stu


Thanks for uploading the new version - it works OK on my Vista system.