The MsiOpenPackage function opens a package to use with the functions that access the product database. The MsiCloseHandle function must be called with the handle when the handle is not needed.
Note Initialize COM on the same thread before calling the MsiOpenPackage, MsiOpenPackageEx, or MsiOpenProduct function.
Syntax
C++UINT MsiOpenPackage(
__in LPCTSTR szPackagePath,
__out MSIHANDLE *hProduct
);
Parameters
- szPackagePath [in]
-
The path to the package.
- hProduct [out]
-
A pointer to a variable that receives the product handle.
Return Value
Value | Meaning |
---|---|
|
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.
Remarks
MsiOpenPackage can accept an opened database handle in the form "#nnnn", where nnnn is the database handle in string form, i.e. #123, instead of a path to the package. This is intended for development tasks such as running validation actions, or for use with database management tools.
Requirements
Version | Windows Installer 5.0 on 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, Windows XP, and Windows 2000. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
---|---|
Header | Msi.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiOpenPackageW (Unicode) and MsiOpenPackageA (ANSI) |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.