https://git.reactos.org/?p=reactos.git;a=commitdiff;h=29e1a41d0774c7eee432b…
commit 29e1a41d0774c7eee432b204a3eff26bd4cdd95b
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Sep 21 09:22:33 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Sep 21 09:22:33 2023 +0900
[SHELL32][SDK] Implement SHGetShellStyleHInstance (#5707)
Co-authored-by: Oleg Dubinskiy <oleg.dubinskij30(a)gmail.com>
This PR supersedes PR #3851.
- Implement SHGetShellStyleHInstance function.
- Add SHGetShellStyleHInstance prototype to <shlobj.h>.
CORE-17707
---
dll/win32/shell32/stubs.cpp | 11 -----------
dll/win32/shell32/utils.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
sdk/include/psdk/shlobj.h | 4 ++++
3 files changed, 46 insertions(+), 11 deletions(-)
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
*/