MsiOpenPackageExW function (msi.h)
The MsiOpenPackageEx function opens a package to use with functions that access the product database. The MsiCloseHandle function must be called with the handle when the handle is no longer needed.
UINT MsiOpenPackageExW( LPCWSTR szPackagePath, DWORD dwOptions, MSIHANDLE *hProduct );
The path to the package.
The bit flags to indicate whether or not to ignore the computer state. Pass in 0 (zero) to use MsiOpenPackage behavior.
||Ignore the computer state when creating the product handle.|
A pointer to a variable that receives the product handle.
||The configuration information is corrupt.|
||The product could not be opened.|
||Windows Installer does not permit installation from a remote desktop connection.|
||An invalid parameter is passed to the function.|
||The function completes successfully.|
If this function fails, it may return a system error code. For more information, see System Error Codes.
To create a restricted product handle that is independent of the current machine state and incapable of changing the current machine state, use MsiOpenPackageEx with MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE set in dwOptions.
Note that if dwOptions is MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE or 1, MsiOpenPackageEx ignores the current machine state when creating the product handle. If the value of dwOptions is 0, MsiOpenPackageEx is the same as MsiOpenPackage and creates a product handle that is dependent upon whether the package specified by szPackagePath is already installed on the computer.
The restricted handle created by using MsiOpenPackageEx with MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE only permits execution of dialogs, a subset of the standard actions, and custom actions that set properties ( Custom Action Type 35, Custom Action Type 51, and Custom Action Type 19). The restricted handle prevents the use of custom actions that run Dynamic-Link Libraries, Executable Files or Scripts.
You can call MsiDoAction on the following standard actions using the restricted handle. All other actions return ERROR_FUNCTION_NOT_CALLED if called with the restricted handle.
- AppSearch action
- IsolateComponents action
The msi.h header defines MsiOpenPackageEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.|