Microsoft Installer MSI HasRelatedProduct Macro: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Renamed Macro per discussion in Talk page,) |
m (moved MSI RelativeInstalled to Microsoft Installer MSI HasRelatedProduct Macro: Macro was renamed) |
(No difference)
|
Latest revision as of 21:54, 20 April 2011
Author: Zinthose (talk, contrib) |
About
Short and simple macro to extend LogicLib to allow for testing the system for MSI packages that are installed with the same UpgradeCode as provided.
Example
## This example uses the MsiEnumRelatedProducts MSI API call to determine ## if an msi package on the same upgrade track as the provided GUID is ## installed. ${If} ${MSI_HasRelatedProduct} `{D8968392-698B-4A41-B6AD-C25C6608A69B}` DetailPrint "A product is installed on the same track." ${Else} DetailPrint "No product track is installed matching the the supplied GUID." ${EndIf}
Macro
!include "LogicLib.nsh" !define MSI_HasRelatedProduct `"" MSI_HasRelatedProduct` !macro _MSI_HasRelatedProduct _a _b _t _f !insertmacro _LOGICLIB_TEMP System::Call `Msi::MsiEnumRelatedProducts(&t39 '${_b}',i 0,i 0,&t39 n)i .s` Pop $_LOGICLIB_TEMP !insertmacro _== $_LOGICLIB_TEMP 0 `${_t}` `${_f}` !macroend
Issues
- Only tested on XP x86
- Requires Microsoft Installer to be previously installed. If it isn't then it's likely that no MSI packages are installed anyway ;-)