diff options
Diffstat (limited to 'browser/components/shell/nsWindowsShellService.cpp')
-rw-r--r-- | browser/components/shell/nsWindowsShellService.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 53d128cb9..879b0c7f0 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -12,7 +12,6 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLImageElement.h" #include "nsIImageLoadingContent.h" -#include "nsIOutputStream.h" #include "nsIPrefService.h" #include "nsIPrefLocalizedString.h" #include "nsIServiceManager.h" @@ -136,7 +135,7 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey) // The following keys are set to make Basilisk appear in the Start Menu as the // browser: // -// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\ +// HKCU\SOFTWARE\Clients\StartMenuInternet\BASILISK.EXE\ // (default) REG_SZ <appname> // DefaultIcon (default) REG_SZ <apppath>,0 // InstallInfo HideIconsCommand REG_SZ <uninstpath> /HideShortcuts @@ -466,7 +465,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } - res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName.get(), + 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 @@ -475,9 +474,10 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); if (REG_FAILED(res)) { @@ -529,8 +529,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, if (REG_FAILED(res) || char16_t('\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. - ::SHDeleteKeyW(HKEY_CURRENT_USER, keyName.get()); - res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, nullptr, + const nsString &flatName = PromiseFlatString(keyName); + ::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get()); + res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nullptr, &theKey, nullptr); if (REG_FAILED(res)) { @@ -582,9 +583,10 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, NS_ConvertUTF8toUTF16 valueData(VAL_OPEN); valueData.Replace(offset, 9, appLongPath); + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); // If updating the FTP protocol handlers shell open command fails try to @@ -646,11 +648,6 @@ nsWindowsShellService::LaunchControlPanelDefaultsSelectionUI() nsresult nsWindowsShellService::LaunchControlPanelDefaultPrograms() { - // This Default Programs feature is Win7+ only. - if (!IsWin7OrLater()) { - return NS_ERROR_FAILURE; - } - // Build the path control.exe path safely WCHAR controlEXEPath[MAX_PATH + 1] = { '\0' }; if (!GetSystemDirectoryW(controlEXEPath, MAX_PATH)) { |