mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 19:38:13 +00:00
186 lines
4.9 KiB
Plaintext
186 lines
4.9 KiB
Plaintext
function IsWinnt()
|
|
{
|
|
/* Determines if the script is running under NT or not.
|
|
*
|
|
*/
|
|
var winreg = getWinRegistry();
|
|
var subkey;
|
|
var valname;
|
|
var szCurrentVersion;
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
|
valname = "CurrentVersion";
|
|
szCurrentVersion = winreg.getValueString(subkey, valname);
|
|
logComment("szCurrentVersion: " + szCurrentVersion);
|
|
if((szCurrentVersion == "") || (szCurrentVersion == null))
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function registerKeys()
|
|
{
|
|
var subkey; //the name of the subkey you are poking around in
|
|
var err;
|
|
var winreg;
|
|
var tmpstr;
|
|
|
|
winreg = getWinRegistry();
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
createRootRegKey(winreg);
|
|
registerMainKeys(winreg);
|
|
registerMozillaKeys(winreg);
|
|
}
|
|
|
|
function createRootRegKey(winreg)
|
|
{
|
|
var subkey;
|
|
var tmpstr;
|
|
var tmpstr2;
|
|
var index;
|
|
|
|
tmpstr = new String(regRootKey);
|
|
index = tmpstr.indexOf("\\");
|
|
subkey = "";
|
|
|
|
while(index > 0)
|
|
{
|
|
subkey = subkey + tmpstr.substring(0, index);
|
|
winreg.createKey(subkey,"");
|
|
|
|
tmpstr2 = tmpstr.substring(index+1, tmpstr.length);
|
|
tmpstr = new String(tmpstr2);
|
|
|
|
index = tmpstr.indexOf("\\");
|
|
subkey = subkey + "\\";
|
|
}
|
|
|
|
if(tmpstr.length > 0)
|
|
{
|
|
subkey = subkey + tmpstr;
|
|
logComment("subkey: " + subkey);
|
|
winreg.createKey(subkey,"");
|
|
}
|
|
|
|
winreg.createKey(subkey + "\\$UserAgent$","");
|
|
}
|
|
|
|
function registerMainKeys(winreg)
|
|
{
|
|
var subkey; //the name of the subkey you are poking around in
|
|
var err;
|
|
|
|
err = winreg.setValueString(regRootKey, "CurrentVersion", "$UserAgent$");
|
|
|
|
winreg.createKey(regRootKey + "\\$UserAgent$", "");
|
|
|
|
subkey = regRootKey + "\\$UserAgent$\\Main";
|
|
winreg.createKey(subkey,"");
|
|
err = winreg.setValueString(subkey, "Install Directory", fProgram);
|
|
|
|
subkey = regRootKey + "\\$UserAgent$\\Uninstall";
|
|
winreg.createKey(subkey,"");
|
|
err = winreg.setValueString(subkey, "Uninstall Log Folder", fProgram + "Uninstall");
|
|
err = winreg.setValueString(subkey, "Description", "$ProductName$ ($UserAgentShort$)");
|
|
}
|
|
|
|
function registerMozillaKeys(winreg)
|
|
{
|
|
var regKey;
|
|
var subkey; //the name of the subkey you are poking around in
|
|
var err;
|
|
|
|
regKey = "Software\\Mozilla";
|
|
winreg.createKey(regKey, "");
|
|
winreg.createKey(regKey + "\\MfcEmbed $UserAgent$", "");
|
|
|
|
subkey = regKey + "\\MfcEmbed $UserAgent$\\bin";
|
|
winreg.createKey(subkey, "");
|
|
err = winreg.setValueString(subkey, "PathToExe", fProgram + "$MainExeFile$");
|
|
|
|
subkey = regKey + "\\MfcEmbed $UserAgent$\\Extensions";
|
|
winreg.createKey(subkey, "");
|
|
err = winreg.setValueString(subkey, "Components", fProgram + "\\Components");
|
|
err = winreg.setValueString(subkey, "Plugins", fProgram + "\\Plugins");
|
|
}
|
|
|
|
// main
|
|
var srDest;
|
|
var err;
|
|
var err2;
|
|
var fProgram;
|
|
var fSubdir;
|
|
var fWindowsSystem;
|
|
var fileComponentRegStr;
|
|
var fileComponentReg;
|
|
var restrictedAccess;
|
|
var fileToRegister;
|
|
var regRootKey;
|
|
|
|
regRootKey = new String("Software\\$CompanyName$\\MFCEmbed");
|
|
|
|
srDest = $SpaceRequired$:bin;
|
|
err = initInstall("$ProductName$", "MFCEmbed", "$Version$");
|
|
logComment("initInstall: " + err);
|
|
|
|
fProgram = getFolder("Program");
|
|
logComment("fProgram: " + fProgram);
|
|
|
|
if(verifyDiskSpace(fProgram, srDest))
|
|
{
|
|
setPackageFolder(fProgram);
|
|
|
|
err = addDirectory("",
|
|
"",
|
|
"gre_app_support", // dir name in jar to extract
|
|
fProgram, // Where to put this file (Returned from GetFolder)
|
|
"", // subdir name to create relative to fProgram
|
|
true); // Force Flag
|
|
logComment("addDirectory() of Program returned: " + err);
|
|
|
|
err = addDirectory("",
|
|
"",
|
|
"Embed", // dir name in jar to extract
|
|
fProgram, // Where to put this file (Returned from GetFolder)
|
|
"", // subdir name to create relative to fProgram
|
|
true); // Force Flag
|
|
logComment("addDirectory() of Program returned: " + err);
|
|
|
|
fSubdir = getFolder("Program", "plugins");
|
|
File.dirCreate(fSubdir);
|
|
|
|
fSubdir = getFolder("Program", "components");
|
|
File.dirCreate(fSubdir);
|
|
|
|
// Let the uninstaller know about this generated file.
|
|
logComment("Installing: " + fProgram + ".autoreg");
|
|
logComment("Create Folder: " + fProgram + "components");
|
|
logComment("Installing: " + fProgram + "components\\xpti.dat");
|
|
logComment("Installing: " + fProgram + "components\\xptitemp.dat");
|
|
logComment("Installing: " + fProgram + "components\\compreg.dat");
|
|
|
|
// check return value
|
|
if( err == SUCCESS )
|
|
{
|
|
registerKeys();
|
|
// // we don't want to fail on errors for the above
|
|
// resetError();
|
|
|
|
err = performInstall();
|
|
logComment("performInstall() returned: " + err);
|
|
}
|
|
else
|
|
cancelInstall(err);
|
|
}
|
|
else
|
|
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
|
|
|
|
|
// end main
|