MsiCloseAllHandles function

The MsiCloseAllHandles function closes all open installation handles allocated by the current thread. This is a diagnostic function and should not be used for cleanup.


UINT MsiCloseAllHandles(



This function has no parameters.

Return Value

This function returns 0 if all handles are closed. Otherwise, the function returns the number of handles open prior to its call.


MsiCloseAllHandles only closes handles allocated by the calling thread, and does not affect handles allocated by other threads, such as the install handle passed to custom actions.

The MsiOpenPackage function opens a handle to a package and the MsiOpenProduct function opens a handle to a product. These function are for use with functions that access the product database.


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.
Target Platform Windows
Header msi.h
Library Msi.lib
DLL Msi.dll

See Also

Handle Management Functions