Detect MSI 3.1
From NSIS Wiki
(Redirected from Detect MSI 3 1)
Jump to navigationJump to search
Author: tdue (talk, contrib) |
Description
This function will check the version of the current Windows Installer, and will set a flag for the installer to update with a newer version if necessary. Currently the minimum version is 3.1 (required for Sql Server 2005), but this can be changed by altering the functions.
The Function
;********************************************************************* ; UpdateMSIVersion ; ; This function will check the version of the installed Windows ; Installer. This is done by checking the version of the ; $SYSDIR\MSI.dll (recommended method by the installer team). ; ; Usage ; Call UpdateMSIVersion ; Pop $MSI_UPDATE ; If $MSI_UPDATE is 1, install latest MSI. ;********************************************************************* Function UpdateMSIVersion GetDllVersion "$SYSDIR\MSI.dll" $R0 $R1 IntOp $R2 $R0 / 0x00010000 IntOp $R3 $R0 & 0x0000FFFF IntCmp $R2 3 0 InstallMSI RightMSI IntCmp $R3 1 RightMSI InstallMSI RightMSI RightMSI: Push 0 Goto ExitFunction InstallMSI: MessageBox MB_OK|MB_ICONEXCLAMATION \ "Windows Installer 3.1 was not detected; this is required for installation. \ Setup will install the Windows Installer. This may take awhile, please wait." Push 1 Goto ExitFunction ExitFunction: FunctionEnd