mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 491947 - Disable DDE shell integration. r=jmathies
This commit is contained in:
parent
b911986f79
commit
885df8ebbc
@ -747,10 +747,6 @@ nsDefaultCommandLineHandler.prototype = {
|
||||
return this;
|
||||
},
|
||||
|
||||
// List of uri's that were passed via the command line without the app
|
||||
// running and have already been handled. This is compared against uri's
|
||||
// opened using DDE on Win32 so we only open one of the requests.
|
||||
_handledURIs: [ ],
|
||||
#ifdef XP_WIN
|
||||
_haveProfile: false,
|
||||
#endif
|
||||
@ -784,25 +780,8 @@ nsDefaultCommandLineHandler.prototype = {
|
||||
try {
|
||||
var ar;
|
||||
while ((ar = cmdLine.handleFlagWithParam("url", false))) {
|
||||
var found = false;
|
||||
var uri = resolveURIInternal(cmdLine, ar);
|
||||
// count will never be greater than zero except on Win32.
|
||||
var count = this._handledURIs.length;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
if (this._handledURIs[i].spec == uri.spec) {
|
||||
this._handledURIs.splice(i, 1);
|
||||
found = true;
|
||||
cmdLine.preventDefault = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
urilist.push(uri);
|
||||
// The requestpending command line flag is only used on Win32.
|
||||
if (cmdLine.handleFlag("requestpending", false) &&
|
||||
cmdLine.state == nsICommandLine.STATE_INITIAL_LAUNCH)
|
||||
this._handledURIs.push(uri)
|
||||
}
|
||||
urilist.push(uri);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -77,7 +77,10 @@
|
||||
#define INITGUID
|
||||
#include <shlobj.h>
|
||||
|
||||
#pragma comment(lib, "shlwapi.lib") // for SHDeleteKeyW
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#ifndef MAX_BUF
|
||||
#define MAX_BUF 4096
|
||||
@ -129,23 +132,17 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
|
||||
//
|
||||
// HKCU\SOFTWARE\Classes\FirefoxHTML\
|
||||
// DefaultIcon (default) REG_SZ <apppath>,1
|
||||
// shell\open\command (default) REG_SZ <apppath> -requestPending -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ "%1",,0,0,,,,
|
||||
// shell\open\ddeexec NoActivateHandler REG_SZ
|
||||
// \Application (default) REG_SZ Firefox
|
||||
// \Topic (default) REG_SZ WWW_OpenURL
|
||||
// shell\open\command (default) REG_SZ <apppath> -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ <empty string>
|
||||
//
|
||||
// - Windows Vista Protocol Handler
|
||||
// - Windows Vista and above Protocol Handler
|
||||
//
|
||||
// HKCU\SOFTWARE\Classes\FirefoxURL\ (default) REG_SZ <appname> URL
|
||||
// EditFlags REG_DWORD 2
|
||||
// FriendlyTypeName REG_SZ <appname> URL
|
||||
// DefaultIcon (default) REG_SZ <apppath>,1
|
||||
// shell\open\command (default) REG_SZ <apppath> -requestPending -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ "%1",,0,0,,,,
|
||||
// shell\open\ddeexec NoActivateHandler REG_SZ
|
||||
// \Application (default) REG_SZ Firefox
|
||||
// \Topic (default) REG_SZ WWW_OpenURL
|
||||
// shell\open\command (default) REG_SZ <apppath> -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ <empty string>
|
||||
//
|
||||
// - Protocol Mappings
|
||||
// -----------------
|
||||
@ -155,13 +152,10 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
|
||||
//
|
||||
// HKCU\SOFTWARE\Classes\<protocol>\
|
||||
// DefaultIcon (default) REG_SZ <apppath>,1
|
||||
// shell\open\command (default) REG_SZ <apppath> -requestPending -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ "%1",,0,0,,,,
|
||||
// shell\open\ddeexec NoActivateHandler REG_SZ
|
||||
// \Application (default) REG_SZ Firefox
|
||||
// \Topic (default) REG_SZ WWW_OpenURL
|
||||
// shell\open\command (default) REG_SZ <apppath> -osint -url "%1"
|
||||
// shell\open\ddeexec (default) REG_SZ <empty string>
|
||||
//
|
||||
// - Windows Start Menu (Win2K SP2, XP SP1, and newer)
|
||||
// - Windows Start Menu (XP SP1 and newer)
|
||||
// -------------------------------------------------
|
||||
// The following keys are set to make Firefox appear in the Start Menu as the
|
||||
// browser:
|
||||
@ -180,19 +174,22 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
|
||||
// shell\safemode\command (default) REG_SZ <apppath> -safe-mode
|
||||
//
|
||||
|
||||
// The values checked are all default values so the value name is not needed.
|
||||
typedef struct {
|
||||
char* keyName;
|
||||
char* valueName;
|
||||
char* valueData;
|
||||
char* oldValueData;
|
||||
} SETTING;
|
||||
|
||||
#define APP_REG_NAME L"Firefox"
|
||||
#define CLS_HTML "FirefoxHTML"
|
||||
#define CLS_URL "FirefoxURL"
|
||||
#define VAL_OPEN "\"%APPPATH%\" -requestPending -osint -url \"%1\""
|
||||
#define VAL_FILE_ICON "%APPPATH%,1"
|
||||
#define VAL_OPEN "\"%APPPATH%\" -osint -url \"%1\""
|
||||
#define OLD_VAL_OPEN "\"%APPPATH%\" -requestPending -osint -url \"%1\""
|
||||
#define DI "\\DefaultIcon"
|
||||
#define SOP "\\shell\\open\\command"
|
||||
#define SOC "\\shell\\open\\command"
|
||||
#define SOD "\\shell\\open\\ddeexec"
|
||||
// Used for updating the FTP protocol handler's shell open command under HKCU.
|
||||
#define FTP_SOC L"Software\\Classes\\ftp\\shell\\open\\command"
|
||||
|
||||
#define MAKE_KEY_NAME1(PREFIX, MID) \
|
||||
PREFIX MID
|
||||
@ -201,19 +198,37 @@ typedef struct {
|
||||
// Firefox is the default browser for file handlers since other applications
|
||||
// (e.g. MS Office) may modify the DefaultIcon registry key value to add Icon
|
||||
// Handlers. see http://msdn2.microsoft.com/en-us/library/aa969357.aspx for
|
||||
// more info.
|
||||
// more info. The FTP protocol is not checked so advanced users can set the FTP
|
||||
// handler to another application and still have Firefox check if it is the
|
||||
// default HTTP and HTTPS handler.
|
||||
static SETTING gSettings[] = {
|
||||
// File Handler Class
|
||||
{ MAKE_KEY_NAME1(CLS_HTML, SOP), "", VAL_OPEN },
|
||||
{ MAKE_KEY_NAME1("FirefoxHTML", SOC), VAL_OPEN, OLD_VAL_OPEN },
|
||||
|
||||
// Protocol Handler Class - for Vista and above
|
||||
{ MAKE_KEY_NAME1(CLS_URL, SOP), "", VAL_OPEN },
|
||||
{ MAKE_KEY_NAME1("FirefoxURL", SOC), VAL_OPEN, OLD_VAL_OPEN },
|
||||
|
||||
// Protocol Handlers
|
||||
{ MAKE_KEY_NAME1("HTTP", DI), "", VAL_FILE_ICON },
|
||||
{ MAKE_KEY_NAME1("HTTP", SOP), "", VAL_OPEN },
|
||||
{ MAKE_KEY_NAME1("HTTPS", DI), "", VAL_FILE_ICON },
|
||||
{ MAKE_KEY_NAME1("HTTPS", SOP), "", VAL_OPEN }
|
||||
{ MAKE_KEY_NAME1("HTTP", DI), VAL_FILE_ICON },
|
||||
{ MAKE_KEY_NAME1("HTTP", SOC), VAL_OPEN, OLD_VAL_OPEN },
|
||||
{ MAKE_KEY_NAME1("HTTPS", DI), VAL_FILE_ICON },
|
||||
{ MAKE_KEY_NAME1("HTTPS", SOC), VAL_OPEN, OLD_VAL_OPEN }
|
||||
};
|
||||
|
||||
// The settings to disable DDE are separate from the default browser settings
|
||||
// since they are only checked when Firefox is the default browser and if they
|
||||
// are incorrect they are fixed without notifying the user.
|
||||
static SETTING gDDESettings[] = {
|
||||
// File Handler Class
|
||||
{ MAKE_KEY_NAME1("Software\\Classes\\FirefoxHTML", SOD) },
|
||||
|
||||
// Protocol Handler Class - for Vista and above
|
||||
{ MAKE_KEY_NAME1("Software\\Classes\\FirefoxURL", SOD) },
|
||||
|
||||
// Protocol Handlers
|
||||
{ MAKE_KEY_NAME1("Software\\Classes\\FTP", SOD) },
|
||||
{ MAKE_KEY_NAME1("Software\\Classes\\HTTP", SOD) },
|
||||
{ MAKE_KEY_NAME1("Software\\Classes\\HTTPS", SOD) }
|
||||
};
|
||||
|
||||
nsresult
|
||||
@ -245,11 +260,10 @@ LaunchHelper(nsAutoString& aPath)
|
||||
STARTUPINFOW si = {sizeof(si), 0};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
BOOL ok = CreateProcessW(NULL, (LPWSTR)aPath.get(), NULL, NULL,
|
||||
FALSE, 0, NULL, NULL, &si, &pi);
|
||||
|
||||
if (!ok)
|
||||
if (!CreateProcessW(NULL, (LPWSTR)aPath.get(), NULL, NULL, FALSE, 0, NULL,
|
||||
NULL, &si, &pi)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
@ -367,9 +381,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
if (aStartupCheck)
|
||||
mCheckedThisSession = true;
|
||||
|
||||
SETTING* settings;
|
||||
SETTING* end = gSettings + sizeof(gSettings)/sizeof(SETTING);
|
||||
|
||||
*aIsDefaultBrowser = true;
|
||||
|
||||
PRUnichar exePath[MAX_BUF];
|
||||
@ -383,40 +394,171 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
|
||||
nsAutoString appLongPath(exePath);
|
||||
|
||||
HKEY theKey;
|
||||
DWORD res;
|
||||
nsresult rv;
|
||||
PRUnichar currValue[MAX_BUF];
|
||||
for (settings = gSettings; settings < end; ++settings) {
|
||||
NS_ConvertUTF8toUTF16 dataLongPath(settings->valueData);
|
||||
NS_ConvertUTF8toUTF16 key(settings->keyName);
|
||||
NS_ConvertUTF8toUTF16 value(settings->valueName);
|
||||
PRInt32 offset = dataLongPath.Find("%APPPATH%");
|
||||
dataLongPath.Replace(offset, 9, appLongPath);
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
HKEY theKey;
|
||||
rv = OpenKeyForReading(HKEY_CLASSES_ROOT, key, &theKey);
|
||||
SETTING* settings;
|
||||
SETTING* end = gSettings + sizeof(gSettings) / sizeof(SETTING);
|
||||
|
||||
for (settings = gSettings; settings < end; ++settings) {
|
||||
NS_ConvertUTF8toUTF16 keyName(settings->keyName);
|
||||
NS_ConvertUTF8toUTF16 valueData(settings->valueData);
|
||||
PRInt32 offset = valueData.Find("%APPPATH%");
|
||||
valueData.Replace(offset, 9, appLongPath);
|
||||
|
||||
rv = OpenKeyForReading(HKEY_CLASSES_ROOT, keyName, &theKey);
|
||||
if (NS_FAILED(rv)) {
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
DWORD res = ::RegQueryValueExW(theKey, PromiseFlatString(value).get(),
|
||||
NULL, NULL, (LPBYTE)currValue, &len);
|
||||
// Close the key we opened.
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue, &len);
|
||||
// Close the key that was opened.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res) ||
|
||||
!dataLongPath.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
// Key wasn't set, or was set to something other than our registry entry
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
!valueData.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
// Key wasn't set or was set to something other than our registry entry.
|
||||
NS_ConvertUTF8toUTF16 oldValueData(settings->oldValueData);
|
||||
offset = oldValueData.Find("%APPPATH%");
|
||||
oldValueData.Replace(offset, 9, appLongPath);
|
||||
// The current registry value doesn't match the current or the old format.
|
||||
if (!oldValueData.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, PromiseFlatString(keyName).get(),
|
||||
0, KEY_SET_VALUE, &theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If updating the open command fails try to update it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsString &flatValue = PromiseFlatString(valueData);
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
|
||||
(const BYTE *) flatValue.get(),
|
||||
(flatValue.Length() + 1) * sizeof(PRUnichar));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If updating the open command fails try to update it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only check if Firefox is the default browser on Vista if the previous
|
||||
// checks show that Firefox is the default browser.
|
||||
if (*aIsDefaultBrowser)
|
||||
// Only check if Firefox is the default browser on Vista and above if the
|
||||
// previous checks show that Firefox is the default browser.
|
||||
if (*aIsDefaultBrowser) {
|
||||
IsDefaultBrowserVista(aIsDefaultBrowser);
|
||||
}
|
||||
|
||||
// To handle the case where DDE isn't disabled due for a user because there
|
||||
// account didn't perform a Firefox update this will check if Firefox is the
|
||||
// default browser and if dde is disabled for each handler
|
||||
// and if it isn't disable it. When Firefox is not the default browser the
|
||||
// helper application will disable dde for each handler.
|
||||
if (*aIsDefaultBrowser) {
|
||||
// Check ftp settings
|
||||
|
||||
end = gDDESettings + sizeof(gDDESettings) / sizeof(SETTING);
|
||||
|
||||
for (settings = gDDESettings; settings < end; ++settings) {
|
||||
NS_ConvertUTF8toUTF16 keyName(settings->keyName);
|
||||
|
||||
rv = OpenKeyForReading(HKEY_CURRENT_USER, keyName, &theKey);
|
||||
if (NS_FAILED(rv)) {
|
||||
::RegCloseKey(theKey);
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
||||
&len);
|
||||
// Close the key that was opened.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res) || PRUnichar('\0') != *currValue) {
|
||||
// Key wasn't set or was set to something other than our registry entry.
|
||||
// Delete the key along with all of its childrean and then recreate it.
|
||||
const nsString &flatName = PromiseFlatString(keyName);
|
||||
::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
|
||||
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
|
||||
&theKey, NULL);
|
||||
if (REG_FAILED(res)) {
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, (const BYTE *) L"",
|
||||
sizeof(PRUnichar));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
if (REG_FAILED(res)) {
|
||||
// If disabling DDE fails try to disable it using the helper
|
||||
// application when setting Firefox as the default browser.
|
||||
*aIsDefaultBrowser = false;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the FTP protocol handler's shell open command if it is the old
|
||||
// format.
|
||||
res = ::RegOpenKeyExW(HKEY_CURRENT_USER, FTP_SOC, 0, KEY_ALL_ACCESS,
|
||||
&theKey);
|
||||
// Don't update the FTP protocol handler's shell open command when opening
|
||||
// its registry key fails under HKCU since it most likely doesn't exist.
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ConvertUTF8toUTF16 oldValueOpen(OLD_VAL_OPEN);
|
||||
PRInt32 offset = oldValueOpen.Find("%APPPATH%");
|
||||
oldValueOpen.Replace(offset, 9, appLongPath);
|
||||
|
||||
::ZeroMemory(currValue, sizeof(currValue));
|
||||
DWORD len = sizeof currValue;
|
||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
||||
&len);
|
||||
|
||||
// Don't update the FTP protocol handler's shell open command when the
|
||||
// current registry value doesn't exist or matches the old format.
|
||||
if (REG_FAILED(res) ||
|
||||
!oldValueOpen.Equals(currValue, CaseInsensitiveCompare)) {
|
||||
::RegCloseKey(theKey);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ConvertUTF8toUTF16 valueData(VAL_OPEN);
|
||||
valueData.Replace(offset, 9, appLongPath);
|
||||
const nsString &flatValue = PromiseFlatString(valueData);
|
||||
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
|
||||
(const BYTE *) flatValue.get(),
|
||||
(flatValue.Length() + 1) * sizeof(PRUnichar));
|
||||
// Close the key that was created.
|
||||
::RegCloseKey(theKey);
|
||||
// If updating the FTP protocol handlers shell open command fails try to
|
||||
// update it using the helper application when setting Firefox as the
|
||||
// default browser.
|
||||
if (REG_FAILED(res)) {
|
||||
*aIsDefaultBrowser = false;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
|
||||
; Must be inserted before other macros that use logging
|
||||
!insertmacro _LoggingCommon
|
||||
|
||||
!insertmacro AddDDEHandlerValues
|
||||
!insertmacro AddDisabledDDEHandlerValues
|
||||
!insertmacro ChangeMUIHeaderImage
|
||||
!insertmacro CheckForFilesInUse
|
||||
!insertmacro CleanUpdatesDir
|
||||
@ -352,17 +352,15 @@ Section "-Application" APP_IDX
|
||||
${SetUninstallKeys}
|
||||
|
||||
; On install always add the FirefoxHTML and FirefoxURL keys.
|
||||
; An empty string is used for the 5th param because FirefoxHTML and FirefoxURL
|
||||
; are not protocol handlers.
|
||||
; An empty string is used for the 5th param because FirefoxHTML is not a
|
||||
; protocol handler.
|
||||
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
|
||||
StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\""
|
||||
StrCpy $3 "$\"%1$\",,0,0,,,,"
|
||||
StrCpy $2 "$\"$8$\" -osint -url $\"%1$\""
|
||||
|
||||
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
|
||||
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
|
||||
"${AppRegName} Document" ""
|
||||
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \
|
||||
"true"
|
||||
|
||||
; The following keys should only be set if we can write to HKLM
|
||||
${If} $TmpVal == "HKLM"
|
||||
|
@ -79,7 +79,7 @@
|
||||
${GetLongPath} "$0" $0
|
||||
${EndIf}
|
||||
${If} "$0" == "$INSTDIR"
|
||||
${SetStartMenuInternet}
|
||||
${SetStartMenuInternet} ; Does not use SHCTX
|
||||
${EndIf}
|
||||
|
||||
ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion"
|
||||
@ -152,12 +152,12 @@
|
||||
!define PostUpdate "!insertmacro PostUpdate"
|
||||
|
||||
!macro SetAsDefaultAppGlobal
|
||||
${RemoveDeprecatedKeys}
|
||||
${RemoveDeprecatedKeys} ; Does not use SHCTX
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
|
||||
${SetHandlers}
|
||||
${SetStartMenuInternet}
|
||||
${FixShellIconHandler}
|
||||
${SetHandlers} ; Uses SHCTX
|
||||
${SetStartMenuInternet} ; Does not use SHCTX
|
||||
${FixShellIconHandler} ; Does not use SHCTX
|
||||
${ShowShortcuts}
|
||||
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
|
||||
WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9"
|
||||
@ -302,7 +302,7 @@
|
||||
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
|
||||
|
||||
StrCpy $0 "SOFTWARE\Classes"
|
||||
StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\""
|
||||
StrCpy $2 "$\"$8$\" -osint -url $\"%1$\""
|
||||
|
||||
; Associate the file handlers with FirefoxHTML
|
||||
ReadRegStr $6 SHCTX "$0\.htm" ""
|
||||
@ -336,25 +336,20 @@
|
||||
WriteRegStr SHCTX "$0\.webm" "" "FirefoxHTML"
|
||||
${EndIf}
|
||||
|
||||
StrCpy $3 "$\"%1$\",,0,0,,,,"
|
||||
|
||||
; An empty string is used for the 5th param because FirefoxHTML is not a
|
||||
; protocol handler
|
||||
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} HTML Document" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
|
||||
"${AppRegName} HTML Document" ""
|
||||
|
||||
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \
|
||||
"true"
|
||||
|
||||
; An empty string is used for the 4th & 5th params because the following
|
||||
; protocol handlers already have a display name and the additional keys
|
||||
; required for a protocol handler.
|
||||
${AddDDEHandlerValues} "ftp" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDDEHandlerValues} "http" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDDEHandlerValues} "https" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" ""
|
||||
${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" ""
|
||||
${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" ""
|
||||
!macroend
|
||||
!define SetHandlers "!insertmacro SetHandlers"
|
||||
|
||||
@ -563,8 +558,7 @@
|
||||
!macro UpdateProtocolHandlers
|
||||
; Store the command to open the app with an url in a register for easy access.
|
||||
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
|
||||
StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\""
|
||||
StrCpy $3 "$\"%1$\",,0,0,,,,"
|
||||
StrCpy $2 "$\"$8$\" -osint -url $\"%1$\""
|
||||
|
||||
; Only set the file and protocol handlers if the existing one under HKCR is
|
||||
; for this install location.
|
||||
@ -573,32 +567,32 @@
|
||||
${If} "$R9" == "true"
|
||||
; An empty string is used for the 5th param because FirefoxHTML is not a
|
||||
; protocol handler.
|
||||
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} HTML Document" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
|
||||
"${AppRegName} HTML Document" ""
|
||||
${EndIf}
|
||||
|
||||
${IsHandlerForInstallDir} "FirefoxURL" $R9
|
||||
${If} "$R9" == "true"
|
||||
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" \
|
||||
"${AppRegName} URL" "true"
|
||||
${EndIf}
|
||||
|
||||
; An empty string is used for the 4th & 5th params because the following
|
||||
; protocol handlers already have a display name and the additional keys
|
||||
; required for a protocol handler.
|
||||
${IsHandlerForInstallDir} "ftp" $R9
|
||||
${If} "$R9" == "true"
|
||||
${AddDDEHandlerValues} "ftp" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" ""
|
||||
${EndIf}
|
||||
|
||||
${IsHandlerForInstallDir} "http" $R9
|
||||
${If} "$R9" == "true"
|
||||
${AddDDEHandlerValues} "http" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" ""
|
||||
${EndIf}
|
||||
|
||||
${IsHandlerForInstallDir} "https" $R9
|
||||
${If} "$R9" == "true"
|
||||
${AddDDEHandlerValues} "https" "$2" "$8,1" "" "" \
|
||||
"${DDEApplication}" "$3" "WWW_OpenURL"
|
||||
${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" ""
|
||||
${EndIf}
|
||||
!macroend
|
||||
!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers"
|
||||
@ -1157,11 +1151,13 @@ Function SetAsDefaultAppUser
|
||||
; b) is not a member of the administrators group and chooses to elevate
|
||||
${ElevateUAC}
|
||||
|
||||
${SetStartMenuInternet}
|
||||
${SetStartMenuInternet} ; Does not use SHCTX
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
|
||||
${FixShellIconHandler}
|
||||
${RemoveDeprecatedKeys}
|
||||
|
||||
${FixClassKeys} ; Does not use SHCTX
|
||||
${FixShellIconHandler} ; Does not use SHCTX
|
||||
${RemoveDeprecatedKeys} ; Does not use SHCTX
|
||||
|
||||
ClearErrors
|
||||
${GetParameters} $0
|
||||
|
@ -92,7 +92,7 @@ Var MaintCertKey
|
||||
VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
|
||||
VIAddVersionKey "OriginalFilename" "helper.exe"
|
||||
|
||||
!insertmacro AddDDEHandlerValues
|
||||
!insertmacro AddDisabledDDEHandlerValues
|
||||
!insertmacro CleanVirtualStore
|
||||
!insertmacro ElevateUAC
|
||||
!insertmacro GetLongPath
|
||||
|
@ -630,7 +630,6 @@ var xml = <prefs>
|
||||
<pref><name>font.size.variable.x-guru</name></pref>
|
||||
<pref><name>font.size.variable.x-gujr</name></pref>
|
||||
<pref><name>network.protocol-handler.external.vnd.ms.radio</name></pref>
|
||||
<pref><name>advanced.system.supportDDEExec</name></pref>
|
||||
<pref><name>browser.tabs.opentabfor.urlbar</name></pref>
|
||||
<pref><name>font.name.sans-serif.x-khmr</name></pref>
|
||||
<pref><name>mousewheel.horizscroll.withshiftkey.sysnumlines</name></pref>
|
||||
|
@ -2085,13 +2085,6 @@ pref("plugin.allow.asyncdrawing", false);
|
||||
// when a network address is unreachable.
|
||||
pref("network.autodial-helper.enabled", true);
|
||||
|
||||
// Pref to control whether we set ddeexec subkeys for the http
|
||||
// Internet shortcut protocol if we are handling it. These
|
||||
// subkeys will be set only while we are running (to avoid the
|
||||
// problem of Windows showing an alert when it tries to use DDE
|
||||
// and we're not already running).
|
||||
pref("advanced.system.supportDDEExec", true);
|
||||
|
||||
// Switch the keyboard layout per window
|
||||
pref("intl.keyboard.per_window_layout", false);
|
||||
|
||||
|
@ -1193,7 +1193,9 @@
|
||||
* @param _VALOPEN
|
||||
* The path and args to launch the application.
|
||||
* @param _VALICON
|
||||
* The path to an exe that contains an icon and the icon resource id.
|
||||
* The path to the binary that contains the icon group for the default icon
|
||||
* followed by a comma and either the icon group's resource index or the icon
|
||||
* group's resource id prefixed with a minus sign
|
||||
* @param _DISPNAME
|
||||
* The display name for the handler. If emtpy no value will be set.
|
||||
* @param _ISPROTOCOL
|
||||
@ -1237,10 +1239,9 @@
|
||||
WriteRegStr SHCTX "$R4" "" "$R7"
|
||||
WriteRegStr SHCTX "$R4" "FriendlyTypeName" "$R7"
|
||||
|
||||
StrCmp "$R8" "true" +1 +8
|
||||
StrCmp "$R8" "true" +1 +2
|
||||
WriteRegStr SHCTX "$R4" "URL Protocol" ""
|
||||
StrCpy $R3 ""
|
||||
ClearErrors
|
||||
ReadRegDWord $R3 SHCTX "$R4" "EditFlags"
|
||||
StrCmp $R3 "" +1 +3 ; Only add EditFlags if a value doesn't exist
|
||||
DeleteRegValue SHCTX "$R4" "EditFlags"
|
||||
@ -1336,7 +1337,9 @@
|
||||
* @param _VALOPEN
|
||||
* The path and args to launch the application.
|
||||
* @param _VALICON
|
||||
* The path to an exe that contains an icon and the icon resource id.
|
||||
* The path to the binary that contains the icon group for the default icon
|
||||
* followed by a comma and either the icon group's resource index or the icon
|
||||
* group's resource id prefixed with a minus sign
|
||||
* @param _DISPNAME
|
||||
* The display name for the handler. If emtpy no value will be set.
|
||||
* @param _ISPROTOCOL
|
||||
@ -1389,10 +1392,9 @@
|
||||
WriteRegStr SHCTX "$R0\$R2" "" "$R5"
|
||||
WriteRegStr SHCTX "$R0\$R2" "FriendlyTypeName" "$R5"
|
||||
|
||||
StrCmp "$R6" "true" +1 +8
|
||||
StrCmp "$R6" "true" +1 +2
|
||||
WriteRegStr SHCTX "$R0\$R2" "URL Protocol" ""
|
||||
StrCpy $R1 ""
|
||||
ClearErrors
|
||||
ReadRegDWord $R1 SHCTX "$R0\$R2" "EditFlags"
|
||||
StrCmp $R1 "" +1 +3 ; Only add EditFlags if a value doesn't exist
|
||||
DeleteRegValue SHCTX "$R0\$R2" "EditFlags"
|
||||
@ -1485,6 +1487,154 @@
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
/**
|
||||
* Writes common registry values for a handler that DOES NOT use DDE using SHCTX.
|
||||
*
|
||||
* @param _KEY
|
||||
* The key name in relation to the HKCR root. SOFTWARE\Classes is
|
||||
* prefixed to this value when using SHCTX.
|
||||
* @param _VALOPEN
|
||||
* The path and args to launch the application.
|
||||
* @param _VALICON
|
||||
* The path to the binary that contains the icon group for the default icon
|
||||
* followed by a comma and either the icon group's resource index or the icon
|
||||
* group's resource id prefixed with a minus sign
|
||||
* @param _DISPNAME
|
||||
* The display name for the handler. If emtpy no value will be set.
|
||||
* @param _ISPROTOCOL
|
||||
* Sets protocol handler specific registry values when "true".
|
||||
*
|
||||
* $R3 = storage for SOFTWARE\Classes
|
||||
* $R4 = string value of the current registry key path.
|
||||
* $R5 = _KEY
|
||||
* $R6 = _VALOPEN
|
||||
* $R7 = _VALICON
|
||||
* $R8 = _DISPNAME
|
||||
* $R9 = _ISPROTOCOL
|
||||
*/
|
||||
!macro AddDisabledDDEHandlerValues
|
||||
|
||||
!ifndef ${_MOZFUNC_UN}AddDisabledDDEHandlerValues
|
||||
!verbose push
|
||||
!verbose ${_MOZFUNC_VERBOSE}
|
||||
!define ${_MOZFUNC_UN}AddDisabledDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDisabledDDEHandlerValuesCall"
|
||||
|
||||
Function ${_MOZFUNC_UN}AddDisabledDDEHandlerValues
|
||||
Exch $R9 ; true if a protocol handler
|
||||
Exch 1
|
||||
Exch $R8 ; FriendlyTypeName
|
||||
Exch 2
|
||||
Exch $R7 ; icon index
|
||||
Exch 3
|
||||
Exch $R6 ; shell\open\command
|
||||
Exch 4
|
||||
Exch $R5 ; reg key
|
||||
Push $R4 ;
|
||||
Push $R3 ; base reg class
|
||||
|
||||
StrCpy $R3 "SOFTWARE\Classes"
|
||||
StrCmp "$R8" "" +6 +1
|
||||
ReadRegStr $R4 SHCTX "$R5" "FriendlyTypeName"
|
||||
|
||||
StrCmp "$R4" "" +1 +3
|
||||
WriteRegStr SHCTX "$R3\$R5" "" "$R8"
|
||||
WriteRegStr SHCTX "$R3\$R5" "FriendlyTypeName" "$R8"
|
||||
|
||||
StrCmp "$R9" "true" +1 +2
|
||||
WriteRegStr SHCTX "$R3\$R5" "URL Protocol" ""
|
||||
StrCpy $R4 ""
|
||||
ReadRegDWord $R4 SHCTX "$R3\$R5" "EditFlags"
|
||||
StrCmp $R4 "" +1 +3 ; Only add EditFlags if a value doesn't exist
|
||||
DeleteRegValue SHCTX "$R3\$R5" "EditFlags"
|
||||
WriteRegDWord SHCTX "$R3\$R5" "EditFlags" 0x00000002
|
||||
|
||||
StrCmp "$R7" "" +2 +1
|
||||
WriteRegStr SHCTX "$R3\$R5\DefaultIcon" "" "$R7"
|
||||
|
||||
; Main command handler for the app
|
||||
WriteRegStr SHCTX "$R3\$R5\shell\open\command" "" "$R6"
|
||||
|
||||
; Drop support for DDE (bug 491947), and remove old dde entries if
|
||||
; they exist.
|
||||
;
|
||||
; Note, changes in SHCTX should propegate to hkey classes root when
|
||||
; current user or local machine entries are written. Windows will also
|
||||
; attempt to propegate entries when a handler is used. CR entries are a
|
||||
; combination of LM and CU, with CU taking priority.
|
||||
;
|
||||
; To disable dde, an empty shell/ddeexec key must be created in current
|
||||
; user or local machine. Unfortunately, settings have various different
|
||||
; behaviors depending on the windows version. The following code attempts
|
||||
; to address these differences.
|
||||
;
|
||||
; On XP (no SP, SP1, SP2), Vista: An empty default string
|
||||
; must be set under ddeexec. Empty strings propagate to CR.
|
||||
;
|
||||
; Win7: IE does not configure ddeexec, so issues with left over ddeexec keys
|
||||
; in LM are reduced. We configure an empty ddeexec key with an empty default
|
||||
; string in CU to be sure.
|
||||
;
|
||||
DeleteRegKey SHCTX "SOFTWARE\Classes\$R5\shell\open\ddeexec"
|
||||
WriteRegStr SHCTX "SOFTWARE\Classes\$R5\shell\open\ddeexec" "" ""
|
||||
|
||||
ClearErrors
|
||||
|
||||
Pop $R3
|
||||
Pop $R4
|
||||
Exch $R5
|
||||
Exch 4
|
||||
Exch $R6
|
||||
Exch 3
|
||||
Exch $R7
|
||||
Exch 2
|
||||
Exch $R8
|
||||
Exch 1
|
||||
Exch $R9
|
||||
FunctionEnd
|
||||
|
||||
!verbose pop
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro AddDisabledDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL
|
||||
!verbose push
|
||||
!verbose ${_MOZFUNC_VERBOSE}
|
||||
Push "${_KEY}"
|
||||
Push "${_VALOPEN}"
|
||||
Push "${_VALICON}"
|
||||
Push "${_DISPNAME}"
|
||||
Push "${_ISPROTOCOL}"
|
||||
Call AddDisabledDDEHandlerValues
|
||||
!verbose pop
|
||||
!macroend
|
||||
|
||||
!macro un.AddDisabledDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL
|
||||
!verbose push
|
||||
!verbose ${_MOZFUNC_VERBOSE}
|
||||
Push "${_KEY}"
|
||||
Push "${_VALOPEN}"
|
||||
Push "${_VALICON}"
|
||||
Push "${_DISPNAME}"
|
||||
Push "${_ISPROTOCOL}"
|
||||
Call un.AddDisabledDDEHandlerValues
|
||||
!verbose pop
|
||||
!macroend
|
||||
|
||||
!macro un.AddDisabledDDEHandlerValues
|
||||
!ifndef un.AddDisabledDDEHandlerValues
|
||||
!verbose push
|
||||
!verbose ${_MOZFUNC_VERBOSE}
|
||||
!undef _MOZFUNC_UN
|
||||
!define _MOZFUNC_UN "un."
|
||||
|
||||
!insertmacro AddDisabledDDEHandlerValues
|
||||
|
||||
!undef _MOZFUNC_UN
|
||||
!define _MOZFUNC_UN
|
||||
!verbose pop
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
|
||||
################################################################################
|
||||
# Macros for handling DLL registration
|
||||
@ -2804,6 +2954,7 @@
|
||||
StrCmp "$R7" "$R8" +1 end
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\DefaultIcon" ""
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\shell\open" ""
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\shell\open\command" ""
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec" ""
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Application" ""
|
||||
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Topic" ""
|
||||
|
Loading…
Reference in New Issue
Block a user