mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
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 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
29923b25c3
commit
82def0e31f
@ -27,6 +27,10 @@
|
||||
|
||||
#define LOG(args) MOZ_LOG(mLog, mozilla::LogLevel::Debug, args)
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# define ASSOCF_NONE 0x0
|
||||
#endif
|
||||
|
||||
// helper methods: forward declarations...
|
||||
static nsresult GetExtensionFromWindowsMimeDatabase(const nsACString& aMimeType,
|
||||
nsString& aFileExtension);
|
||||
@ -300,11 +304,17 @@ nsresult nsOSHelperAppService::GetDefaultAppInfo(
|
||||
nsCOMPtr<nsILocalFileWin> lf = new nsLocalFile();
|
||||
rv = lf->InitWithCommandLine(handlerCommand);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// 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) && friendlyNameSize > 1) {
|
||||
aDefaultDescription.Assign(friendlyName, friendlyNameSize - 1);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user