2001-05-18 14:22:54 +04:00
|
|
|
function registerProgramFolderKey(winreg, fFolderPath)
|
|
|
|
{
|
|
|
|
var subkey;
|
|
|
|
var valname;
|
|
|
|
var value;
|
|
|
|
var err;
|
|
|
|
|
|
|
|
/* set the Program Folder Path in the Mozilla key in the Windows Registry */
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$";
|
|
|
|
winreg.createKey(subkey,"");
|
|
|
|
|
|
|
|
valname = "CurrentVersion";
|
|
|
|
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 = "Program Folder Path";
|
|
|
|
value = fFolderPath;
|
|
|
|
err = winreg.setValueString(subkey, valname, value);
|
|
|
|
}
|
|
|
|
|
2001-03-14 03:24:23 +03:00
|
|
|
function createShortcuts()
|
|
|
|
{
|
|
|
|
var subkey;
|
|
|
|
var valname;
|
|
|
|
var szStartMenuPrograms;
|
|
|
|
var szStartMenu;
|
|
|
|
var szFolderDesktop;
|
|
|
|
var szFolderQuickLaunch;
|
|
|
|
var szFolderSendTo;
|
|
|
|
var winreg;
|
|
|
|
var fWindows;
|
|
|
|
var fTemp;
|
|
|
|
var fProgram;
|
|
|
|
var fileExe;
|
|
|
|
var scExeDesc;
|
|
|
|
var scProfileDesc;
|
|
|
|
var scProfileDescParam;
|
|
|
|
var scFolderName;
|
|
|
|
var fFolderDesktop;
|
|
|
|
var fFolderPath;
|
|
|
|
var fFolderPathStr;
|
|
|
|
var is_winnt;
|
|
|
|
var szCurrentVersion;
|
2001-05-18 14:22:54 +04:00
|
|
|
var restrictedAccess;
|
2001-05-19 08:18:46 +04:00
|
|
|
var ikwDefined;
|
2001-03-14 03:24:23 +03:00
|
|
|
|
|
|
|
winreg = getWinRegistry();
|
|
|
|
fWindows = getFolder("Windows");
|
|
|
|
fProgram = getFolder("Program");
|
|
|
|
fTemp = fProgram + "$MainExeFile$";
|
|
|
|
fileExe = getFolder("file:///", fTemp);
|
|
|
|
scExeDesc = "Mail";
|
|
|
|
scParam = "-mail";
|
|
|
|
scFolderName = "$ProductName$";
|
|
|
|
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;
|
|
|
|
}
|
2001-05-18 14:22:54 +04:00
|
|
|
|
2001-03-14 03:24:23 +03:00
|
|
|
/* determine if the script is running under NT or not */
|
|
|
|
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))
|
|
|
|
{
|
|
|
|
is_winnt = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
is_winnt = true;
|
|
|
|
}
|
|
|
|
|
2001-05-18 14:22:54 +04:00
|
|
|
logComment("is_winnt value: " + is_winnt);
|
|
|
|
logComment("restrictedAccess value: " + restrictedAccess);
|
|
|
|
if(!is_winnt || restrictedAccess)
|
2001-03-14 03:24:23 +03:00
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
|
|
valname = "Programs";
|
|
|
|
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
|
|
|
valname = "Start Menu";
|
|
|
|
szStartMenu = winreg.getValueString(subkey, valname);
|
|
|
|
valname = "Desktop";
|
|
|
|
szFolderDesktop = winreg.getValueString(subkey, valname);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
|
|
valname = "Common Programs";
|
|
|
|
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
|
|
|
valname = "Common Start Menu";
|
|
|
|
szStartMenu = winreg.getValueString(subkey, valname);
|
|
|
|
valname = "Common Desktop";
|
|
|
|
szFolderDesktop = winreg.getValueString(subkey, valname);
|
|
|
|
}
|
|
|
|
|
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
|
|
|
valname = "SendTo";
|
|
|
|
szFolderSendTo = winreg.getValueString(subkey, valname);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups";
|
|
|
|
valname = "Quick Launch";
|
|
|
|
szFolderQuickLaunch = winreg.getValueString(subkey, valname);
|
|
|
|
|
|
|
|
subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main";
|
|
|
|
valname = "Program Folder Path";
|
|
|
|
fFolderPathStr = winreg.getValueString(subkey, valname);
|
|
|
|
if((fFolderPathStr == "") || (fFolderPathStr == null))
|
|
|
|
{
|
|
|
|
fTemp = szStartMenuPrograms + "\\" + scFolderName;
|
|
|
|
fFolderPath = getFolder("file:///", fTemp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* convert the path string to a path folder object */
|
|
|
|
fFolderPath = getFolder("file:///", fFolderPathStr);
|
|
|
|
}
|
|
|
|
/* convert the path string to a path folder object */
|
|
|
|
fFolderDesktop = getFolder("file:///", szFolderDesktop);
|
|
|
|
|
|
|
|
logComment("Folder StartMenuPrograms: " + szStartMenuPrograms);
|
|
|
|
logComment("Folder StartMenu : " + szStartMenu);
|
|
|
|
logComment("Folder FolderDesktop : " + szFolderDesktop);
|
|
|
|
logComment("Folder FolderSendTo : " + szFolderSendTo);
|
|
|
|
logComment("Folder FolderQuickLaunch: " + szFolderQuickLaunch);
|
|
|
|
logComment("fileExe : " + fileExe);
|
|
|
|
logComment("fFolderPath : " + fFolderPath);
|
|
|
|
logComment("scExeDesc : " + scExeDesc);
|
|
|
|
logComment("fProgram : " + fProgram);
|
|
|
|
|
|
|
|
/* explicitly create the fFolderPath even though the windowsShortcut function creates the folder.
|
|
|
|
* This is so that the folder creation gets logged for uninstall to remove it. */
|
2001-05-18 14:22:54 +04:00
|
|
|
if(!File.exists(fFolderPath))
|
|
|
|
File.dirCreate(fFolderPath);
|
2001-03-14 03:24:23 +03:00
|
|
|
|
|
|
|
/* create the shortcuts */
|
|
|
|
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fProgram, scParam, fileExe, 0);
|
|
|
|
|
2001-05-18 14:22:54 +04:00
|
|
|
if(!restrictedAccess)
|
|
|
|
{
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
registerProgramFolderKey(winreg, fFolderPath);
|
|
|
|
}
|
2001-03-14 03:24:23 +03:00
|
|
|
|
2001-05-18 14:22:54 +04:00
|
|
|
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
|
|
|
registerProgramFolderKey(winreg, fFolderPath);
|
2001-03-14 03:24:23 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logComment("winreg is null");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-10 05:03:42 +04:00
|
|
|
function updateMapi()
|
|
|
|
{
|
|
|
|
var winreg;
|
|
|
|
var szValue;
|
|
|
|
var szMapiBackupDll;
|
|
|
|
var szDefaultMailClient;
|
|
|
|
var programMozMapi32File;
|
|
|
|
var mainExePath;
|
|
|
|
var sfpProgramMozMapi32File;
|
|
|
|
var sfpMainExePath;
|
|
|
|
var winsysMapi32File;
|
|
|
|
|
|
|
|
winreg = getWinRegistry();
|
|
|
|
if(winreg != null)
|
|
|
|
{
|
|
|
|
mainExePath = getFolder("Program", "$MainExeFile$");
|
|
|
|
programMozMapi32File = getFolder("Program", "mozMapi32.dll");
|
|
|
|
winsysMapi32File = getFolder("Win System", "Mapi32.dll");
|
|
|
|
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
|
|
|
|
|
|
|
// If Mapi_backup_dll *and* the default var of
|
|
|
|
// HKEY_LOCAL_MACHINE\Software\Clients\Mail is set, then install
|
|
|
|
// mozMapi32.dll to the windows system dir as Mapi32.dll.
|
|
|
|
szMapiBackupDll = winreg.getValueString("SOFTWARE\\Mozilla\\Desktop", "Mapi_backup_dll");
|
|
|
|
szDefaultMailClient = winreg.getValueString("SOFTWARE\\Clients\\Mail", "");
|
|
|
|
logComment("szMapiBackupDll: " + szMapiBackupDll);
|
|
|
|
logComment("szDefaultMailClient: " + szDefaultMailClient);
|
|
|
|
if((szMapiBackupDll != null) && (szMapiBackupDll != "") &&
|
|
|
|
(szDefaultMailClient != null) && (szDefaultMailClient == "$ProductName$"))
|
|
|
|
{
|
|
|
|
// We do not want to log this file to be uninstalled because the
|
|
|
|
// uninstaller already has a special way to deal with restoring the
|
|
|
|
// appropriate previous Mapi32.dll.
|
|
|
|
addFile("",
|
|
|
|
"$Version$",
|
|
|
|
"bin/mozMapi32.dll", // file name in jar to extract
|
|
|
|
getFolder("Win System"), // Where to put this file (Returned from getFolder)
|
|
|
|
"Mapi32.dll", // new name when installed
|
|
|
|
DO_NOT_UNINSTALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
sfpProgramMozMapi32File = File.windowsGetShortName(programMozMapi32File);
|
|
|
|
sfpMainExePath = File.windowsGetShortName(mainExePath);
|
|
|
|
|
|
|
|
szValue = winreg.getValueString("SOFTWARE\\Clients\\Mail\\$ProductName$", "DLLPath");
|
|
|
|
if((szValue != null) && (szValue != ""))
|
|
|
|
winreg.setValueString("SOFTWARE\\Clients\\Mail", "DLLPath", sfpProgramMozMapi32File);
|
|
|
|
|
|
|
|
szValue = winreg.getValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\DefaultIcon", "");
|
|
|
|
if((szValue != null) && (szValue != ""))
|
|
|
|
winreg.setValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\DefaultIcon",
|
|
|
|
"",
|
|
|
|
+ sfpMainExePath + ",0");
|
|
|
|
|
|
|
|
szValue = winreg.getValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell\\open\\command", "");
|
|
|
|
if((szValue != null) && (szValue != ""))
|
|
|
|
winreg.setValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell\\open\\command",
|
|
|
|
"",
|
|
|
|
sfpMainExePath + " \"%1\"");
|
|
|
|
|
|
|
|
szValue = winreg.getValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\shell\\open\\command", "");
|
|
|
|
if((szValue != null) && (szValue != ""))
|
|
|
|
winreg.setValueString("SOFTWARE\\Clients\\Mail\\$ProductName$\\shell\\open\\command",
|
|
|
|
"",
|
|
|
|
sfpMainExePath + " -mail");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-24 12:07:52 +04:00
|
|
|
function upgradeCleanup()
|
|
|
|
{
|
2001-05-26 03:01:29 +04:00
|
|
|
// Obsolete files from Netscape 6.0 and Netscape 6.01 that
|
|
|
|
// need to be cleaned up.
|
|
|
|
deleteThisFile("Components", "signed.dll");
|
2001-05-24 12:07:52 +04:00
|
|
|
}
|
|
|
|
|
2001-10-09 05:20:29 +04:00
|
|
|
function updateWinIni()
|
|
|
|
{
|
|
|
|
var fWinIni = getWinProfile(getFolder("Windows"), "win.ini");
|
|
|
|
|
|
|
|
fWinIni.writeString("Mail", "MAPI", "1");
|
|
|
|
fWinIni.writeString("Mail", "CMCDLLNAME32", "MAPI32.DLL");
|
|
|
|
}
|
|
|
|
|
1999-11-23 01:50:30 +03:00
|
|
|
// main
|
|
|
|
var srDest;
|
|
|
|
var err;
|
2000-05-24 18:08:46 +04:00
|
|
|
var fProgram;
|
1999-09-15 00:50:22 +04:00
|
|
|
|
2000-12-15 02:33:37 +03:00
|
|
|
$Ren8dot3List$
|
2000-10-17 05:29:19 +04:00
|
|
|
|
1999-11-23 01:50:30 +03:00
|
|
|
srDest = $SpaceRequired$:bin;
|
2000-05-24 18:08:46 +04:00
|
|
|
err = initInstall("Mozilla Mail", "Mail", "$Version$");
|
|
|
|
logComment("initInstall: " + err);
|
1999-09-15 00:50:22 +04:00
|
|
|
|
2000-05-24 18:08:46 +04:00
|
|
|
fProgram = getFolder("Program");
|
|
|
|
logComment("fProgram: " + fProgram);
|
1999-09-15 00:50:22 +04:00
|
|
|
|
2000-07-24 13:09:29 +04:00
|
|
|
if(verifyDiskSpace(fProgram, srDest))
|
1999-11-23 01:50:30 +03:00
|
|
|
{
|
2000-05-24 18:08:46 +04:00
|
|
|
setPackageFolder(fProgram);
|
2000-10-17 05:29:19 +04:00
|
|
|
|
2000-12-15 02:33:37 +03:00
|
|
|
$Ren8dot3Call$
|
2000-10-17 05:29:19 +04:00
|
|
|
|
2000-03-09 12:49:36 +03:00
|
|
|
err = addDirectory("",
|
1999-11-23 01:50:30 +03:00
|
|
|
"$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
|
1999-11-24 17:55:56 +03:00
|
|
|
true); // Force Flag
|
1999-11-23 01:50:30 +03:00
|
|
|
logComment("addDirectory() returned: " + err);
|
1999-09-15 00:50:22 +04:00
|
|
|
|
1999-11-23 01:50:30 +03:00
|
|
|
// check return value
|
2001-03-14 03:24:23 +03:00
|
|
|
if( err == SUCCESS )
|
1999-11-23 01:50:30 +03:00
|
|
|
{
|
2001-03-14 03:24:23 +03:00
|
|
|
createShortcuts();
|
2001-05-24 12:07:52 +04:00
|
|
|
upgradeCleanup();
|
2001-10-09 05:20:29 +04:00
|
|
|
updateWinIni();
|
2001-10-10 05:03:42 +04:00
|
|
|
updateMapi();
|
2001-05-24 12:07:52 +04:00
|
|
|
|
2001-03-14 03:24:23 +03:00
|
|
|
// we don't want to fail on errors for the above
|
|
|
|
resetError();
|
|
|
|
|
|
|
|
// register chrome
|
|
|
|
registerChrome(CONTENT | DELAYED_CHROME,
|
|
|
|
getFolder("Chrome","messenger.jar"),
|
|
|
|
"content/messenger/");
|
|
|
|
registerChrome(CONTENT | DELAYED_CHROME,
|
|
|
|
getFolder("Chrome","messenger.jar"),
|
|
|
|
"content/messenger-region/");
|
|
|
|
|
2001-10-10 05:03:42 +04:00
|
|
|
// log comments for uninstalling the registry keys created by mail for setting
|
|
|
|
// itself up in WinXP's Start menu
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$ []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$ []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$ [DLLPath]");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\DefaultIcon []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\DefaultIcon []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell\\open []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell\\open\\command []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\protocols\\mailto\\shell\\open\\command []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\shell []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\shell\\open []");
|
|
|
|
logComment("Create Registry Key: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\shell\\open\\command []");
|
|
|
|
logComment("Store Registry Value: HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\$ProductName$\\shell\\open\\command []");
|
|
|
|
|
2001-03-14 03:24:23 +03:00
|
|
|
// check return value
|
|
|
|
err = getLastError();
|
|
|
|
if(err == SUCCESS)
|
|
|
|
{
|
|
|
|
err = performInstall();
|
|
|
|
logComment("performInstall() returned: " + err);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cancelInstall(err);
|
1999-11-23 01:50:30 +03:00
|
|
|
}
|
2000-05-24 18:08:46 +04:00
|
|
|
else
|
|
|
|
cancelInstall(err);
|
1999-11-23 01:50:30 +03:00
|
|
|
}
|
2000-05-24 18:08:46 +04:00
|
|
|
else
|
|
|
|
cancelInstall(INSUFFICIENT_DISK_SPACE);
|
1999-09-15 00:50:22 +04:00
|
|
|
|
1999-11-23 01:50:30 +03:00
|
|
|
// end main
|