https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c254a535c3792a570fbd…
commit 1c254a535c3792a570fbd5b049f6f175c4a891d7
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Sep 1 07:28:23 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Sep 1 07:28:23 2023 +0900
[SHLWAPI] Implement IUnknown_QueryServicePropertyBag (#5628)
CORE-9283
---
dll/win32/shlwapi/propbag.cpp | 33 ++++++++++++++++++++++++++++++++-
dll/win32/shlwapi/shlwapi.spec | 2 +-
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shlwapi/propbag.cpp b/dll/win32/shlwapi/propbag.cpp
index 227a0f3c296..c355647166e 100644
--- a/dll/win32/shlwapi/propbag.cpp
+++ b/dll/win32/shlwapi/propbag.cpp
@@ -1938,7 +1938,7 @@ EXTERN_C VOID FreeViewStatePropertyBagCache(VOID)
*
* @see
https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/get…
*/
-INT WINAPI
+EXTERN_C INT WINAPI
SHGetPerScreenResName(
_Out_writes_(cchBuffer) LPWSTR pszBuffer,
_In_ INT cchBuffer,
@@ -1953,3 +1953,34 @@ SHGetPerScreenResName(
StringCchPrintfW(pszBuffer, cchBuffer, L"%dx%d(%d)", cxWidth, cyHeight,
cMonitors);
return lstrlenW(pszBuffer);
}
+
+/**************************************************************************
+ * IUnknown_QueryServicePropertyBag (SHLWAPI.536)
+ *
+ * @param punk An IUnknown interface.
+ * @param flags The SHGVSPB_... flags of SHGetViewStatePropertyBag.
+ * @param riid IID of requested property bag interface.
+ * @param ppvObj Address to receive pointer to the new interface.
+ * @return An HRESULT value. S_OK on success, non-zero on failure.
+ * @see
https://geoffchappell.com/studies/windows/shell/shlwapi/api/util/iunknown/q…
+ */
+EXTERN_C HRESULT WINAPI
+IUnknown_QueryServicePropertyBag(
+ _In_ IUnknown *punk,
+ _In_ long flags,
+ _In_ REFIID riid,
+ _Outptr_ void **ppvObj)
+{
+ TRACE("%p 0x%x %p %p\n", punk, flags, &riid, ppvObj);
+
+ CComPtr<IShellBrowserService> pService;
+ HRESULT hr = IUnknown_QueryService(punk, SID_STopLevelBrowser,
IID_IShellBrowserService,
+ (void **)&pService);
+ if (FAILED(hr))
+ {
+ ERR("0x%X\n", hr);
+ return hr;
+ }
+
+ return pService->GetPropertyBag(flags, riid, ppvObj);
+}
diff --git a/dll/win32/shlwapi/shlwapi.spec b/dll/win32/shlwapi/shlwapi.spec
index 35f1844bf91..c7618d58fa9 100644
--- a/dll/win32/shlwapi/shlwapi.spec
+++ b/dll/win32/shlwapi/shlwapi.spec
@@ -533,7 +533,7 @@
533 stdcall -noname SHGetPerScreenResName(ptr long long)
534 stdcall -noname SHPropertyBag_ReadBOOL(ptr wstr ptr)
535 stdcall -noname SHPropertyBag_Delete(ptr wstr)
-536 stdcall -stub -noname IUnknown_QueryServicePropertyBag(ptr long ptr ptr)
+536 stdcall -noname IUnknown_QueryServicePropertyBag(ptr long ptr ptr)
537 stub -noname SHBoolSystemParametersInfo
538 stdcall -noname IUnknown_QueryServiceForWebBrowserApp(ptr ptr ptr)
539 stub -noname IUnknown_ShowBrowserBar