diff options
Diffstat (limited to 'image/decoders')
-rw-r--r-- | image/decoders/icon/win/nsIconChannel.cpp | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/image/decoders/icon/win/nsIconChannel.cpp b/image/decoders/icon/win/nsIconChannel.cpp index 9ddcbbc48..04680627a 100644 --- a/image/decoders/icon/win/nsIconChannel.cpp +++ b/image/decoders/icon/win/nsIconChannel.cpp @@ -29,11 +29,6 @@ #include "nsContentSecurityManager.h" #include "nsContentUtils.h" -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0600 - // we need windows.h to read out registry information... #include <windows.h> #include <shellapi.h> @@ -416,41 +411,27 @@ nsIconChannel::GetStockHIcon(nsIMozIconURI* aIconURI, { nsresult rv = NS_OK; - // We can only do this on Vista or above - HMODULE hShellDLL = ::LoadLibraryW(L"shell32.dll"); - decltype(SHGetStockIconInfo)* pSHGetStockIconInfo = - (decltype(SHGetStockIconInfo)*) ::GetProcAddress(hShellDLL, - "SHGetStockIconInfo"); - - if (pSHGetStockIconInfo) { - uint32_t desiredImageSize; - aIconURI->GetImageSize(&desiredImageSize); - nsAutoCString stockIcon; - aIconURI->GetStockIcon(stockIcon); - - SHSTOCKICONID stockIconID = GetStockIconIDForName(stockIcon); - if (stockIconID == SIID_INVALID) { - return NS_ERROR_NOT_AVAILABLE; - } + uint32_t desiredImageSize; + aIconURI->GetImageSize(&desiredImageSize); + nsAutoCString stockIcon; + aIconURI->GetStockIcon(stockIcon); - UINT infoFlags = SHGSI_ICON; - infoFlags |= GetSizeInfoFlag(desiredImageSize); + SHSTOCKICONID stockIconID = GetStockIconIDForName(stockIcon); + if (stockIconID == SIID_INVALID) { + return NS_ERROR_NOT_AVAILABLE; + } - SHSTOCKICONINFO sii = {0}; - sii.cbSize = sizeof(sii); - HRESULT hr = pSHGetStockIconInfo(stockIconID, infoFlags, &sii); + UINT infoFlags = SHGSI_ICON; + infoFlags |= GetSizeInfoFlag(desiredImageSize); - if (SUCCEEDED(hr)) { - *hIcon = sii.hIcon; - } else { - rv = NS_ERROR_FAILURE; - } - } else { - rv = NS_ERROR_NOT_AVAILABLE; - } + SHSTOCKICONINFO sii = {0}; + sii.cbSize = sizeof(sii); + HRESULT hr = SHGetStockIconInfo(stockIconID, infoFlags, &sii); - if (hShellDLL) { - ::FreeLibrary(hShellDLL); + if (SUCCEEDED(hr)) { + *hIcon = sii.hIcon; + } else { + rv = NS_ERROR_FAILURE; } return rv; |