Commit febda816 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

shell32: COM clean up for IShellFolder2 in ShellFSFolder.

parent 57b28bce
...@@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); ...@@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell);
typedef struct { typedef struct {
IUnknown IUnknown_inner; IUnknown IUnknown_inner;
LONG ref; LONG ref;
const IShellFolder2Vtbl *lpvtblShellFolder; IShellFolder2 IShellFolder2_iface;
const IPersistFolder3Vtbl *lpvtblPersistFolder3; const IPersistFolder3Vtbl *lpvtblPersistFolder3;
const IDropTargetVtbl *lpvtblDropTarget; const IDropTargetVtbl *lpvtblDropTarget;
const ISFHelperVtbl *lpvtblSFHelper; const ISFHelperVtbl *lpvtblSFHelper;
...@@ -88,9 +88,9 @@ static inline IGenericSFImpl *impl_from_IUnknown(IUnknown *iface) ...@@ -88,9 +88,9 @@ static inline IGenericSFImpl *impl_from_IUnknown(IUnknown *iface)
return CONTAINING_RECORD(iface, IGenericSFImpl, IUnknown_inner); return CONTAINING_RECORD(iface, IGenericSFImpl, IUnknown_inner);
} }
static inline IGenericSFImpl *impl_from_IShellFolder2( IShellFolder2 *iface ) static inline IGenericSFImpl *impl_from_IShellFolder2(IShellFolder2 *iface)
{ {
return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblShellFolder)); return CONTAINING_RECORD(iface, IGenericSFImpl, IShellFolder2_iface);
} }
static inline IGenericSFImpl *impl_from_IPersistFolder3( IPersistFolder3 *iface ) static inline IGenericSFImpl *impl_from_IPersistFolder3( IPersistFolder3 *iface )
...@@ -112,8 +112,6 @@ static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface ) ...@@ -112,8 +112,6 @@ static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface )
/* /*
converts This to an interface pointer converts This to an interface pointer
*/ */
#define _IShellFolder_(This) ((IShellFolder*)&(This)->lpvtblShellFolder)
#define _IShellFolder2_(This) ((IShellFolder2*)&(This)->lpvtblShellFolder)
#define _IPersist_(This) (&(This)->lpvtblPersistFolder3) #define _IPersist_(This) (&(This)->lpvtblPersistFolder3)
#define _IPersistFolder_(This) (&(This)->lpvtblPersistFolder3) #define _IPersistFolder_(This) (&(This)->lpvtblPersistFolder3)
#define _IPersistFolder2_(This) (&(This)->lpvtblPersistFolder3) #define _IPersistFolder2_(This) (&(This)->lpvtblPersistFolder3)
...@@ -146,10 +144,8 @@ static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, vo ...@@ -146,10 +144,8 @@ static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, vo
if (IsEqualIID (riid, &IID_IUnknown)) if (IsEqualIID (riid, &IID_IUnknown))
*ppvObj = &This->IUnknown_inner; *ppvObj = &This->IUnknown_inner;
else if (IsEqualIID (riid, &IID_IShellFolder)) else if (IsEqualIID(riid, &IID_IShellFolder) || IsEqualIID(riid, &IID_IShellFolder2))
*ppvObj = _IShellFolder_ (This); *ppvObj = &This->IShellFolder2_iface;
else if (IsEqualIID (riid, &IID_IShellFolder2))
*ppvObj = _IShellFolder_ (This);
else if (IsEqualIID (riid, &IID_IPersist)) else if (IsEqualIID (riid, &IID_IPersist))
*ppvObj = _IPersist_ (This); *ppvObj = _IPersist_ (This);
else if (IsEqualIID (riid, &IID_IPersistFolder)) else if (IsEqualIID (riid, &IID_IPersistFolder))
...@@ -241,7 +237,7 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) ...@@ -241,7 +237,7 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
sf->ref = 0; sf->ref = 0;
sf->IUnknown_inner.lpVtbl = &unkvt; sf->IUnknown_inner.lpVtbl = &unkvt;
sf->lpvtblShellFolder = &sfvt; sf->IShellFolder2_iface.lpVtbl = &sfvt;
sf->lpvtblPersistFolder3 = &vt_FSFldr_PersistFolder3; sf->lpvtblPersistFolder3 = &vt_FSFldr_PersistFolder3;
sf->lpvtblDropTarget = &dtvt; sf->lpvtblDropTarget = &dtvt;
sf->lpvtblSFHelper = &shvt; sf->lpvtblSFHelper = &shvt;
...@@ -259,44 +255,32 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) ...@@ -259,44 +255,32 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
/************************************************************************** /**************************************************************************
* IShellFolder_fnQueryInterface * IShellFolder_fnQueryInterface
*
* PARAMETERS
* REFIID riid [in ] Requested InterfaceID
* LPVOID* ppvObject [out] Interface* to hold the result
*/ */
static HRESULT WINAPI static HRESULT WINAPI IShellFolder_fnQueryInterface(IShellFolder2 *iface, REFIID riid,
IShellFolder_fnQueryInterface (IShellFolder2 * iface, REFIID riid, void **ppvObj)
LPVOID * ppvObj)
{ {
IGenericSFImpl *This = impl_from_IShellFolder2(iface); IGenericSFImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj); return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj);
} }
/************************************************************************** /**************************************************************************
* IShellFolder_AddRef * IShellFolder_AddRef
*/ */
static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 *iface)
static ULONG WINAPI IShellFolder_fnAddRef (IShellFolder2 * iface)
{ {
IGenericSFImpl *This = impl_from_IShellFolder2(iface); IGenericSFImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(count=%u)\n", This, This->ref);
return IUnknown_AddRef(This->outer_unk); return IUnknown_AddRef(This->outer_unk);
} }
/************************************************************************** /**************************************************************************
* IShellFolder_fnRelease * IShellFolder_fnRelease
*/ */
static ULONG WINAPI IShellFolder_fnRelease (IShellFolder2 * iface) static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 *iface)
{ {
IGenericSFImpl *This = impl_from_IShellFolder2(iface); IGenericSFImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(count=%u)\n", This, This->ref);
return IUnknown_Release(This->outer_unk); return IUnknown_Release(This->outer_unk);
} }
...@@ -420,8 +404,8 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, ...@@ -420,8 +404,8 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
} else { } else {
/* it's the last element */ /* it's the last element */
if (pdwAttributes && *pdwAttributes) { if (pdwAttributes && *pdwAttributes) {
hr = SHELL32_GetItemAttributes (_IShellFolder_ (This), hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface,
pidlTemp, pdwAttributes); pidlTemp, pdwAttributes);
} }
} }
} }
...@@ -519,7 +503,7 @@ IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, ...@@ -519,7 +503,7 @@ IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam,
int nReturn; int nReturn;
TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2); TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2); nReturn = SHELL32_CompareIDs((IShellFolder *)&This->IShellFolder2_iface, lParam, pidl1, pidl2);
TRACE ("-- %i\n", nReturn); TRACE ("-- %i\n", nReturn);
return nReturn; return nReturn;
} }
...@@ -600,7 +584,7 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, ...@@ -600,7 +584,7 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
else { else {
while (cidl > 0 && *apidl) { while (cidl > 0 && *apidl) {
pdump (*apidl); pdump (*apidl);
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut); SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++; apidl++;
cidl--; cidl--;
} }
...@@ -1182,8 +1166,8 @@ ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen) ...@@ -1182,8 +1166,8 @@ ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen)
lstrcpynW (pwszName, wszNewFolder, uLen); lstrcpynW (pwszName, wszNewFolder, uLen);
hr = IShellFolder_fnEnumObjects (_IShellFolder2_ (This), 0, hr = IShellFolder2_EnumObjects(&This->IShellFolder2_iface, 0,
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum); SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);
if (penum) { if (penum) {
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
DWORD dwFetched; DWORD dwFetched;
...@@ -1237,8 +1221,8 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName, ...@@ -1237,8 +1221,8 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
lstrcpyW(wszNewDir, pwszName); lstrcpyW(wszNewDir, pwszName);
hres = IShellFolder_ParseDisplayName((IShellFolder*)&This->lpvtblShellFolder, hres = IShellFolder2_ParseDisplayName(&This->IShellFolder2_iface, hwnd, NULL, wszNewDir,
hwnd, NULL, wszNewDir, NULL, &relPidl, NULL); NULL, &relPidl, NULL);
if (SUCCEEDED(hres)) { if (SUCCEEDED(hres)) {
LPITEMIDLIST fullPidl; LPITEMIDLIST fullPidl;
......
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