attempting to fix bug 140995 - Freeze after setting as default browser [Win 2000 and XP]. Not sure if this is the real fix since I can't reproduce the problem exactly. sr=jag a=asa

This commit is contained in:
ssu%netscape.com 2003-02-22 09:10:00 +00:00
Родитель 757c5e380d
Коммит 34b2740b18
5 изменённых файлов: 72 добавлений и 11 удалений

Просмотреть файл

@ -56,6 +56,8 @@
#define USERAGENT_VERSION_PREF "general.useragent.misc"
#define USERAGENT_VERSION_NS_PREF "general.useragent.vendorSub"
#define USERAGENT_PREF_PREFIX "rv:"
#define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000
#define MOZ_CLIENT_MAIL_KEY "Software\\Clients\\Mail"
nsMapiRegistryUtils::nsMapiRegistryUtils()
{
@ -566,8 +568,13 @@ nsresult nsMapiRegistryUtils::setDefaultMailClient()
"Software\\Mozilla\\Desktop",
"defaultMailHasBeenSet", "1");
}
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
(LPARAM)"Software\\Clients\\Mail");
::SendMessageTimeout( HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_MAIL_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
RegisterServer(CLSID_CMapiImp, "Mozilla MAPI", "MozillaMapi", "MozillaMapi.1");
return desktopKeySet;
}
@ -649,8 +656,13 @@ nsresult nsMapiRegistryUtils::unsetDefaultMailClient() {
"Software\\Mozilla\\Desktop",
"defaultMailHasBeenSet", "0");
}
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
(LPARAM)"Software\\Clients\\Mail");
::SendMessageTimeout( HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_MAIL_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
UnregisterServer(CLSID_CMapiImp, "MozillaMapi", "MozillaMapi.1");
return desktopKeySet;
}

Просмотреть файл

@ -42,6 +42,9 @@
#include "nsINativeAppSupportWin.h"
#include "nsIStringBundle.h"
#define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000
#define MOZ_CLIENT_BROWSER_KEY "Software\\Clients\\StartMenuInternet"
// Where Mozilla stores its own registry values.
const char * const mozillaKeyName = "Software\\Mozilla\\Desktop";
@ -420,7 +423,13 @@ static void setWindowsXP() {
SavedRegistryEntry( HKEY_CURRENT_USER, baseKey.get(), "", shortAppName().get() );
}
// Notify the system of the changes.
::SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\StartMenuInternet" );
::SendMessageTimeout( HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_BROWSER_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
}
}
}
@ -517,7 +526,13 @@ static void resetWindowsXP() {
SavedRegistryEntry( HKEY_CURRENT_USER, baseKey.get(), "", 0 ).reset();
// Notify the system of the changes.
::SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\StartMenuInternet" );
::SendMessageTimeout( HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_BROWSER_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
}
// Restore this entry and corresponding DDE entry.

Просмотреть файл

@ -29,6 +29,10 @@
#include "parser.h"
#include "rdi.h"
#define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000
#define MOZ_CLIENT_BROWSER_KEY "Software\\Clients\\StartMenuInternet"
#define MOZ_CLIENT_MAIL_KEY "Software\\Clients\\Mail"
void SetDefault()
{
char szBuf[MAX_BUF];
@ -251,16 +255,31 @@ void ParseAllUninstallLogs()
RemoveUninstaller(ugUninstall.szUninstallFilename);
}
/* Broadcast message only under NT51 (WinXP) regarding the following
* registry keys in case they were changed during uninstallation. If they
/* Broadcast message only if the windows registry keys exist
* in case they were changed during uninstallation. If they
* were, then the broadcast will alert the OS to update the appropriate UIs.
* This needs to be done regardless if the user canceled the uninstall
* process or not.
*/
if(ulOSType & OS_NT51)
if(WinRegKeyExists(HKEY_LOCAL_MACHINE, MOZ_CLIENT_BROWSER_KEY))
{
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\StartMenuInternet");
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\Mail");
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_BROWSER_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
}
if(WinRegKeyExists(HKEY_LOCAL_MACHINE, MOZ_CLIENT_MAIL_KEY))
{
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM)MOZ_CLIENT_MAIL_KEY,
SMTO_NORMAL|SMTO_ABORTIFHUNG,
MOZ_HWND_BROADCAST_MSG_TIMEOUT,
NULL);
}
}

Просмотреть файл

@ -377,3 +377,17 @@ LPSTR GetStringRootKey(HKEY hkRootKey, LPSTR szString, DWORD dwStringSize)
return(szString);
}
BOOL WinRegKeyExists(HKEY hkRootKey, LPSTR szKey)
{
HKEY hkResult;
BOOL bKeyExists = FALSE;
if(RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult) == ERROR_SUCCESS)
{
bKeyExists = TRUE;
RegCloseKey(hkResult);
}
return(bKeyExists);
}

Просмотреть файл

@ -36,5 +36,6 @@ HRESULT CreateDirectoriesAll(char* szPath);
HKEY ParseRootKey(LPSTR szRootKey);
LPSTR GetStringRootKey(HKEY hkRootKey, LPSTR szString, DWORD dwStringSize);
BOOL SearchForUninstallKeys(char *szStringToMatch);
BOOL WinRegKeyExists(HKEY hkRootKey, LPSTR szKey);
#endif