Version plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 12: Line 12:


====<span style="color:red">Virus scanner false alarm</span>====  
====<span style="color:red">Virus scanner false alarm</span>====  
Currently some malware scanners (AntiVir, TrendMicro) falsely detect the Version.dll as malware. The companies are informed thus this should go away soon. This isn't the first time where this happened to NSIS [[NSIS_False_Positives|Nsis]].
Currently some malware scanners (AntiVir, TrendMicro) falsely detect the Version.dll as malware. The companies are informed thus this should go away soon. This isn't the first time where this happened to [[NSIS_False_Positives|NSIS]].


== Description ==
== Description ==

Revision as of 19:55, 20 February 2013

Author: TeeWeTee (talk, contrib)


Links

Version 0.3 (20. feb 2013)
NSIS_version_plugin_03.zip (69 KB)[Adapted version by TeeWeTee]
Version 0.2 (25 sep 2004)[Version by denis_gorbunov]
NSIS_version_plugin_02.zip (35 KB)

Release builds with VS2010 Premium (only older 0.2 release)

ANSI: http://db.tt/cbyN0KJh Unicode: http://db.tt/OfllzHW7

Virus scanner false alarm

Currently some malware scanners (AntiVir, TrendMicro) falsely detect the Version.dll as malware. The companies are informed thus this should go away soon. This isn't the first time where this happened to NSIS.

Description

With this plugin you are able to determine which version of windows you are running. Technically it is using the GetVersionEx() method from the "kernel32.dll".

Features:

  • check for a specific windows version:
    • IsWindows95
    • IsWindows98
    • IsWindowsME
    • IsWindowsNT351
    • IsWindowsNT40
    • IsWindows2000
    • IsWindowsXP
    • IsWindows2003
    • IsWindowsXPx64
    • IsWindowsVista
    • IsWindowsServer2008
    • IsWindows7
    • IsWindowsServer2008R2
    • IsWindows8
    • IsWindowsServer2012
  • Call 'GetWindowsVersion' to get all relevant windows versioning infos:
    • major version
    • minor version
    • build number
    • platform id
    • service pack name
    • product type
  • Call 'IsWindowsPlatformNT()' or 'IsWindowsPlatform9x' to detect the windows platform type

Usage Example

Name VersionExample
 
# Included files
!include Sections.nsh
!include "LogicLib.nsh"
 
OutFile "Example_Version_NSIS_plugin.exe"
 
#Declare variables
var isWindowsXP
var MajorVersion
var MinorVersion
var BuildNumber
var PlatformID
var CSDVersion
var ProductType 
 
 
Section -Nope
#Nothing to do here
SectionEnd
 
Function .onInit
 
  #detect Windows XP
  Version::IsWindowsXP
  #obtain value
  Pop $isWindowsXP
 
  ${if} $isWindowsXP == "1"
    MessageBox MB_OK "Its Windows XP!"
  ${Else}
    MessageBox MB_OK "Its not Windows XP!"
  ${EndIf}
 
  #call plugin dll function 
  Version::GetWindowsVersion

  Pop $MajorVersion
  Pop $MinorVersion
  Pop $BuildNumber
  Pop $PlatformID
  Pop $CSDVersion
  Pop $ProductType
 
  ${if} $ProductType == "1"
    MessageBox MB_OK "$PlatformID-platform, version $MajorVersion.$MinorVersion, build $BuildNumber, $CSDVersion, Workstation"
  ${ElseIf} $ProductType == "2"
    MessageBox MB_OK "$PlatformID-platform, version $MajorVersion.$MinorVersion, build $BuildNumber, $CSDVersion, DomainController"
  ${ElseIf} $ProductType == "3"
    MessageBox MB_OK "$PlatformID-platform, version $MajorVersion.$MinorVersion, build $BuildNumber, $CSDVersion, Server"
  ${Else}
    MessageBox MB_OK "$PlatformID-platform, version $MajorVersion.$MinorVersion, build $BuildNumber, $CSDVersion, Unknown ProductType"
  ${EndIf}
  Quit
 
FunctionEnd