- NSIS Discussion
- GetVersion plugin
Archive: GetVersion plugin
Afrow UK
16th July 2005 16:24 UTC
GetVersion plugin
A 4kB plugin to get Windows version info:
name, type, version, server name, service pack name, and service pack build.
http://nsis.sourceforge.net/wiki/File:GetVersion.zip
Type is e.g. Home Edition
Edit: I could add other version info stuff later if anyone needs it (i.e. non Windows version stuff).
-Stu
Joel
16th July 2005 17:51 UTC
So... Stu is learning API, huh? ;)
:D :up:
onad
16th July 2005 18:10 UTC
Great, but better call it "GetOSversion" to avoid confusion with get FileVersion data.
Afrow UK
16th July 2005 18:56 UTC
I didn't call it that because I may add other version stuff to it, e.g. IE version or perhaps Microsoft Office etc.
Edit: Just added IEVersion which returns IE version and build.
-Stu
Afrow UK
10th March 2006 13:58 UTC
New version with support for x64, Longhorn, Vista.
Also added WindowsPlatformId and WindowsPlatformArchitecture functions.
http://nsis.sourceforge.net/wiki/File:GetVersion.zip
-Stu
Jamyn
10th March 2006 16:31 UTC
Thanks
Thanks for this; it is appreciated.
sissy
11th March 2006 09:51 UTC
stu
Great plugin just one slight problem it reports windows media center editon as XP which it is to a degree but would be nice if it could also detect this.
thanks
Afrow UK
11th March 2006 14:06 UTC
Right I'll look into it.
-Stu
Afrow UK
11th March 2006 15:11 UTC
Please try this out (WindowsType function).
http://nsis.sourceforge.net/File:GetVersion.zip
-Stu
sissy
12th March 2006 12:19 UTC
Hi Stu,
Still reports as Windows XP.
Found this, might give a heads up http://salloway.org.uk/mediacenter/2004/version.htm
Looks like they read the ident key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Ident key
and depending on the value returned determines the version and any patches.
Hope this helps.
Afrow UK
12th March 2006 13:12 UTC
I did say WindowsType function not WindowsName :p
-Stu
o_owd
16th July 2006 07:03 UTC
hello,
i was using a plugin for windows detection but it is outdated. so i turned to GetVersion.
my software is only for NT platform (NT, 2000, XP, 2003, Vista). can i make a check for this with your plugin ?
i want the installer to check the platform (9x or NT) and ... i'll do the rest... :)
one more question. what is WindowsPlatformId from your plugin ?
thanks,
OJi.
Afrow UK
16th July 2006 10:32 UTC
1) GetVersion::WindowsName will return e.g. "Windows 2000"
2) Each Windows has a different Platform ID, like 1 2 3 etc. You should be able to find something about this on Google.
-Stu
Afrow UK
16th July 2006 10:34 UTC
I am going to rebuild the plugin just to return 2000 if /short is specified as a parameter.
Edit: Now returns e.g. 2000 instead of Windows 2000.
-Stu
o_owd
16th July 2006 11:09 UTC
thanks, i will try it.
OJi.
edit - the version from wiki is still from april. please post a reply when you upload the new version.
Afrow UK
16th July 2006 11:18 UTC
Uploaded.
By the way, the DLL uses .NET because some of its features are only supported by .NET (i.e. Vista detection).
So, you might want to test the DLL on a system without Microsoft .NET Framework installed.
-Stu
o_owd
16th July 2006 11:20 UTC
i will. thanks again.
OJi.
{_trueparuex^}
16th July 2006 11:43 UTC
Originally posted by Afrow UK
Uploaded.
By the way, the DLL uses .NET because some of its features are only supported by .NET (i.e. Vista detection).
So, you might want to test the DLL on a system without Microsoft .NET Framework installed.
-Stu
I tried the plug-in in Windows 2000 pro without .NET and it works. Only thing is that WindowsServerName doesn't return anything, no errors nothing.
Afrow UK
16th July 2006 16:19 UTC
What would have expected it to return?
There may be a bug.
-Stu
{_trueparuex^}
16th July 2006 20:24 UTC
Originally posted by Afrow UK
What would have expected it to return?
There may be a bug.
-Stu
Not sure, but it should return Workstation.
Afrow UK
16th July 2006 21:57 UTC
What is in "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType"?
-Stu
{_trueparuex^}
17th July 2006 11:20 UTC
It's "WinNT"
Comperio
27th July 2006 15:55 UTC
FYI:
I just downloaded your latest version and found that IE detection is returning 6.0 when I have 7.0 installed.
Afrow UK
27th July 2006 17:28 UTC
I may remove that function. You can read the IE version from the registry. Infact there's a function in the NSIS documentation under Useful Scripts which reads from the registry. Does that work?
-Stu
Comperio
27th July 2006 17:42 UTC
Yep, that works.
Afrow UK
27th July 2006 17:51 UTC
The plugin function reads the version value from shdocvw.dll
I guess they have left it as 6.0 or something.
-Stu
Comperio
28th July 2006 03:38 UTC
Yep, right you are. I just checked mine and it is version 6.0.2900.2919.
edit:
Just to let you know, I've OK with just reading the registry. I only mentioned the problem because you had a feature that didn't work as designed. ;)
Afrow UK
28th July 2006 10:38 UTC
Thanks :)
I will remove the function soon.
-Stu
Hywkar
14th July 2008 13:44 UTC
Is there an easy way to detect if the operating system is windows server 2000? I tried the latest release and on windows 2000 server it gives me "Windows 2000 version 5.0 (Type : Professional, Server Name : )".
GetVersion::WindowsName
Pop $0
GetVersion::WindowsType
Pop $1
GetVersion::WindowsServerName
Pop $2
GetVersion::WindowsVersion
Pop $3
DetailPrint "Windows $0 version $3 (Type : $1, Server Name : $2)"
MP_chefkoch
14th July 2008 16:16 UTC
Hi Stuart,
you posted that you maybe will include more products or version checks.
What do you think about including a version check for .Net, which will work with dotNet 1, 2 and 3.
In wiki is a script which is able to do that and it seems to work like a charme, but maybe it would be cool to have it in this plugin, so no additional scripts are needed.
kind regards
chefkoch
o_owd
4th November 2008 14:11 UTC
Hey,
Can you update the plugin for windows Server 2008 versions and (maybe) future windows 7 ?
thanks,
OJi.
xbarns
6th January 2009 15:31 UTC
Hi Stuart,
any plans of making this work with the unicode version of NSIS?
I tried and only get nice little "boxes" and some numbers back :)
regards
xBarns
mark.ruys
27th January 2009 19:05 UTC
Originally posted by xbarns
Hi Stuart,
any plans of making this work with the unicode version of NSIS?
I tried and only get nice little "boxes" and some numbers back :)
regards
xBarns
I did build a Unicode GetVersion.dll to be used with Jim Park's excellent port. I encountered a problem however: generated installers seem to be running in XP-compatibility mode. As a result, GetVersion will report Windows XP SP2 on a Vista machine. I'll try to contact Jim to figure out how to fix it.
Mark
kichik
27th January 2009 20:09 UTC
You need to use RequestExecutionLevel to avoid Vista's compatibility hacks. If it doesn't work, there might be a problem with the embedded manifest. Maybe it was converted to UTF-16 as well though it should stay UTF-8.
mark.ruys
28th January 2009 07:58 UTC
Originally posted by kichik
You need to use RequestExecutionLevel to avoid Vista's compatibility hacks. If it doesn't work, there might be a problem with the embedded manifest. Maybe it was converted to UTF-16 as well though it should stay UTF-8.
The manifest is all right. For some reason the generated installer ran in Windows XP compatiblity mode. And not for me, but for "all users": right-click icon, properties, compatibility, settings for all users. Ticking that one off, and GetVersion.dll returns Vista again.
I rebuild GetVersion.dll and Processes.dll for Unicode. Now I can roll out our installer with Unicode language strings :)
cowwoc
31st January 2009 02:27 UTC
What about Vista x64 and Windows7?
How about adding support for detecting Vista 64-bit and Windows 7?
Anders
31st January 2009 08:34 UTC
you already have a header with 64 bit stuff.
7 is not out yet so we can't be 100% sure what the version number is, probably 6.1.XXXX
Miguel Ventura
4th May 2009 15:34 UTC
Service Pack is localized :( -- improvement suggestion
Hi
Could you please introduce a function to return the value from wServicePackMajor and/or wServicePackMinor to complement the existing WindowsServicePack which uses szCSDVersion? It's just that the string in szCSDVersion is localized and therefore harder to parse (you have to look for the number assuming that instead of "Service Pack" you can get something else).
Thanks for the great plugin
Best regards,
Miguel
Afrow UK
4th May 2009 16:07 UTC
I'm afraid I do not have the tools available to build this plugin at this time (nor can I install them because I am on Vista here).
Stu
jweinraub
9th June 2009 14:38 UTC
There is a new version of WinVer.nsh that does detect Windows 7. I have the latest build, RC-1 on my laptop. I am willing to test GetVersion on it, as I need to have routines in my installers that detect Windows 7.
Thanks