Archive: GetVersion plugin


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


So... Stu is learning API, huh? ;)

:D :up:


Great, but better call it "GetOSversion" to avoid confusion with get FileVersion data.


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


New version with support for x64, Longhorn, Vista.
Also added WindowsPlatformId and WindowsPlatformArchitecture functions.

http://nsis.sourceforge.net/wiki/File:GetVersion.zip

-Stu


Thanks
  Thanks for this; it is appreciated.


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


Right I'll look into it.

-Stu


Please try this out (WindowsType function).
http://nsis.sourceforge.net/File:GetVersion.zip

-Stu


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.


I did say WindowsType function not WindowsName :p

-Stu


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.


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


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


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.


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 will. thanks again.

OJi.


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.

What would have expected it to return?
There may be a bug.

-Stu


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.

What is in "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType"?

-Stu


It's "WinNT"


FYI:
I just downloaded your latest version and found that IE detection is returning 6.0 when I have 7.0 installed.


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


Yep, that works.


The plugin function reads the version value from shdocvw.dll
I guess they have left it as 6.0 or something.

-Stu


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. ;)


Thanks :)
I will remove the function soon.

-Stu


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)"

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


Hey,

Can you update the plugin for windows Server 2008 versions and (maybe) future windows 7 ?

thanks,
OJi.


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


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

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.


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 :)

What about Vista x64 and Windows7?
  How about adding support for detecting Vista 64-bit and Windows 7?


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


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


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


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