Bug 1302023 - Disable a workaround for Windows 10 Default apps on build 14965 or later. r=jimm a=jcristau
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 12 Nov 2016 01:32:24 +0900
changeset 352948 3bcabc44afd09ffe1b19df9bb1fa5625aabc0376
parent 352947 eb32710bb76a77aaf7951e8d6d3c990e4c92904b
child 352949 c8944ebd2973928a27af69c3caa2ab95445b3406
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, jcristau
bugs1302023, 14965
milestone52.0a2
Bug 1302023 - Disable a workaround for Windows 10 Default apps on build 14965 or later. r=jimm a=jcristau MozReview-Commit-ID: 5mKkr12n9HP
browser/components/shell/nsWindowsShellService.cpp
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -641,35 +641,36 @@ nsWindowsShellService::LaunchControlPane
     pAARUI->Release();
   }
   return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult
 nsWindowsShellService::LaunchControlPanelDefaultPrograms()
 {
-  // Default Programs is a Vista+ feature
-  if (!IsVistaOrLater()) {
+  // 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)) {
     return NS_ERROR_FAILURE;
   }
   LPCWSTR controlEXE = L"control.exe";
   if (wcslen(controlEXEPath) + wcslen(controlEXE) >= MAX_PATH) {
     return NS_ERROR_FAILURE;
   }
   if (!PathAppendW(controlEXEPath, controlEXE)) {
     return NS_ERROR_FAILURE;
   }
 
-  WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram";
+  WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page "
+    "pageDefaultProgram\\pageAdvancedSettings?pszAppName=" APP_REG_NAME;
   STARTUPINFOW si = {sizeof(si), 0};
   si.dwFlags = STARTF_USESHOWWINDOW;
   si.wShowWindow = SW_SHOWDEFAULT;
   PROCESS_INFORMATION pi = {0};
   if (!CreateProcessW(controlEXEPath, params, nullptr, nullptr, FALSE,
                       0, nullptr, nullptr, &si, &pi)) {
     return NS_ERROR_FAILURE;
   }
@@ -723,18 +724,20 @@ SettingsAppBelievesConnected()
   }
 
   return !!value;
 }
 
 nsresult
 nsWindowsShellService::LaunchModernSettingsDialogDefaultApps()
 {
-  if (!IsWindowsLogonConnected() && SettingsAppBelievesConnected()) {
-    // Use the classic Control Panel to work around a bug of Windows 10.
+  if (!IsWindowsBuildOrLater(14965) &&
+      !IsWindowsLogonConnected() && SettingsAppBelievesConnected()) {
+    // Use the classic Control Panel to work around a bug of older
+    // builds of Windows 10.
     return LaunchControlPanelDefaultPrograms();
   }
 
   IApplicationActivationManager* pActivator;
   HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
                                 nullptr,
                                 CLSCTX_INPROC,
                                 IID_IApplicationActivationManager,