2001-05-18 14:22:54 +04:00
|
|
|
function registerMainKeys(winreg)
|
|
|
|
{
|
|
|
|
var subkey; //the name of the subkey you are poking around in
|
|
|
|
var valname; //the name of the value you want to look at
|
|
|
|
var value; //the data in the value you want to look at.
|
|
|
|
var err;
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "CurrentVersion";
|
|
|
|
value = "$UserAgent$";
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "Install Directory";
|
|
|
|
value = fProgram;
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Uninstall";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "Uninstall Log Folder";
|
|
|
|
value = szUninstall;
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
|
|
|
|
valname = "Description";
|
|
|
|
value = "$ProductName$ ($UserAgentShort$)";
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
}
|
|
|
|
|
2000-04-19 04:51:00 +04:00
|
|
|
function updateWinReg()
|
|
|
|
{
|
|
|
|
//Notes:
|
|
|
|
// can't use a double backslash before subkey - Windows already puts it in.
|
|
|
|
// subkeys have to exist before values can be put in.
|
|
|
|
var winreg = getWinRegistry();
|
|
|
|
var subkey; //the name of the subkey you are poking around in
|
2001-05-18 14:22:54 +04:00
|
|
|
var valname; //the name of the value you want to look at
|
2000-04-19 04:51:00 +04:00
|
|
|
var value; //the data in the value you want to look at.
|
2001-05-19 08:18:46 +04:00
|
|
|
var restrictedAccess;
|
|
|
|
var ikwDefined;
|
2000-04-19 04:51:00 +04:00
|
|
|
|
|
|
|
if(winreg != null)
|
|
|
|
{
|
2001-05-18 14:22:54 +04:00
|
|
|
/* This will check to see if the user has restricted access or not.
|
|
|
|
* It checks to see if HKEY_LOCALMACHINE\SOFTWARE is writable. If
|
|
|
|
* it is, then access is not restricted. This is only used to
|
|
|
|
* determine which Desktop, Programs, and Start Menu folders
|
|
|
|
* are to used: common or per user
|
|
|
|
*/
|
2001-05-19 08:18:46 +04:00
|
|
|
restrictedAccess = false;
|
|
|
|
ikwDefined = typeof(winreg.isKeyWritable);
|
|
|
|
logComment("winreg.isKeyWritable(): " + ikwDefined);
|
|
|
|
if(ikwDefined == "function")
|
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
if(!winreg.isKeyWritable("SOFTWARE"))
|
|
|
|
restrictedAccess = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
logComment("restrictedAccess value: " + restrictedAccess);
|
|
|
|
if(!restrictedAccess)
|
2001-05-18 14:22:54 +04:00
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
registerMainKeys(winreg);
|
|
|
|
}
|
2000-04-19 04:51:00 +04:00
|
|
|
|
2001-05-18 14:22:54 +04:00
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
|
|
registerMainKeys(winreg);
|
2000-04-19 04:51:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-23 04:15:55 +04:00
|
|
|
function upgradeCleanup()
|
|
|
|
{
|
2001-05-26 03:01:29 +04:00
|
|
|
deleteThisFile("Program", "component.reg");
|
|
|
|
deleteThisFile("Components", "xpti.dat");
|
|
|
|
deleteThisFile("Components", "xptitemp.dat");
|
2001-05-23 04:15:55 +04:00
|
|
|
}
|
|
|
|
|
2000-04-19 04:51:00 +04:00
|
|
|
// main
|
|
|
|
var srDest;
|
|
|
|
var err;
|
|
|
|
var szUninstall;
|
2000-05-24 18:08:46 +04:00
|
|
|
var fProgram;
|
2000-04-19 04:51:00 +04:00
|
|
|
var fWindowsSystem;
|
2000-05-08 08:11:30 +04:00
|
|
|
var fileTemp;
|
2000-04-19 04:51:00 +04:00
|
|
|
var fileComponentReg;
|
|
|
|
var fileComponentRegStr;
|
2000-05-08 08:11:30 +04:00
|
|
|
var fileMsvcrt;
|
|
|
|
var fileMsvcirt;
|
2000-04-19 04:51:00 +04:00
|
|
|
|
2000-12-15 02:33:37 +03:00
|
|
|
$Ren8dot3List$
|
|
|
|
|
2000-04-19 04:51:00 +04:00
|
|
|
srDest = $SpaceRequired$:bin;
|
2000-05-24 18:08:46 +04:00
|
|
|
err = initInstall("Mozilla XPCom", "XPCom", "$Version$");
|
|
|
|
logComment("initInstall: " + err);
|
2000-04-19 04:51:00 +04:00
|
|
|
|
2000-05-24 18:08:46 +04:00
|
|
|
fProgram = getFolder("Program");
|
2000-04-19 04:51:00 +04:00
|
|
|
fWindowsSystem = getFolder("Win System");
|
2000-05-24 18:08:46 +04:00
|
|
|
logComment("fProgram: " + fProgram);
|
2000-04-19 04:51:00 +04:00
|
|
|
|
|
|
|
// build the uninstall folder path
|
2000-05-24 18:08:46 +04:00
|
|
|
szUninstall = fProgram + "Uninstall";
|
2000-04-19 04:51:00 +04:00
|
|
|
|
2000-05-05 07:07:05 +04:00
|
|
|
// Log component.reg file so it can be deleted by the uninstaller.
|
2000-04-19 04:51:00 +04:00
|
|
|
// These two files are created after installation is done, thus
|
|
|
|
// are normally not logged for uninstall.
|
2000-05-24 18:08:46 +04:00
|
|
|
logComment("Installing: " + fProgram + "component.reg");
|
2000-04-19 04:51:00 +04:00
|
|
|
|
2000-07-24 13:09:29 +04:00
|
|
|
if(verifyDiskSpace(fProgram, srDest))
|
2000-04-19 04:51:00 +04:00
|
|
|
{
|
2000-05-24 18:08:46 +04:00
|
|
|
setPackageFolder(fProgram);
|
2000-12-15 02:33:37 +03:00
|
|
|
|
|
|
|
$Ren8dot3Call$
|
|
|
|
|
2001-11-10 03:41:16 +03:00
|
|
|
upgradeCleanup();
|
2000-04-19 04:51:00 +04:00
|
|
|
err = addDirectory("",
|
|
|
|
"$Version$",
|
|
|
|
"bin", // dir name in jar to extract
|
2000-05-24 18:08:46 +04:00
|
|
|
fProgram, // Where to put this file (Returned from GetFolder)
|
|
|
|
"", // subdir name to create relative to fProgram
|
2000-04-19 04:51:00 +04:00
|
|
|
true); // Force Flag
|
|
|
|
logComment("addDirectory() of Program returned: " + err);
|
|
|
|
|
2000-05-24 18:08:46 +04:00
|
|
|
if( err == SUCCESS )
|
2000-05-08 08:11:30 +04:00
|
|
|
{
|
|
|
|
// install msvcrt.dll *only* if it does not exist
|
|
|
|
// we don't care if addFile() fails (if the file does not exist in the archive)
|
|
|
|
// bacause it will still install
|
|
|
|
fileTemp = fWindowsSystem + "msvcrt.dll";
|
|
|
|
fileMsvcrt = getFolder("file:///", fileTemp);
|
|
|
|
rv = File.exists(fileMsvcrt);
|
|
|
|
logComment("fileExists() returned: " + rv);
|
|
|
|
if(rv == false)
|
|
|
|
{
|
|
|
|
logComment("File not found: " + fileMsvcrt);
|
|
|
|
addFile("/Microsoft/Shared",
|
|
|
|
"$Version$",
|
|
|
|
"msvcrt.dll", // dir name in jar to extract
|
|
|
|
fWindowsSystem, // Where to put this file (Returned from getFolder)
|
2000-05-24 18:08:46 +04:00
|
|
|
"", // subdir name to create relative to fProgram
|
2000-05-15 10:16:26 +04:00
|
|
|
WIN_SHARED_FILE);
|
2000-05-08 08:11:30 +04:00
|
|
|
logComment("addFile() of msvcrt.dll returned: " + err);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logComment("File found: " + fileMsvcrt);
|
|
|
|
}
|
|
|
|
|
|
|
|
// install msvcirt.dll *only* if it does not exist
|
|
|
|
// we don't care if addFile() fails (if the file does not exist in the archive)
|
|
|
|
// bacause it will still install
|
|
|
|
fileTemp = fWindowsSystem + "msvcirt.dll";
|
|
|
|
fileMsvcirt = getFolder("file:///", fileTemp);
|
|
|
|
rv = File.exists(fileMsvcirt);
|
|
|
|
logComment("fileExists() returned: " + rv);
|
|
|
|
if(rv == false)
|
|
|
|
{
|
|
|
|
logComment("File not found: " + fileMsvcirt);
|
|
|
|
addFile("/Microsoft/Shared",
|
|
|
|
"$Version$",
|
|
|
|
"msvcirt.dll", // dir name in jar to extract
|
|
|
|
fWindowsSystem, // Where to put this file (Returned from getFolder)
|
2000-05-24 18:08:46 +04:00
|
|
|
"", // subdir name to create relative to fProgram
|
2000-05-15 10:16:26 +04:00
|
|
|
WIN_SHARED_FILE);
|
2000-05-08 08:11:30 +04:00
|
|
|
logComment("addFile() of msvcirt.dll returned: " + err);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logComment("File found: " + fileMsvcirt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-19 04:51:00 +04:00
|
|
|
// check return value
|
2000-05-24 18:08:46 +04:00
|
|
|
if( err == SUCCESS )
|
2000-04-19 04:51:00 +04:00
|
|
|
{
|
|
|
|
updateWinReg();
|
|
|
|
|
2000-05-24 18:08:46 +04:00
|
|
|
err = performInstall();
|
|
|
|
logComment("performInstall() returned: " + err);
|
2000-04-19 04:51:00 +04:00
|
|
|
}
|
2000-05-24 18:08:46 +04:00
|
|
|
else
|
|
|
|
cancelInstall(err);
|
2000-04-19 04:51:00 +04:00
|
|
|
}
|
2000-05-24 18:08:46 +04:00
|
|
|
else
|
|
|
|
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
|
|
|
|
2000-04-19 04:51:00 +04:00
|
|
|
|
|
|
|
// end main
|
|
|
|
|