Hello,
I'm maintaining some build scripts that munge MSI databases from Javascript files (.js). The code is basically:
{
var oTargetDB = g_oInstaller.openDatabase("mymsi.msi", msiOpenDatabaseModeReadOnly);
var oView = oTargetDB.openView(...);
oView.execute();
oView.close();
}
// Later...
{
var oTargetDB = g_oInstaller.openDatabase("mymsi.msi", msiOpenDatabaseModeTransact);
}
The second openDatabase fails with the ever-helpful 0x80004005 (E_FAIL), which I assume is because the first one is not closed. However, the Database object has no close method. I tried oTargetDB=null - didn't change anything.
What can I do to close the database, so I can open it again?
Edit:
- I see the handle open using handle.exe from sysinternals, so it's definately the problem
- Delay didn't help (I tried waiting for a really long time, and it didn't help)
- Short-lived script isn't an option due to the existing script structure
- Uber-hacking is beyond the scope of this fix
- I'll have to uglify my code and go with the (pseudo-singleton) solution. Blergh.