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
--- 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;