[SHELL32] Implement SHBrowseForFolder items contextmenu (#6952)

* [SHELL32] Implement SHBrowseForFolder items contextmenu

CORE-16944 CORE-19597
This commit is contained in:
Whindmar Saksit 2024-05-30 17:53:44 +02:00 committed by GitHub
parent 6d7648d723
commit 3da9e7e251
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 250 additions and 0 deletions

View file

@ -1294,3 +1294,30 @@ SHGetRealIDL(
return hr;
}
static HRESULT
GetCommandStringA(_In_ IContextMenu *pCM, _In_ UINT_PTR Id, _In_ UINT GCS, _Out_writes_(cchMax) LPSTR Buf, _In_ UINT cchMax)
{
HRESULT hr = pCM->GetCommandString(Id, GCS & ~GCS_UNICODE, NULL, Buf, cchMax);
if (FAILED(hr))
{
WCHAR buf[MAX_PATH];
hr = pCM->GetCommandString(Id, GCS | GCS_UNICODE, NULL, (LPSTR)buf, _countof(buf));
if (SUCCEEDED(hr))
hr = SHUnicodeToAnsi(buf, Buf, cchMax) > 0 ? S_OK : E_FAIL;
}
return hr;
}
UINT
GetDfmCmd(_In_ IContextMenu *pCM, _In_ LPCSTR verba)
{
CHAR buf[MAX_PATH];
if (IS_INTRESOURCE(verba))
{
if (FAILED(GetCommandStringA(pCM, LOWORD(verba), GCS_VERB, buf, _countof(buf))))
return 0;
verba = buf;
}
return MapVerbToDfmCmd(verba); // Returns DFM_CMD_* or 0
}