[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:
Whindmar Saksit 2024-06-05 02:12:58 +02:00 committed by GitHub
parent ee92f4b28e
commit 82721de625
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 29 deletions

View file

@ -245,20 +245,16 @@ Shell_DisplayNameOf(
DWORD
SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
{
LPCITEMIDLIST pidlLast;
if (psf)
{
psf->AddRef();
pidlLast = pidl;
}
else
{
SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
}
LPCITEMIDLIST pidlLast = pidl;
IShellFolder *release = NULL;
if (!psf)
return 0;
{
SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
if (!psf)
return 0;
release = psf;
}
DWORD oldAttrs = 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;
}
if (psf)
psf->Release();
if (release)
release->Release();
return dwAttributes;
}