GetVersion (Windows) plug-in

From NSIS Wiki

Author: Afrow UK (talk, contrib)



Contents

[edit] Description

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


[edit] Installation

Place GetVersion.dll in your NSIS\Plugins folder or simply extract all files in the Zip to NSIS\.


[edit] 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.

[edit] Download

GetVersion.zip (11 KB) v1.1 (2009-08-21)

[edit] Discussion

Thread in NSIS (Winamp) Forums

[edit] The Functions

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

[edit] Example

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
Personal tools
donate
ads