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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-11-27 17:01:48 +03:00 committed by Alexandre Julliard
parent e49878289b
commit 1c86f97985
7 changed files with 25 additions and 32 deletions

View File

@ -561,7 +561,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 *iface, U
while(cidl > 0 && *apidl) { while(cidl > 0 && *apidl) {
pdump(*apidl); pdump(*apidl);
SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut); SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++; apidl++;
cidl--; cidl--;
} }

View File

@ -39,7 +39,7 @@ BOOL SHELL32_GetCustomFolderAttribute (LPCITEMIDLIST pidl, LPCWSTR pwszHeading,
LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) DECLSPEC_HIDDEN; LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) DECLSPEC_HIDDEN;
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut, HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes) DECLSPEC_HIDDEN; 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, HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut,
DWORD dwOutLen) DECLSPEC_HIDDEN; DWORD dwOutLen) DECLSPEC_HIDDEN;

View File

@ -155,7 +155,6 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
{ {
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface); IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface;
WCHAR szElement[MAX_PATH]; WCHAR szElement[MAX_PATH];
LPCWSTR szNext = NULL; LPCWSTR szNext = NULL;
LPITEMIDLIST pidlTemp = NULL; LPITEMIDLIST pidlTemp = NULL;
@ -268,7 +267,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
else else
{ {
if (pdwAttributes && *pdwAttributes) 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) UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
{ {
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface); IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface;
static const DWORD dwDesktopAttributes = static const DWORD dwDesktopAttributes =
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
@ -484,7 +482,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
} else if (_ILIsMyComputer(*apidl)) { } else if (_ILIsMyComputer(*apidl)) {
*rgfInOut &= dwMyComputerAttributes; *rgfInOut &= dwMyComputerAttributes;
} else { } else {
SHELL32_GetItemAttributes ( shell_folder, *apidl, rgfInOut); SHELL32_GetItemAttributes(iface, *apidl, rgfInOut);
} }
apidl++; apidl++;
cidl--; cidl--;

View File

@ -342,10 +342,8 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes); &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
} else { } else {
/* it's the last element */ /* it's the last element */
if (pdwAttributes && *pdwAttributes) { if (pdwAttributes && *pdwAttributes)
hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
pidlTemp, pdwAttributes);
}
} }
} }
} }
@ -511,19 +509,19 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
*rgfInOut = ~0; *rgfInOut = ~0;
if(cidl == 0){ if(cidl == 0){
IShellFolder *psfParent = NULL; IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = 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)) { if(SUCCEEDED(hr)) {
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut); SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder_Release(psfParent); IShellFolder2_Release(parent);
} }
} }
else { else {
while (cidl > 0 && *apidl) { while (cidl > 0 && *apidl) {
pdump (*apidl); pdump (*apidl);
SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut); SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++; apidl++;
cidl--; cidl--;
} }

View File

@ -232,8 +232,7 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
else else
{ {
if (pdwAttributes && *pdwAttributes) if (pdwAttributes && *pdwAttributes)
SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, pidlTemp, SHELL32_GetItemAttributes (&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
pdwAttributes);
hr = S_OK; hr = S_OK;
} }
@ -477,18 +476,18 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
*rgfInOut = ~0; *rgfInOut = ~0;
if(cidl == 0){ if(cidl == 0){
IShellFolder *psfParent = NULL; IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = 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)) { if(SUCCEEDED(hr)) {
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut); SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder_Release(psfParent); IShellFolder2_Release(parent);
} }
} else { } else {
while (cidl > 0 && *apidl) { while (cidl > 0 && *apidl) {
pdump (*apidl); pdump (*apidl);
SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, *apidl, rgfInOut); SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++; apidl++;
cidl--; cidl--;
} }

View File

@ -220,8 +220,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
else else
{ {
if (pdwAttributes && *pdwAttributes) if (pdwAttributes && *pdwAttributes)
hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, pidlTemp, hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
pdwAttributes);
} }
} }
@ -364,14 +363,14 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
if (cidl == 0) if (cidl == 0)
{ {
IShellFolder *psfParent = NULL; IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = 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)) if(SUCCEEDED(hr))
{ {
SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut); SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
IShellFolder_Release(psfParent); IShellFolder2_Release(parent);
} }
} }
else else
@ -379,7 +378,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
while (cidl > 0 && *apidl) while (cidl > 0 && *apidl)
{ {
pdump (*apidl); pdump (*apidl);
SHELL32_GetItemAttributes ((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut); SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++; apidl++;
cidl--; cidl--;
} }

View File

@ -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. * 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. * 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; DWORD dwAttributes;
BOOL has_guid; 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. */ /* 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)) { if (SUCCEEDED(hr)) {
hr = StrRetToBufW(&strret, pidl, path, MAX_PATH); hr = StrRetToBufW(&strret, pidl, path, MAX_PATH);