[PSDK][SHELL32][SHELLEXT] Add SHCreateFileExtractIconW() to the PSDK and SAL-annotate it. (#4223)

Note that even if the MS PSDK and MSDN documents an hypothetical
ANSI version SHCreateFileExtractIconA(), this one never existed
exported in any Windows version!
This commit is contained in:
Hermès Bélusca-Maïto 2021-12-30 17:32:35 +01:00
parent 14dbd66d88
commit d7722f39fb
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 30 additions and 16 deletions

View file

@ -42,11 +42,6 @@ static FolderViewColumns g_ColumnDefs[] =
}; };
// Should fix our headers..
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR pszPath, DWORD dwFileAttributes, REFIID riid, void **ppv);
// Helper functions to translate a guid to a readable name // Helper functions to translate a guid to a readable name
bool GetInterfaceName(const WCHAR* InterfaceString, WCHAR* buf, size_t size) bool GetInterfaceName(const WCHAR* InterfaceString, WCHAR* buf, size_t size)
{ {

View file

@ -5,10 +5,6 @@
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org) * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
*/ */
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR pszPath, DWORD dwFileAttributes, REFIID riid, void **ppv);
struct FolderViewColumns struct FolderViewColumns
{ {
int iResource; int iResource;

View file

@ -345,15 +345,17 @@ HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
* Currently (march 2018) our shell does not handle IExtractIconW with an invalid path, * Currently (march 2018) our shell does not handle IExtractIconW with an invalid path,
* so this (wrong) implementation actually works better for us. * so this (wrong) implementation actually works better for us.
*/ */
EXTERN_C HRESULT EXTERN_C
HRESULT
WINAPI WINAPI
SHCreateFileExtractIconW(LPCWSTR pszPath, SHCreateFileExtractIconW(
DWORD dwFileAttributes, _In_ LPCWSTR pszFile,
REFIID riid, _In_ DWORD dwFileAttributes,
void **ppv) _In_ REFIID riid,
_Outptr_ void **ppv)
{ {
SHFILEINFOW shfi; SHFILEINFOW shfi;
ULONG_PTR firet = SHGetFileInfoW(pszPath, dwFileAttributes, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICONLOCATION); ULONG_PTR firet = SHGetFileInfoW(pszFile, dwFileAttributes, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICONLOCATION);
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
if (firet) if (firet)
{ {
@ -373,4 +375,3 @@ SHCreateFileExtractIconW(LPCWSTR pszPath,
return hr; return hr;
} }

View file

@ -2091,6 +2091,28 @@ SHBindToParent(
_Outptr_ LPVOID *ppv, _Outptr_ LPVOID *ppv,
_Outptr_opt_ PCUITEMID_CHILD *ppidlLast); _Outptr_opt_ PCUITEMID_CHILD *ppidlLast);
/****************************************************************************
* SHCreateFileExtractIcon API
*/
#if (NTDDI_VERSION >= NTDDI_WINXP)
// NOTE: Even if documented on MSDN, the SHCreateFileExtractIconA()
// ANSI function never existed on Windows!
HRESULT
WINAPI
SHCreateFileExtractIconW(
_In_ LPCWSTR pszFile,
_In_ DWORD dwFileAttributes,
_In_ REFIID riid,
_Outptr_ void **ppv);
#ifdef UNICODE
#define SHCreateFileExtractIcon SHCreateFileExtractIconW
#endif
#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
/**************************************************************************** /****************************************************************************
* SHDefExtractIcon API * SHDefExtractIcon API
*/ */