https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4814dfea01b4651a58d8d…
commit 4814dfea01b4651a58d8d8951c02ec4fcf1ee8ea
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Sep 3 12:09:55 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Sep 3 12:09:55 2023 +0900
[BROWSEUI][SDK] Half-implement CShellBrowser::GetPropertyBag (#5635)
- Implement CShellBrowser::GetPropertyBag
a little by using SHGetViewStatePropertyBag.
- Add SHGetPathFromIDListWrapW prototype to
<shlwapi_undoc.h>.
CORE-9283
---
dll/win32/browseui/shellbrowser.cpp | 23 ++++++++++++++++++++++-
sdk/include/reactos/shlwapi_undoc.h | 1 +
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dll/win32/browseui/shellbrowser.cpp b/dll/win32/browseui/shellbrowser.cpp
index f6cb992dbb6..9c8edff1822 100644
--- a/dll/win32/browseui/shellbrowser.cpp
+++ b/dll/win32/browseui/shellbrowser.cpp
@@ -2387,12 +2387,33 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::QueryService(REFGUID
guidService, REFII
return E_NOINTERFACE;
}
+static BOOL _ILIsNetworkPlace(LPCITEMIDLIST pidl)
+{
+ WCHAR szPath[MAX_PATH];
+ return SHGetPathFromIDListWrapW(pidl, szPath) && PathIsUNCW(szPath);
+}
+
HRESULT STDMETHODCALLTYPE CShellBrowser::GetPropertyBag(long flags, REFIID riid, void
**ppvObject)
{
if (ppvObject == NULL)
return E_POINTER;
+
*ppvObject = NULL;
- return E_NOTIMPL;
+
+ LPITEMIDLIST pidl;
+ HRESULT hr = GetPidl(&pidl);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return E_FAIL;
+
+ // FIXME: pidl for Internet etc.
+
+ if (_ILIsNetworkPlace(pidl))
+ flags |= SHGVSPB_ROAM;
+
+ hr = SHGetViewStatePropertyBag(pidl, L"Shell", flags, riid, ppvObject);
+
+ ILFree(pidl);
+ return hr;
}
HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfoCount(UINT *pctinfo)
diff --git a/sdk/include/reactos/shlwapi_undoc.h b/sdk/include/reactos/shlwapi_undoc.h
index cd427170815..1cb5a064631 100644
--- a/sdk/include/reactos/shlwapi_undoc.h
+++ b/sdk/include/reactos/shlwapi_undoc.h
@@ -276,6 +276,7 @@ BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich);
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich);
VOID WINAPI FixSlashesAndColonW(LPWSTR);
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD dwClass);
+BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl, LPWSTR pszPath);
#ifdef __cplusplus
} /* extern "C" */