[SHELL32][SDK] Implement SHGetShellStyleHInstance (#5707)

Co-authored-by: Oleg Dubinskiy <oleg.dubinskij30@gmail.com>
This PR supersedes PR #3851.
- Implement SHGetShellStyleHInstance function.
- Add SHGetShellStyleHInstance prototype to <shlobj.h>.
CORE-17707
This commit is contained in:
Katayama Hirofumi MZ 2023-09-21 09:22:33 +09:00 committed by GitHub
parent 6c55a3aa2a
commit 29e1a41d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 11 deletions

View file

@ -1202,14 +1202,3 @@ DWORD WINAPI SHGetComputerDisplayNameW(DWORD param1, DWORD param2, DWORD param3,
FIXME("SHGetComputerDisplayNameW() stub\n");
return E_FAIL;
}
/*
* Unimplemented
*/
EXTERN_C HINSTANCE
WINAPI
SHGetShellStyleHInstance(VOID)
{
FIXME("SHGetShellStyleHInstance() stub\n");
return NULL;
}

View file

@ -9,6 +9,48 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/*************************************************************************
* SHGetShellStyleHInstance (SHELL32.749)
*/
EXTERN_C HINSTANCE
WINAPI
SHGetShellStyleHInstance(VOID)
{
HINSTANCE hInst = NULL;
WCHAR szPath[MAX_PATH], szColorName[100];
HRESULT hr;
CStringW strShellStyle;
TRACE("SHGetShellStyleHInstance called\n");
/* First, attempt to load the shellstyle dll from the current active theme */
hr = GetCurrentThemeName(szPath, _countof(szPath), szColorName, _countof(szColorName), NULL, 0);
if (FAILED(hr))
goto DoDefault;
/* Strip the theme filename */
PathRemoveFileSpecW(szPath);
strShellStyle = szPath;
strShellStyle += L"\\Shell\\";
strShellStyle += szColorName;
strShellStyle += L"\\ShellStyle.dll";
hInst = LoadLibraryExW(strShellStyle, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hInst)
return hInst;
/* Otherwise, use the version stored in the System32 directory */
DoDefault:
if (!ExpandEnvironmentStringsW(L"%SystemRoot%\\System32\\ShellStyle.dll",
szPath, _countof(szPath)))
{
ERR("Expand failed\n");
return NULL;
}
return LoadLibraryExW(szPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
}
/*************************************************************************
* SHCreatePropertyBag (SHELL32.715)
*/

View file

@ -336,6 +336,10 @@ SHOpenFolderAndSelectItems(
int WINAPI PathCleanupSpec(_In_opt_ LPCWSTR, _Inout_ LPWSTR);
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) && (_WIN32_WINNT <= _WIN32_WINNT_WS03)
HINSTANCE WINAPI SHGetShellStyleHInstance(VOID);
#endif
/*****************************************************************************
* IContextMenu interface
*/