Version plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(→Links) |
||
Line 5: | Line 5: | ||
Version plug-in on my site [http://faq1c.gorbunov.ru/node/18] (english) (35 KB) (Mirror #1) | Version plug-in on my site [http://faq1c.gorbunov.ru/node/18] (english) (35 KB) (Mirror #1) | ||
Version plug-in on my site [http://faq1c.gorbunov.ru/node/13] (russian) (35 KB) (Mirror #1) | Version plug-in on my site [http://faq1c.gorbunov.ru/node/13] (russian) (35 KB) (Mirror #1) | ||
=== There are also Release builds made on VS2010 Premium === | |||
ANSI: http://db.tt/cbyN0KJh | |||
Unicode: http://db.tt/OfllzHW7 | |||
== Description == | == Description == |
Revision as of 08:12, 26 June 2012
Author: denis_gorbunov (talk, contrib) |
Links
NSIS_version_plugin_02.zip (35 KB)
Version plug-in on my site [1] (english) (35 KB) (Mirror #1)
Version plug-in on my site [2] (russian) (35 KB) (Mirror #1)
There are also Release builds made on VS2010 Premium
ANSI: http://db.tt/cbyN0KJh Unicode: http://db.tt/OfllzHW7
Description
Windows OS contain special API for OS version detecting. But standard NSIS 2 pack not use this.
My special plugin "Version.dll" use OS API (function GetVersionEx() from "kernel32.dll") for OS version detecting.
Plugin contain function:
- GetWindowsVersion (get major, minor version, build number, platform id, service pack name);
- simply OS detect function (IsWindows31, IsWindows95, IsWindows98, IsWindowsME, IsWindowsNT351, IsWindowsNT40, IsWindows2000, IsWindowsXP, IsWindows2003);
- simply OS platform detect function (IsWindowsPlatformNT, IsWindowsPlatform9x);
- simply "good" OS detect function (IsWindows98orLater);
Size of plugin "version.dll" is 6144 bytes
Usage Example
; if "version.dll" copied in NSIS plugin sub-directory ; this line is not necessary !addplugindir "plugins" ; it is not example ; it is for this empty intallation only OutFile "example_Version_NSIS_plugin.exe" Section Dummy ; it is not example ; it is for this empty intallation only SectionEnd ; variables declaration var TempResult var MajorVersion var MinorVersion var BuildNumber var PlatformID var CSDVersion Function .onInit ; detect Windows XP ; it is simply ; call plugin dll function Version::IsWindowsXP ; get result Pop $TempResult ; check result StrCmp $TempResult "1" ItIsWindowsXP IsIsNotWindowsXP ItIsWindowsXP: MessageBox MB_OK "This OS is Windows XP" Goto Go2 IsIsNotWindowsXP: MessageBox MB_OK "This OS is not Windows XP" Goto Go2 ; get Windows OS version info Go2: ; call plugin dll function Version::GetWindowsVersion ; get result Pop $MajorVersion Pop $MinorVersion Pop $BuildNumber Pop $PlatformID Pop $CSDVersion ; show result MessageBox MB_OK "$PlatformID-platform, version $MajorVersion.$MinorVersion, build $BuildNumber, $CSDVersion" FunctionEnd