M
Mike Hixson
Im using the Windows Installer Automation Interface to do some
post-processing on a .msi file created with InstallShield. Im running
into problem with the Database object not releasing its lock on the
..msi file. I have 2 seperate functions in my JScript that call the
OpenDatabase method on the same .msi file. The second function always
fails, complaining that the file is already open, even though the
first Database object instace is gone (out of scope). My understanding
is that when the Database object instance goes out of scope, the file
lock should be released -- this is how it works with VBScript. I could
consolidate the 2 functions but the lock that is held by the Database
object causes problems in other parts of the script. Does anyone know
how to close the lock that the Database object has?
Here an example that can reproduce the problem. It attempts to open
the same file two consecutive times. The second one always fails
complaining that the file is locked.
ModifyDB(1);
ModifyDB(2);
function ModifyDB(i)
{
var oInstaller = new ActiveXObject("WindowsInstaller.Installer");
var oDatabase = oInstaller.OpenDatabase("c:\\setup.msi", 1);
oDatabase.Commit();
oDatabase = null;
WScript.Echo(i);
}
Regards,
Mike
post-processing on a .msi file created with InstallShield. Im running
into problem with the Database object not releasing its lock on the
..msi file. I have 2 seperate functions in my JScript that call the
OpenDatabase method on the same .msi file. The second function always
fails, complaining that the file is already open, even though the
first Database object instace is gone (out of scope). My understanding
is that when the Database object instance goes out of scope, the file
lock should be released -- this is how it works with VBScript. I could
consolidate the 2 functions but the lock that is held by the Database
object causes problems in other parts of the script. Does anyone know
how to close the lock that the Database object has?
Here an example that can reproduce the problem. It attempts to open
the same file two consecutive times. The second one always fails
complaining that the file is locked.
ModifyDB(1);
ModifyDB(2);
function ModifyDB(i)
{
var oInstaller = new ActiveXObject("WindowsInstaller.Installer");
var oDatabase = oInstaller.OpenDatabase("c:\\setup.msi", 1);
oDatabase.Commit();
oDatabase = null;
WScript.Echo(i);
}
Regards,
Mike