Commit 9c892430 authored by Octavian Voicu's avatar Octavian Voicu Committed by Alexandre Julliard

msi: Fix crash when calling MsiGetActiveDatabase with invalid remote handle.

parent 1b4bacea
...@@ -1357,6 +1357,7 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) ...@@ -1357,6 +1357,7 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
{ {
MSIPACKAGE *package; MSIPACKAGE *package;
MSIHANDLE handle = 0; MSIHANDLE handle = 0;
IUnknown *remote_unk;
IWineMsiRemotePackage *remote_package; IWineMsiRemotePackage *remote_package;
TRACE("(%d)\n",hInstall); TRACE("(%d)\n",hInstall);
...@@ -1367,10 +1368,19 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) ...@@ -1367,10 +1368,19 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
handle = alloc_msihandle( &package->db->hdr ); handle = alloc_msihandle( &package->db->hdr );
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
} }
else if ((remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ))) else if ((remote_unk = msi_get_remote(hInstall)))
{ {
IWineMsiRemotePackage_GetActiveDatabase(remote_package, &handle); if (IUnknown_QueryInterface(remote_unk, &IID_IWineMsiRemotePackage,
IWineMsiRemotePackage_Release(remote_package); (LPVOID *)&remote_package) == S_OK)
{
IWineMsiRemotePackage_GetActiveDatabase(remote_package, &handle);
IWineMsiRemotePackage_Release(remote_package);
}
else
{
WARN("remote handle %d is not a package\n", hInstall);
}
IUnknown_Release(remote_unk);
} }
return handle; return handle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment