mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[SHELL32] Don't add folder verbs to non-folder RegItems (#6991)
RegItems that pretend to be files should not have Folder verbs
This commit is contained in:
parent
ee92f4b28e
commit
82721de625
2 changed files with 24 additions and 29 deletions
|
@ -97,19 +97,22 @@ HRESULT CGuidItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder,
|
||||||
GUID *pGuid = _ILGetGUIDPointer(apidl[0]);
|
GUID *pGuid = _ILGetGUIDPointer(apidl[0]);
|
||||||
if (pGuid)
|
if (pGuid)
|
||||||
{
|
{
|
||||||
LPOLESTR pwszCLSID;
|
|
||||||
WCHAR key[60];
|
WCHAR key[60];
|
||||||
|
|
||||||
wcscpy(key, L"CLSID\\");
|
wcscpy(key, L"CLSID\\");
|
||||||
HRESULT hr = StringFromCLSID(*pGuid, &pwszCLSID);
|
StringFromGUID2(*pGuid, &key[6], 39);
|
||||||
if (hr == S_OK)
|
AddClassKeyToArray(key, hKeys, &cKeys);
|
||||||
{
|
|
||||||
wcscpy(&key[6], pwszCLSID);
|
|
||||||
AddClassKeyToArray(key, hKeys, &cKeys);
|
|
||||||
CoTaskMemFree(pwszCLSID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AddClassKeyToArray(L"Folder", hKeys, &cKeys);
|
|
||||||
|
// FIXME: CRegFolder should be aggregated by its outer folder and should
|
||||||
|
// provide the attributes for all required non-registry folders.
|
||||||
|
// It currently does not so we have to ask the outer folder ourself so
|
||||||
|
// that we get the correct attributes for My Computer etc.
|
||||||
|
CComPtr<IShellFolder> pOuterSF;
|
||||||
|
SHBindToObject(NULL, pidlFolder, IID_PPV_ARG(IShellFolder, &pOuterSF));
|
||||||
|
|
||||||
|
SFGAOF att = (psf && cidl) ? SHGetAttributes(pOuterSF ? pOuterSF.p : psf, apidl[0], SFGAO_FOLDER) : 0;
|
||||||
|
if (att & SFGAO_FOLDER)
|
||||||
|
AddClassKeyToArray(L"Folder", hKeys, &cKeys);
|
||||||
|
|
||||||
return CDefFolderMenu_Create2(pidlFolder, hwnd, cidl, apidl, psf, RegFolderContextMenuCallback, cKeys, hKeys, ppcm);
|
return CDefFolderMenu_Create2(pidlFolder, hwnd, cidl, apidl, psf, RegFolderContextMenuCallback, cKeys, hKeys, ppcm);
|
||||||
}
|
}
|
||||||
|
@ -390,10 +393,7 @@ HRESULT CRegFolder::GetGuidItemAttributes (LPCITEMIDLIST pidl, LPDWORD pdwAttrib
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In any case, links can be created */
|
/* In any case, links can be created */
|
||||||
if (*pdwAttributes == NULL)
|
*pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
|
||||||
{
|
|
||||||
*pdwAttributes |= (dwAttributes & SFGAO_CANLINK);
|
|
||||||
}
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,20 +245,16 @@ Shell_DisplayNameOf(
|
||||||
DWORD
|
DWORD
|
||||||
SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
|
SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
|
||||||
{
|
{
|
||||||
LPCITEMIDLIST pidlLast;
|
LPCITEMIDLIST pidlLast = pidl;
|
||||||
|
IShellFolder *release = NULL;
|
||||||
if (psf)
|
|
||||||
{
|
|
||||||
psf->AddRef();
|
|
||||||
pidlLast = pidl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!psf)
|
if (!psf)
|
||||||
return 0;
|
{
|
||||||
|
SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
|
||||||
|
if (!psf)
|
||||||
|
return 0;
|
||||||
|
release = psf;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD oldAttrs = dwAttributes;
|
DWORD oldAttrs = dwAttributes;
|
||||||
if (FAILED(psf->GetAttributesOf(1, &pidlLast, &dwAttributes)))
|
if (FAILED(psf->GetAttributesOf(1, &pidlLast, &dwAttributes)))
|
||||||
|
@ -276,9 +272,8 @@ SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAt
|
||||||
dwAttributes |= SFGAO_STORAGEANCESTOR;
|
dwAttributes |= SFGAO_STORAGEANCESTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psf)
|
if (release)
|
||||||
psf->Release();
|
release->Release();
|
||||||
|
|
||||||
return dwAttributes;
|
return dwAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue