Old 16th July 2005, 15:24   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 16th July 2005, 16:51   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
So... Stu is learning API, huh?



* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 16th July 2005, 17:10   #3
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
Great, but better call it "GetOSversion" to avoid confusion with get FileVersion data.

"Just do it"
onad is offline   Reply With Quote
Old 16th July 2005, 17:56   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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

Last edited by Afrow UK; 16th July 2005 at 18:18.
Afrow UK is offline   Reply With Quote
Old 10th March 2006, 12:58   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
New version with support for x64, Longhorn, Vista.
Also added WindowsPlatformId and WindowsPlatformArchitecture functions.

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

-Stu
Afrow UK is offline   Reply With Quote
Old 10th March 2006, 15:31   #6
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Thanks

Thanks for this; it is appreciated.
Jamyn is offline   Reply With Quote
Old 11th March 2006, 08:51   #7
sissy
Junior Member
 
Join Date: Mar 2006
Posts: 15
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
sissy is offline   Reply With Quote
Old 11th March 2006, 13:06   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Right I'll look into it.

-Stu
Afrow UK is offline   Reply With Quote
Old 11th March 2006, 14:11   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Please try this out (WindowsType function).
http://nsis.sourceforge.net/File:GetVersion.zip

-Stu
Afrow UK is offline   Reply With Quote
Old 12th March 2006, 11:19   #10
sissy
Junior Member
 
Join Date: Mar 2006
Posts: 15
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.
sissy is offline   Reply With Quote
Old 12th March 2006, 12:12   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I did say WindowsType function not WindowsName

-Stu
Afrow UK is offline   Reply With Quote
Old 16th July 2006, 06:03   #12
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
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.
o_owd is offline   Reply With Quote
Old 16th July 2006, 09:32   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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 is offline   Reply With Quote
Old 16th July 2006, 09:34   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 16th July 2006, 10:09   #15
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
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.
o_owd is offline   Reply With Quote
Old 16th July 2006, 10:18   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 16th July 2006, 10:20   #17
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
i will. thanks again.

OJi.
o_owd is offline   Reply With Quote
Old 16th July 2006, 10:43   #18
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
Quote:
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.

The guy with the ridiculous username. Thou shall call him PaR instead.
Visit My Website
{_trueparuex^} is offline   Reply With Quote
Old 16th July 2006, 15:19   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What would have expected it to return?
There may be a bug.

-Stu
Afrow UK is offline   Reply With Quote
Old 16th July 2006, 19:24   #20
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
Quote:
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.

The guy with the ridiculous username. Thou shall call him PaR instead.
Visit My Website
{_trueparuex^} is offline   Reply With Quote
Old 16th July 2006, 20:57   #21
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What is in "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType"?

-Stu
Afrow UK is offline   Reply With Quote
Old 17th July 2006, 10:20   #22
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
It's "WinNT"

The guy with the ridiculous username. Thou shall call him PaR instead.
Visit My Website
{_trueparuex^} is offline   Reply With Quote
Old 27th July 2006, 14:55   #23
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
FYI:
I just downloaded your latest version and found that IE detection is returning 6.0 when I have 7.0 installed.
Comperio is offline   Reply With Quote
Old 27th July 2006, 16:28   #24
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 27th July 2006, 16:42   #25
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
Yep, that works.
Comperio is offline   Reply With Quote
Old 27th July 2006, 16:51   #26
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
The plugin function reads the version value from shdocvw.dll
I guess they have left it as 6.0 or something.

-Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2006, 02:38   #27
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
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.
Comperio is offline   Reply With Quote
Old 28th July 2006, 09:38   #28
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Thanks
I will remove the function soon.

-Stu
Afrow UK is offline   Reply With Quote
Old 14th July 2008, 12:44   #29
Hywkar
Junior Member
 
Join Date: Jul 2008
Posts: 1
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 : )".


code:

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

Hywkar is offline   Reply With Quote
Old 14th July 2008, 15:16   #30
MP_chefkoch
Junior Member
 
Join Date: Jul 2004
Posts: 7
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
MP_chefkoch is offline   Reply With Quote
Old 4th November 2008, 13:11   #31
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
Hey,

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

thanks,
OJi.
o_owd is offline   Reply With Quote
Old 6th January 2009, 14:31   #32
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
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
xbarns is offline   Reply With Quote
Old 27th January 2009, 18:05   #33
mark.ruys
Junior Member
 
Join Date: Jan 2009
Posts: 4
Quote:
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
mark.ruys is offline   Reply With Quote
Old 27th January 2009, 19:09   #34
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 28th January 2009, 06:58   #35
mark.ruys
Junior Member
 
Join Date: Jan 2009
Posts: 4
Quote:
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
mark.ruys is offline   Reply With Quote
Old 31st January 2009, 01:27   #36
cowwoc
Member
 
Join Date: Feb 2005
Posts: 51
What about Vista x64 and Windows7?

How about adding support for detecting Vista 64-bit and Windows 7?
cowwoc is offline   Reply With Quote
Old 31st January 2009, 07:34   #37
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,150
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th May 2009, 14:34   #38
Miguel Ventura
Junior Member
 
Join Date: May 2009
Location: Lisbon, Portugal
Posts: 2
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
Miguel Ventura is offline   Reply With Quote
Old 4th May 2009, 15:07   #39
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th June 2009, 13:38   #40
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
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
jweinraub is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump