Bug 1263176 - get appropriate description on Windows 8/10 for apps/filetypes delegated via TWINUI / Windows Storage types, r=emk,mhowell
☠☠ backed out by d214c50eaa95 ☠ ☠
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 19 Nov 2019 01:08:41 +0000
changeset 502522 841580134756b1671f056a4e1e7d847436ea3aa5
parent 502521 53ca0eff415ed67f2d735f8f81588db69dd7d8c6
child 502523 dbb0fff9e65ce321b9bf2a7df7edb78cdc4288e2
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, mhowell
bugs1263176
milestone72.0a1
Bug 1263176 - get appropriate description on Windows 8/10 for apps/filetypes delegated via TWINUI / Windows Storage types, r=emk,mhowell Differential Revision: https://phabricator.services.mozilla.com/D53370
uriloader/exthandler/win/nsOSHelperAppService.cpp
--- a/uriloader/exthandler/win/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp
@@ -295,20 +295,26 @@ nsresult nsOSHelperAppService::GetDefaul
   // XXX FIXME: If this fails, the UI will display the full command
   // string.
   // There are some rare cases this can happen - ["url.dll" -foo]
   // for example won't resolve correctly to the system dir. The
   // subsequent launch of the helper app will work though.
   nsCOMPtr<nsILocalFileWin> lf = new nsLocalFile();
   rv = lf->InitWithCommandLine(handlerCommand);
   NS_ENSURE_SUCCESS(rv, rv);
+  lf.forget(aDefaultApplication);
 
-  // The "FileDescription" field contains the actual name of the application.
-  lf->GetVersionInfoField("FileDescription", aDefaultDescription);
-  lf.forget(aDefaultApplication);
+  wchar_t friendlyName[1024];
+  DWORD friendlyNameSize = 1024;
+  HRESULT hr = AssocQueryString(ASSOCF_NONE, ASSOCSTR_FRIENDLYAPPNAME,
+                                PromiseFlatString(aAppInfo).get(), NULL,
+                                friendlyName, &friendlyNameSize);
+  if (SUCCEEDED(hr)) {
+    aDefaultDescription.Assign(friendlyName);
+  }
 
   return NS_OK;
 }
 
 already_AddRefed<nsMIMEInfoWin> nsOSHelperAppService::GetByExtension(
     const nsString& aFileExt, const char* aTypeHint) {
   if (aFileExt.IsEmpty()) return nullptr;