Version: 1.0 (13/May/2004)
xtInfoPlugin determines version information for various components. This plug-in can gather the following:
All ID's are lowercase and no spaces - see the example with .onInit method (bottom of page).Functions Reference
xtInfoPlugin::CompareVersion
Compares two version numbers and outputs the result.
Syntax
Push "VersionNumber2" Push "VersionNumber1" xtInfoPlugin::CompareVersion Pop "ResultVar" Parameters
Push "2.5" Push "2.81.1117.0" xtInfoPlugin::CompareVersion Pop $0 ;$0 = "1"
Retrieves the ID number for the .NET Framework version installed in the computer.
xtInfoPlugin::GetDotNetFrameworkId Pop "ResultVar"
xtInfoPlugin::GetDotNetFrameworkId Pop $0 ;.NET Framework's ID number for its version
Retrieves the version of .NET Framework, if it is installed in the computer.
xtInfoPlugin::GetDotNetFrameworkVersion Pop "ResultVar"
xtInfoPlugin::GetDotNetFrameworkVersion Pop $0 ;.NET Framework's version
Retrieves the installer's file name without its path.
xtInfoPlugin::GetInstaller Pop "ResultVar"
xtInfoPlugin::GetInstaller Pop $0 ;Installer's file name without its path
Retrieves the installer's file name with its path.
xtInfoPlugin::GetInstallerFileName Pop "ResultVar"
xtInfoPlugin::GetInstallerFileName Pop $0 ;Installer's file name with its path
Retrieves the path to the installer's file.
xtInfoPlugin::GetInstallerFullPath Pop "ResultVar"
xtInfoPlugin::GetInstallerFullPath Pop $0 ;Path to the installer's file
Retrieves the ID number for the Internet Explorer version installed in the computer.
xtInfoPlugin::GetInternetExplorerId Pop "ResultVar"
xtInfoPlugin::GetInternetExplorerId Pop $0 ;Internet Explorer's ID number for its version
Retrieves the version of Internet Explorer, if it is installed in the computer.
xtInfoPlugin::GetInternetExplorerVersion Pop "ResultVar"
xtInfoPlugin::GetInternetExplorerVersion Pop $0 ;Internet Explorer's version
Retrieves the Windows system language, if it is installed in the computer.
xtInfoPlugin::GetLanguage Pop "ResultVar"
xtInfoPlugin::GetLanguage Pop $0 ;Windows system language
Retrieves the ID number for the MDAC version installed in the computer.
xtInfoPlugin::GetMDACId Pop "ResultVar"
xtInfoPlugin::GetMDACId Pop $0 ;MDAC's ID number for its version
Retrieves the version of MDAC, if it is installed in the computer.
xtInfoPlugin::GetMDACVersion Pop "ResultVar"
xtInfoPlugin::GetMDACVersion Pop $1 ;MDAC's version
Retrieves the ID number for the OLEDB version installed in the computer.
xtInfoPlugin::GetOLEDBId Pop "ResultVar"
xtInfoPlugin::GetOLEDBId Pop $0 ;OLEDB's ID number for its version
Retrieves the version of OLEDB, if it is installed in the computer.
xtInfoPlugin::GetOLEDBVersion Pop "ResultVar"
xtInfoPlugin::GetOLEDBVersion Pop $1 ;OLEDB's version
Retrieves the ID number for the Windows version installed in the computer.
xtInfoPlugin::GetWindowsId Pop "ResultVar"
xtInfoPlugin::GetWindowsId Pop $0 ;Windows' ID number for its version
Retrieves the ID number for the Windows Service Pack version installed in the computer.
xtInfoPlugin::GetWindowsServicePackId Pop "ResultVar"
xtInfoPlugin::GetWindowsServicePackId Pop $0 ;Windows Service Pack's ID number for its version
Retrieves the version of Windows, if it is installed in the computer.
xtInfoPlugin::GetWindowsVersion Pop "ResultVar"
xtInfoPlugin::GetWindowsVersion Pop $1 ;Windows's version
Detects if the current user has administrator rights.
xtInfoPlugin::IsAdministrator Pop "ResultVar"
xtInfoPlugin::IsAdministrator Pop $0 ;"true" if the current user has administrator rights, otherwise it is "false"
Detects if .NET Framework is installed in the computer.
xtInfoPlugin::IsDotNetFrameworkInstalled Pop "ResultVar"
xtInfoPlugin::IsDotNetFrameworkInstalled Pop $0 ;"true" if it is installed, otherwise it is "false"
Detects if .NET Framework is installed in the computer.
xtInfoPlugin::IsDotNetFrameworkInstalled Pop "ResultVar"
xtInfoPlugin::IsDotNetFrameworkInstalled Pop $0 ;"true" if it is installed, otherwise it is "false"
Detects if the XXXX version of Windows is installed in the computer. Replace "XXXX" with either:
xtInfoPlugin::IsWindowsXXXX ;Replace "XXXX" with Windows versions on the list above. Pop "ResultVar"
xtInfoPlugin::IsWindows2003 Pop $0 ;"true" if Windows 2003 is installed, otherwise it is "false"
; Download xtInfoPlugin from ; http://www.razormotion.com/nsis/xtInfoPlugin.zip ; best to copy xtInfoPlugin.dll to NSIS\Plugins and remove below code !addplugindir ".\" ; detect xtInfoPlugin.dll in current directory !addplugindir "..\" ; detect xtInfoPlugin.dll in parent directory Name "NSIS xtInfoPlugin-MinimalExample" OutFile "xtInfoPlugin-MinimalExample.exe" SetCompress off ; Useful to disable compression under development !include "${NSISDIR}\Include\MUI.nsh" !include "${NSISDIR}\Include\LogicLib.nsh" ? Function .onInit ? ; CompareVersion example ; (C++)CompareVersion("2.50.4403.9","2.50.4403.9") return 0 (a==b) ; (C++)CompareVersion("2.50.4403.9","2.71.9030.0") return 1 (b>a) ; (C++)CompareVersion("2.71.9030.0","2.50.4403.9") return -1 (a>b) ? StrCpy $2 "2.5" Push $2 xtInfoPlugin::GetMDACVersion Pop $1 Push $1 xtInfoPlugin::CompareVersion Pop $0 ${if} $0 >= 0 MessageBox MB_OK "MDAC version is Newer or Equal to $2 (found: $1)" ${else} MessageBox MB_OK "MDAC version is OLDER than $2 (found: $1)" ${endif} ? ; --------------------------------------------------------------------- ? ; Say we want our application to only work with .NET Framework v1.1 ? xtInfoPlugin::IsDotNetFrameworkInstalled Pop $0 ${if} $0 == true xtInfoPlugin::GetDotNetFrameworkId ; GetDotNetFrameworkId (id methods) return x.x and not build info Pop $0 ${if} $0 == "1.1" StrCpy $0 "Version 1.1 Installed" ${else} StrCpy $0 "Version 1.0 Installed" ${endif} ${else} StrCpy $0 "Not installed" ${endif} xtInfoPlugin::GetDotNetFrameworkVersion Pop $1 MessageBox MB_OK ".NET Framework version check = $0 (found: $1)" Quit ; Quit before installer start ? FunctionEnd ? ; Required by NSIS, we don't need it! Section SectionEnd