GetVersion (Windows) plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Deprecated)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageAuthor|Afrow UK}}
{{PageAuthor|Afrow UK}}


== Deprecated ==
<span style="color:#FF0000">I am no longer maintaining this plug-in. I recommend using [[Get Windows version|WinVer.nsh]] instead, which is bundled with NSIS.</span>
== Windows 8 or above detection ==
* If using NSIS 3.0 or above, use the '''ManifestSupportedOS''' installer attribute and the bundled WinVer.nsh
* If using NSIS 2.46 or below, use [[Using !packhdr|!packhdr]] to embed additional supported OS GUIDs and an updated [http://forums.winamp.com/showpost.php?p=2949897&postcount=5 WinVer.nsh]


== Description ==
== Description ==
A plugin that gets Windows version information (name, type, version, server name, service pack, service pack build).
A plugin that gets Windows version information (name, type, version, server name, service pack, service pack build).


 
<attach>GetVersion.zip</attach>
== Installation ==
Place GetVersion.dll in your NSIS\Plugins folder or  simply extract all files in the Zip to NSIS\.
 
 
== Changelog ==
'''v1.1 - 21 August 2009'''
*Better Unicode build support.
*Added WindowsServicePackMinor and WindowsServicePackMajor.
 
'''v1.0 - 24 July 2009'''
*Fixed WindowsServerName.
*Changed Server Longhorn to Server 2008.
*Added Server 2008 R2.
*Added Windows 7.
*Changed core server installations to display (core installation).
 
'''v0.9 - 7 June 2008'''
*Major code clean up.
*All functions now return an empty string if GetVersionEx API call fails.
*Added Windows types and server names for Vista.
 
'''v0.8 - 22 August 2007'''
*Fixed WindowsType.
*Removed function to get IE version.
 
'''v0.7 - 16 July 2006'''
*WindowsName now returns simple names (not Windows #).
 
'''v0.6 - 11 April 2006'''
*Added support for Windows CE.
 
'''v0.5 - 11 March 2006'''
*Added support for Windows XP Media Center Edition (in WindowsType).
*Added support for Windows XP Tablet PC Edition (in WindowsType).
 
'''v0.4 - 10 March 2006'''
*Added WindowsPlatformId.
*Added WindowsPlatformArchitecture.
 
'''v0.3 - 12 February 2006'''
*Added support for Windows Vista and Longhorn Server.
 
'''v0.2 - 15 January 2006'''
*Added support for Windows x64.
*No support added for Windows Vista as yet (waiting for Microsoft to update their page for it!)
 
'''v0.1 - 16 July 2005'''
*First version.
 
== Download ==
<attach>GetVersion.zip</attach> v1.1 (2009-08-21)
 
== Discussion ==
[http://forums.winamp.com/showthread.php?s=&threadid=221621 Thread in NSIS (Winamp) Forums]
 
== The Functions ==
<highlight-nsis>
  GetVersion::WindowsName
  Pop $R0
 
  Gets name of Windows. This includes:
    7
    Vista
    Server 2008
    Server 2003
    Server 2003 R2
    XP
    XP x64
    2000
    CE
    NT
    ME
    98
    98 SE
    95
    95 OSR2
    Win32s
 
  ---------------------------
 
  GetVersion::WindowsType
  Pop $R0
 
  Gets type of Windows OS.
  For Windows NT:
    Workstation 4.0
  For Windows XP:
    Home Edition
    Professional
    Professional x64 Edition
    Media Center Edition
    Tablet PC Edition
    (or empty string)
  For Windows Vista:
    Ultimate Edition
    Home Premium Edition
    Home Basic Edition
    Enterprise Edition
    Business Edition
    Starter Edition
    (or empty string)
 
  ---------------------------
 
  GetVersion::WindowsVersion
  Pop $R0
 
  Gets the Windows version x.x (e.g. 5.1).
 
  ---------------------------
 
  GetVersion::WindowsServerName
  Pop $R0
 
  Gets the installed server name. This includes:
    Server
    Server 4.0
    Server 4.0 Enterprise Edition
    Workstation
    Storage Server 2003
    Server 2003
    Server 2008
    Cluster Server Edition
    Datacenter Edition
    Datacenter Edition for Itanium-based Systems
    Datacenter x64 Edition
    Enterprise Edition
    Enterprise Edition for Itanium-based Systems
    Enterprise x64 Edition
    Advanced Server
    Small Business Server
    Small Business Server Premium Edition
    Standard Edition
    Web Server Edition
    (or empty string)
 
  ---------------------------
 
  GetVersion::WindowsServicePack
  Pop $R0
 
  Gets the installed service pack name (e.g. Service Pack 2).
 
  ---------------------------
 
  GetVersion::WindowsServicePackBuild
  Pop $R0
 
  Gets the installed service pack build number (e.g. 2600).
 
  ---------------------------
 
  GetVersion::WindowsPlatformId
  Pop $R0
 
  Gets the platform Id of the installed Windows
  (e.g. 1, 2, 3).
 
  ---------------------------
 
  GetVersion::WindowsPlatformArchitecture
  Pop $R0
 
  Gets the architecture of the installed Windows
  (e.g. 32, 64).
</highlight-nsis>
 
== Example ==
<highlight-nsis>
Name "GetVersion Example"
OutFile "GetVersion.exe"
ShowInstDetails show
 
Page InstFiles
 
Section
 
GetVersion::WindowsName
  Pop $R0
  DetailPrint "WindowsName:"
  DetailPrint "  $R0"
 
GetVersion::WindowsType
  Pop $R0
  DetailPrint "WindowsType:"
  DetailPrint "  $R0"
 
GetVersion::WindowsVersion
  Pop $R0
  DetailPrint "WindowsVersion:"
  DetailPrint "  $R0"
 
GetVersion::WindowsServerName
  Pop $R0
  DetailPrint "WindowsServerName:"
  DetailPrint "  $R0"
 
GetVersion::WindowsPlatformId
  Pop $R0
  DetailPrint "WindowsPlatformId:"
  DetailPrint "  $R0"
 
GetVersion::WindowsPlatformArchitecture
  Pop $R0
  DetailPrint "WindowsPlatformArchitecture:"
  DetailPrint "  $R0"
 
GetVersion::WindowsServicePack
  Pop $R0
  DetailPrint "WindowsServicePack:"
  DetailPrint "  $R0"
 
GetVersion::WindowsServicePackBuild
  Pop $R0
  DetailPrint "WindowsServicePackBuild:"
  DetailPrint "  $R0"
 
SectionEnd
</highlight-nsis>
 
 


[[Category:Plugins]]
[[Category:Plugins]]
[[Category:Deprecated]]

Latest revision as of 00:54, 23 May 2020

Author: Afrow UK (talk, contrib)


Deprecated

I am no longer maintaining this plug-in. I recommend using WinVer.nsh instead, which is bundled with NSIS.

Windows 8 or above detection

  • If using NSIS 3.0 or above, use the ManifestSupportedOS installer attribute and the bundled WinVer.nsh
  • If using NSIS 2.46 or below, use !packhdr to embed additional supported OS GUIDs and an updated WinVer.nsh

Description

A plugin that gets Windows version information (name, type, version, server name, service pack, service pack build).

GetVersion.zip (34 KB)