mirror of
https://github.com/reactos/reactos.git
synced 2024-05-15 17:51:58 +00:00
[SHELL32] SHOpenFolderAndSelectItems should handle children correctly (#6151)
- Free pidl from ILCombine. - ILGetNext will never return NULL on valid input, it is not the correct way to check.
This commit is contained in:
parent
f9c93888b7
commit
1408de02ce
|
@ -372,17 +372,21 @@ SHOpenFolderAndSelectItems(PCIDLIST_ABSOLUTE pidlFolder,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ERR("SHOpenFolderAndSelectItems() is hackplemented\n");
|
ERR("SHOpenFolderAndSelectItems() is hackplemented\n");
|
||||||
|
CComHeapPtr<ITEMIDLIST> freeItem;
|
||||||
PCIDLIST_ABSOLUTE pidlItem;
|
PCIDLIST_ABSOLUTE pidlItem;
|
||||||
if (cidl)
|
if (cidl)
|
||||||
{
|
{
|
||||||
/* Firefox sends a full pidl here dispite the fact it is a PCUITEMID_CHILD_ARRAY -_- */
|
/* Firefox sends a full pidl here dispite the fact it is a PCUITEMID_CHILD_ARRAY -_- */
|
||||||
if (ILGetNext(apidl[0]) != NULL)
|
if (!ILIsSingle(apidl[0]))
|
||||||
{
|
{
|
||||||
pidlItem = apidl[0];
|
pidlItem = apidl[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pidlItem = ILCombine(pidlFolder, apidl[0]);
|
HRESULT hr = SHILCombine(pidlFolder, apidl[0], &pidlItem);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
freeItem.Attach(const_cast<PIDLIST_ABSOLUTE>(pidlItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -572,6 +572,10 @@ struct CCoInit
|
||||||
#define S_GREATERTHAN S_FALSE
|
#define S_GREATERTHAN S_FALSE
|
||||||
#define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
|
#define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
|
||||||
|
|
||||||
|
static inline BOOL ILIsSingle(LPCITEMIDLIST pidl)
|
||||||
|
{
|
||||||
|
return pidl == ILFindLastID(pidl);
|
||||||
|
}
|
||||||
|
|
||||||
static inline PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const* pida)
|
static inline PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const* pida)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue