diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp index a49a506928e..a048e2c5274 100644 --- a/dll/win32/shell32/stubs.cpp +++ b/dll/win32/shell32/stubs.cpp @@ -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; -} diff --git a/dll/win32/shell32/utils.cpp b/dll/win32/shell32/utils.cpp index 4140fcaa274..edb1f64b87d 100644 --- a/dll/win32/shell32/utils.cpp +++ b/dll/win32/shell32/utils.cpp @@ -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) */ diff --git a/sdk/include/psdk/shlobj.h b/sdk/include/psdk/shlobj.h index 26745ce3390..601fd58f30c 100644 --- a/sdk/include/psdk/shlobj.h +++ b/sdk/include/psdk/shlobj.h @@ -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 */