[BROWSEUI][SDK] Half-implement CShellBrowser::GetPropertyBag (#5635)

- Implement CShellBrowser::GetPropertyBag
  a little by using SHGetViewStatePropertyBag.
- Add SHGetPathFromIDListWrapW prototype to
<shlwapi_undoc.h>.
CORE-9283
This commit is contained in:
Katayama Hirofumi MZ 2023-09-03 12:09:55 +09:00 committed by GitHub
parent 8dbb800358
commit 4814dfea01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -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)

View file

@ -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" */