Detect MSI 3.1: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
No edit summary
Line 1: Line 1:
;*********************************************************************
{{PageAuthor|tdue}}
 
== 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.
 
-m-
 
== The Function ==
<highlight-nsis>;*********************************************************************
; UpdateMSIVersion
; UpdateMSIVersion
;
;
Line 32: Line 40:
    
    
FunctionEnd
FunctionEnd
</highlight-nsis>
[[Category:Other Products Version Detection Functions]]

Revision as of 12:48, 19 July 2007

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.

-m-

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