mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
fixing bug 103232 - Changes the function pointer reference name (that the installer looks for in Mapi32.dll) from MAPIGetVersion() to GetMapiDllVersion(); also fixes mail.xpi to update mapi32.dll when appropriate. r=curt, sr=dveditz. affects windows platforms only
This commit is contained in:
parent
212f222265
commit
1ec5e46137
@ -178,6 +178,74 @@ function createShortcuts()
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
function upgradeCleanup()
|
||||
{
|
||||
// Obsolete files from Netscape 6.0 and Netscape 6.01 that
|
||||
@ -227,6 +295,7 @@ if(verifyDiskSpace(fProgram, srDest))
|
||||
createShortcuts();
|
||||
upgradeCleanup();
|
||||
updateWinIni();
|
||||
updateMapi();
|
||||
|
||||
// we don't want to fail on errors for the above
|
||||
resetError();
|
||||
@ -239,6 +308,25 @@ if(verifyDiskSpace(fProgram, srDest))
|
||||
getFolder("Chrome","messenger.jar"),
|
||||
"content/messenger-region/");
|
||||
|
||||
// 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 []");
|
||||
|
||||
// check return value
|
||||
err = getLastError();
|
||||
if(err == SUCCESS)
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
HKEY hkUnreadMailRootKey = HKEY_CURRENT_USER;
|
||||
char szUnreadMailKey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail";
|
||||
char szMozillaDesktopKey[] = "Software\\Mozilla\\Desktop";
|
||||
char szRDISection[] = "Restore Desktop Integration";
|
||||
|
||||
/* structure for use with UnreadMail registry keys */
|
||||
typedef struct sKeyNode skn;
|
||||
@ -105,6 +107,45 @@ void DeInitSknList(skn **sknHeadNode)
|
||||
*sknHeadNode = NULL;
|
||||
}
|
||||
|
||||
/* Function to check if [windir]\mapi32.dll belongs to mozilla or not */
|
||||
int IsMapiMozMapi(BOOL *bIsMozMapi)
|
||||
{
|
||||
HINSTANCE hLib;
|
||||
char szMapiFilePath[MAX_BUF];
|
||||
int iRv = WIZ_ERROR_UNDEFINED;
|
||||
int (PASCAL *GetMapiDllVersion)(void);
|
||||
char szMapiVersionKey[] = "MAPI version installed";
|
||||
char szBuf[MAX_BUF];
|
||||
int iMapiVersionInstalled;
|
||||
|
||||
/* Get the Mapi version that we installed from uninstall.ini.
|
||||
* If there is none set, then return WIZ_ERROR_UNDEFINED. */
|
||||
GetPrivateProfileString(szRDISection, szMapiVersionKey, "", szBuf, sizeof(szBuf), szFileIniUninstall);
|
||||
if(*szBuf == '\0')
|
||||
return(iRv);
|
||||
|
||||
iMapiVersionInstalled = atoi(szBuf);
|
||||
if(GetSystemDirectory(szMapiFilePath, sizeof(szMapiFilePath)) == 0)
|
||||
return(iRv);
|
||||
|
||||
AppendBackSlash(szMapiFilePath, sizeof(szMapiFilePath));
|
||||
lstrcat(szMapiFilePath, "Mapi32.dll");
|
||||
if(!FileExists(szMapiFilePath))
|
||||
iRv = WIZ_FILE_NOT_FOUND;
|
||||
else if((hLib = LoadLibrary(szMapiFilePath)) != NULL)
|
||||
{
|
||||
iRv = WIZ_OK;
|
||||
*bIsMozMapi = FALSE;
|
||||
if(((FARPROC)GetMapiDllVersion = GetProcAddress(hLib, "GetMapiDllVersion")) != NULL)
|
||||
{
|
||||
if(iMapiVersionInstalled == GetMapiDllVersion())
|
||||
*bIsMozMapi = TRUE;
|
||||
}
|
||||
FreeLibrary(hLib);
|
||||
}
|
||||
return(iRv);
|
||||
}
|
||||
|
||||
/* This function parses takes as input a registry key path string beginning
|
||||
* with HKEY_XXXX (root key) and parses out the sub key path and the root
|
||||
* key.
|
||||
@ -204,11 +245,10 @@ void RestoreDesktopIntegration()
|
||||
DWORD dwIndex;
|
||||
DWORD dwSubKeySize;
|
||||
DWORD dwTotalValues;
|
||||
char szWRMozillaDesktopKey[] = "Software\\Mozilla\\Desktop";
|
||||
char szKHKEY[] = "HKEY";
|
||||
char szKisHandling[] = "isHandling";
|
||||
|
||||
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, szWRMozillaDesktopKey, 0, KEY_READ|KEY_WRITE, &hkHandle) != ERROR_SUCCESS)
|
||||
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, szMozillaDesktopKey, 0, KEY_READ|KEY_WRITE, &hkHandle) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
dwTotalValues = 0;
|
||||
@ -226,7 +266,7 @@ void RestoreDesktopIntegration()
|
||||
hkRootKey = GetRootKeyAndSubKeyPath(szVarName, szSubKey, sizeof(szSubKey));
|
||||
if(*szSubKey != '\0')
|
||||
{
|
||||
GetWinReg(HKEY_LOCAL_MACHINE, szWRMozillaDesktopKey, szVarName, szValue, sizeof(szValue));
|
||||
GetWinReg(HKEY_LOCAL_MACHINE, szMozillaDesktopKey, szVarName, szValue, sizeof(szValue));
|
||||
if(*szValue != '\0')
|
||||
{
|
||||
/* Due to a bug in the browser code that saves the previous HKEY
|
||||
@ -258,11 +298,60 @@ void RestoreDesktopIntegration()
|
||||
return;
|
||||
}
|
||||
|
||||
void RestoreMozMapi()
|
||||
{
|
||||
char szMozMapiBackupFile[MAX_BUF];
|
||||
BOOL bFileIsMozMapi = FALSE;
|
||||
|
||||
GetWinReg(HKEY_LOCAL_MACHINE,
|
||||
szMozillaDesktopKey,
|
||||
"Mapi_backup_dll",
|
||||
szMozMapiBackupFile,
|
||||
sizeof(szMozMapiBackupFile));
|
||||
|
||||
/* If the windows registry Mapi_backup_dll var name does not exist,
|
||||
* then we're not the default mail handler for the system.
|
||||
*
|
||||
* If the backup mapi file does not exist for some reason, then
|
||||
* there's no way to restore the previous saved mapi32.dll file. */
|
||||
if((*szMozMapiBackupFile == '\0') || !FileExists(szMozMapiBackupFile))
|
||||
return;
|
||||
|
||||
/* A TRUE for bFileIsMozMapi indicates that we need to restore
|
||||
* the backed up mapi32.dll (if one was backed up).
|
||||
*
|
||||
* bFileIsMozMapi is TRUE in the following conditions:
|
||||
* * mapi32.dll is not found
|
||||
* * mapi32.dll loads and GetMapiDllVersion() exists
|
||||
* _and_ returns the same version indicated in the uninstall.ini file:
|
||||
*
|
||||
* [Restore Desktop Integration]
|
||||
* Mapi version installed=94
|
||||
*
|
||||
* 94 indicates version 0.9.4 */
|
||||
if(IsMapiMozMapi(&bFileIsMozMapi) == WIZ_FILE_NOT_FOUND)
|
||||
bFileIsMozMapi = TRUE;
|
||||
|
||||
if(bFileIsMozMapi)
|
||||
{
|
||||
char szDestinationFilename[MAX_BUF];
|
||||
|
||||
/* Get the Windows System (or System32 under NT) directory */
|
||||
if(GetSystemDirectory(szDestinationFilename, sizeof(szDestinationFilename)))
|
||||
{
|
||||
/* Copy the backup filename into the normal Mapi32.dll filename */
|
||||
AppendBackSlash(szDestinationFilename, sizeof(szDestinationFilename));
|
||||
lstrcat(szDestinationFilename, "Mapi32.dll");
|
||||
CopyFile(szMozMapiBackupFile, szDestinationFilename, FALSE);
|
||||
}
|
||||
}
|
||||
/* Delete the backup Mapi filename */
|
||||
FileDelete(szMozMapiBackupFile);
|
||||
}
|
||||
|
||||
BOOL UndoDesktopIntegration(void)
|
||||
{
|
||||
char szMozillaDesktopKey[MAX_BUF];
|
||||
char szMozillaKey[] = "Software\\Mozilla";
|
||||
char szRDISection[] = "Restore Desktop Integration";
|
||||
char szBuf[MAX_BUF];
|
||||
|
||||
/* Check to see if uninstall.ini has indicated to restore
|
||||
@ -270,8 +359,8 @@ BOOL UndoDesktopIntegration(void)
|
||||
GetPrivateProfileString(szRDISection, "Enabled", "", szBuf, sizeof(szBuf), szFileIniUninstall);
|
||||
if(lstrcmpi(szBuf, "TRUE") == 0)
|
||||
{
|
||||
wsprintf(szMozillaDesktopKey, "%s\\%s", szMozillaKey, "Desktop");
|
||||
RestoreDesktopIntegration();
|
||||
RestoreMozMapi();
|
||||
|
||||
DeleteWinRegKey(HKEY_LOCAL_MACHINE, szMozillaDesktopKey, TRUE);
|
||||
DeleteWinRegKey(HKEY_LOCAL_MACHINE, szMozillaKey, FALSE);
|
||||
|
@ -75,6 +75,8 @@ typedef int PRInt32;
|
||||
/* WIZ: WIZARD defines */
|
||||
#define WIZ_OK 0
|
||||
#define WIZ_MEMORY_ALLOC_FAILED 1
|
||||
#define WIZ_ERROR_UNDEFINED 2
|
||||
#define WIZ_FILE_NOT_FOUND 3
|
||||
|
||||
/* CMI: Cleanup Mail Integration */
|
||||
#define CMI_OK 0
|
||||
|
Loading…
Reference in New Issue
Block a user