Commit 1c86f979 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Get rid of some casts by using IShellFolder2 internally.

parent e4987828
......@@ -561,7 +561,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 *iface, U
while(cidl > 0 && *apidl) {
pdump(*apidl);
SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
......
......@@ -39,7 +39,7 @@ BOOL SHELL32_GetCustomFolderAttribute (LPCITEMIDLIST pidl, LPCWSTR pwszHeading,
LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) DECLSPEC_HIDDEN;
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes) DECLSPEC_HIDDEN;
HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes) DECLSPEC_HIDDEN;
HRESULT SHELL32_GetItemAttributes (IShellFolder2 *folder, LPCITEMIDLIST pidl, DWORD *attributes) DECLSPEC_HIDDEN;
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut,
DWORD dwOutLen) DECLSPEC_HIDDEN;
......
......@@ -155,7 +155,6 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
{
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface;
WCHAR szElement[MAX_PATH];
LPCWSTR szNext = NULL;
LPITEMIDLIST pidlTemp = NULL;
......@@ -268,7 +267,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
else
{
if (pdwAttributes && *pdwAttributes)
hr = SHELL32_GetItemAttributes(shell_folder, pidlTemp, pdwAttributes);
hr = SHELL32_GetItemAttributes(iface, pidlTemp, pdwAttributes);
}
}
......@@ -454,7 +453,6 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
{
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface;
static const DWORD dwDesktopAttributes =
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
......@@ -484,7 +482,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
} else if (_ILIsMyComputer(*apidl)) {
*rgfInOut &= dwMyComputerAttributes;
} else {
SHELL32_GetItemAttributes ( shell_folder, *apidl, rgfInOut);
SHELL32_GetItemAttributes(iface, *apidl, rgfInOut);
}
apidl++;
cidl--;
......
......@@ -342,10 +342,8 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
} else {
/* it's the last element */
if (pdwAttributes && *pdwAttributes) {
hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface,
pidlTemp, pdwAttributes);
}
if (pdwAttributes && *pdwAttributes)
hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
}
}
}
......@@ -511,19 +509,19 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
*rgfInOut = ~0;
if(cidl == 0){
IShellFolder *psfParent = NULL;
IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, &rpidl);
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr)) {
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
IShellFolder_Release(psfParent);
SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder2_Release(parent);
}
}
else {
while (cidl > 0 && *apidl) {
pdump (*apidl);
SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
......
......@@ -232,8 +232,7 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
else
{
if (pdwAttributes && *pdwAttributes)
SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, pidlTemp,
pdwAttributes);
SHELL32_GetItemAttributes (&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
hr = S_OK;
}
......@@ -477,18 +476,18 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
*rgfInOut = ~0;
if(cidl == 0){
IShellFolder *psfParent = NULL;
IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, &rpidl);
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr)) {
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
IShellFolder_Release(psfParent);
SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder2_Release(parent);
}
} else {
while (cidl > 0 && *apidl) {
pdump (*apidl);
SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, *apidl, rgfInOut);
SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
......
......@@ -220,8 +220,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
else
{
if (pdwAttributes && *pdwAttributes)
hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, pidlTemp,
pdwAttributes);
hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
}
}
......@@ -364,14 +363,14 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
if (cidl == 0)
{
IShellFolder *psfParent = NULL;
IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (void**)&psfParent, &rpidl);
hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr))
{
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
IShellFolder_Release(psfParent);
SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder2_Release(parent);
}
}
else
......@@ -379,7 +378,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
while (cidl > 0 && *apidl)
{
pdump (*apidl);
SHELL32_GetItemAttributes ((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
......
......@@ -389,7 +389,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
* According to the MSDN documentation this function should not set flags. It claims only to reset flags when necessary.
* However it turns out the native shell32.dll _sets_ flags in several cases - so do we.
*/
HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
{
DWORD dwAttributes;
BOOL has_guid;
......@@ -435,8 +435,7 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
/* File attributes are not present in the internal PIDL structure, so get them from the file system. */
HRESULT hr = IShellFolder_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
HRESULT hr = IShellFolder2_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
if (SUCCEEDED(hr)) {
hr = StrRetToBufW(&strret, pidl, path, MAX_PATH);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment