Fixes to IShellFolder::GetAttributesOf implementations, spotted by

silverblade_:
- a count of zero is allowed to GetAttributesOf if apidl is NULL
- SFGAO_VALIDATE must be cleared upon return
This commit is contained in:
Juan Lang 2005-05-10 08:28:11 +00:00 committed by Alexandre Julliard
parent f438056b5d
commit 2439b5fdda
4 changed files with 29 additions and 11 deletions

View File

@ -552,10 +552,13 @@ ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 * iface, UINT cidl, LPCITEMIDLI
HRESULT hr = S_OK;
TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
if ((!cidl) ||(!apidl) ||(!rgfInOut))
return E_INVALIDARG;
if (!rgfInOut)
return E_INVALIDARG;
if (cidl && !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
*rgfInOut = ~0;
@ -566,6 +569,8 @@ ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 * iface, UINT cidl, LPCITEMIDLI
apidl++;
cidl--;
}
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
TRACE("-- result=0x%08lx\n", *rgfInOut);
return hr;

View File

@ -430,10 +430,12 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK;
TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",
This, cidl, apidl, *rgfInOut);
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
if (!cidl || !apidl || !rgfInOut)
if (!rgfInOut)
return E_INVALIDARG;
if (cidl && !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
@ -446,6 +448,8 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
apidl++;
cidl--;
}
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
TRACE ("-- result=0x%08lx\n", *rgfInOut);

View File

@ -576,10 +576,12 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
HRESULT hr = S_OK;
TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl,
*rgfInOut);
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n", This, cidl, apidl,
rgfInOut, rgfInOut ? *rgfInOut : 0);
if ((!cidl) || (!apidl) || (!rgfInOut))
if (!rgfInOut)
return E_INVALIDARG;
if (cidl && !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
@ -591,6 +593,8 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
apidl++;
cidl--;
}
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
TRACE ("-- result=0x%08lx\n", *rgfInOut);

View File

@ -428,9 +428,12 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK;
TRACE ("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n", This, cidl, apidl, *rgfInOut);
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
if (!cidl || !apidl || !rgfInOut)
if (!rgfInOut)
return E_INVALIDARG;
if (cidl && !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
@ -443,6 +446,8 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
apidl++;
cidl--;
}
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
TRACE ("-- result=0x%08lx\n", *rgfInOut);
return hr;