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

shell32: Use ifaces instead of vtbl pointers in IDesktopFolderImpl.

parent c8ba8b6d
...@@ -64,8 +64,8 @@ extern HRESULT WINAPI IEParseDisplayNameWithBCW(DWORD codepage, LPCWSTR lpszDisp ...@@ -64,8 +64,8 @@ extern HRESULT WINAPI IEParseDisplayNameWithBCW(DWORD codepage, LPCWSTR lpszDisp
*/ */
typedef struct { typedef struct {
const IShellFolder2Vtbl *lpVtbl; IShellFolder2 IShellFolder2_iface;
const IPersistFolder2Vtbl *lpVtblPF2; IPersistFolder2 IPersistFolder2_iface;
LONG ref; LONG ref;
/* both paths are parsible from the desktop */ /* both paths are parsible from the desktop */
...@@ -76,9 +76,14 @@ typedef struct { ...@@ -76,9 +76,14 @@ typedef struct {
BOOL fAcceptFmt; /* flag for pending Drop */ BOOL fAcceptFmt; /* flag for pending Drop */
} IDesktopFolderImpl; } IDesktopFolderImpl;
static inline IDesktopFolderImpl *impl_from_IShellFolder2(IShellFolder2 *iface)
{
return CONTAINING_RECORD(iface, IDesktopFolderImpl, IShellFolder2_iface);
}
static inline IDesktopFolderImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface ) static inline IDesktopFolderImpl *impl_from_IPersistFolder2( IPersistFolder2 *iface )
{ {
return (IDesktopFolderImpl *)((char*)iface - FIELD_OFFSET(IDesktopFolderImpl, lpVtblPF2)); return CONTAINING_RECORD(iface, IDesktopFolderImpl, IPersistFolder2_iface);
} }
static const shvheader desktop_header[] = { static const shvheader desktop_header[] = {
...@@ -98,7 +103,7 @@ static const shvheader desktop_header[] = { ...@@ -98,7 +103,7 @@ static const shvheader desktop_header[] = {
static HRESULT WINAPI ISF_Desktop_fnQueryInterface( static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj) IShellFolder2 * iface, REFIID riid, LPVOID * ppvObj)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj); TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
...@@ -114,7 +119,7 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface( ...@@ -114,7 +119,7 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
IsEqualIID (riid, &IID_IPersistFolder) || IsEqualIID (riid, &IID_IPersistFolder) ||
IsEqualIID (riid, &IID_IPersistFolder2)) IsEqualIID (riid, &IID_IPersistFolder2))
{ {
*ppvObj = &This->lpVtblPF2; *ppvObj = &This->IPersistFolder2_iface;
} }
if (*ppvObj) if (*ppvObj)
...@@ -148,7 +153,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, ...@@ -148,7 +153,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes) DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface; IShellFolder *shell_folder = (IShellFolder*)iface;
WCHAR szElement[MAX_PATH]; WCHAR szElement[MAX_PATH];
LPCWSTR szNext = NULL; LPCWSTR szNext = NULL;
...@@ -340,7 +345,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags) ...@@ -340,7 +345,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList) HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n",
This, hwndOwner, dwFlags, ppEnumIDList); This, hwndOwner, dwFlags, ppEnumIDList);
...@@ -360,7 +365,7 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface, ...@@ -360,7 +365,7 @@ static HRESULT WINAPI ISF_Desktop_fnEnumObjects (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut); This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
...@@ -374,7 +379,7 @@ static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface, ...@@ -374,7 +379,7 @@ static HRESULT WINAPI ISF_Desktop_fnBindToObject (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n",
This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut); This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
...@@ -389,7 +394,7 @@ static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface, ...@@ -389,7 +394,7 @@ static HRESULT WINAPI ISF_Desktop_fnBindToStorage (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 *iface, static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 *iface,
LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface; IShellFolder *shell_folder = (IShellFolder*)iface;
HRESULT hr; HRESULT hr;
...@@ -405,7 +410,7 @@ static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 *iface, ...@@ -405,7 +410,7 @@ static HRESULT WINAPI ISF_Desktop_fnCompareIDs (IShellFolder2 *iface,
static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
HWND hwndOwner, REFIID riid, LPVOID * ppvOut) HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
LPSHELLVIEW pShellView; LPSHELLVIEW pShellView;
HRESULT hr = E_INVALIDARG; HRESULT hr = E_INVALIDARG;
...@@ -446,7 +451,7 @@ static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface, ...@@ -446,7 +451,7 @@ static HRESULT WINAPI ISF_Desktop_fnCreateViewObject (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut) UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
IShellFolder *shell_folder = (IShellFolder*)iface; IShellFolder *shell_folder = (IShellFolder*)iface;
static const DWORD dwDesktopAttributes = static const DWORD dwDesktopAttributes =
...@@ -507,7 +512,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface, ...@@ -507,7 +512,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
IUnknown *pObj = NULL; IUnknown *pObj = NULL;
...@@ -581,7 +586,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface, ...@@ -581,7 +586,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
HRESULT hr = S_OK; HRESULT hr = S_OK;
LPWSTR pszPath; LPWSTR pszPath;
...@@ -741,7 +746,7 @@ static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, ...@@ -741,7 +746,7 @@ static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
HWND hwndOwner, LPCITEMIDLIST pidl, /* simple pidl */ HWND hwndOwner, LPCITEMIDLIST pidl, /* simple pidl */
LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut) LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p) stub\n", This, hwndOwner, pidl, FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p) stub\n", This, hwndOwner, pidl,
debugstr_w (lpName), dwFlags, pPidlOut); debugstr_w (lpName), dwFlags, pPidlOut);
...@@ -752,7 +757,7 @@ static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface, ...@@ -752,7 +757,7 @@ static HRESULT WINAPI ISF_Desktop_fnSetNameOf (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface, static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
GUID * pguid) GUID * pguid)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(%p) stub\n", This, pguid); FIXME ("(%p)->(%p) stub\n", This, pguid);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -760,7 +765,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface, ...@@ -760,7 +765,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID(IShellFolder2 *iface,
static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface, static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface,
IEnumExtraSearch ** ppenum) IEnumExtraSearch ** ppenum)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(%p) stub\n", This, ppenum); FIXME ("(%p)->(%p) stub\n", This, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -768,7 +773,7 @@ static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface, ...@@ -768,7 +773,7 @@ static HRESULT WINAPI ISF_Desktop_fnEnumSearches (IShellFolder2 *iface,
static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
DWORD reserved, ULONG * pSort, ULONG * pDisplay) DWORD reserved, ULONG * pSort, ULONG * pDisplay)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(%d %p %p)\n", This, reserved, pSort, pDisplay); TRACE ("(%p)->(%d %p %p)\n", This, reserved, pSort, pDisplay);
...@@ -782,7 +787,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface, ...@@ -782,7 +787,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState ( static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags) IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags); TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
...@@ -797,7 +802,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState ( ...@@ -797,7 +802,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv) LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(%p %p %p) stub\n", This, pidl, pscid, pv); FIXME ("(%p)->(%p %p %p) stub\n", This, pidl, pscid, pv);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -805,7 +810,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface, ...@@ -805,7 +810,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface, static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd) LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -845,7 +850,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface, ...@@ -845,7 +850,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID ( static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID (
IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid) IShellFolder2 * iface, UINT column, SHCOLUMNID * pscid)
{ {
IDesktopFolderImpl *This = (IDesktopFolderImpl *)iface; IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
FIXME ("(%p)->(%d %p) stub\n", This, column, pscid); FIXME ("(%p)->(%d %p) stub\n", This, column, pscid);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -882,21 +887,21 @@ static HRESULT WINAPI ISF_Desktop_IPersistFolder2_fnQueryInterface( ...@@ -882,21 +887,21 @@ static HRESULT WINAPI ISF_Desktop_IPersistFolder2_fnQueryInterface(
IPersistFolder2 *iface, REFIID riid, LPVOID *ppvObj) IPersistFolder2 *iface, REFIID riid, LPVOID *ppvObj)
{ {
IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface ); IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface );
return IShellFolder2_QueryInterface((IShellFolder2*)This, riid, ppvObj); return IShellFolder2_QueryInterface(&This->IShellFolder2_iface, riid, ppvObj);
} }
static ULONG WINAPI ISF_Desktop_IPersistFolder2_fnAddRef( static ULONG WINAPI ISF_Desktop_IPersistFolder2_fnAddRef(
IPersistFolder2 *iface) IPersistFolder2 *iface)
{ {
IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface ); IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface );
return IShellFolder2_AddRef((IShellFolder2*)This); return IShellFolder2_AddRef(&This->IShellFolder2_iface);
} }
static ULONG WINAPI ISF_Desktop_IPersistFolder2_fnRelease( static ULONG WINAPI ISF_Desktop_IPersistFolder2_fnRelease(
IPersistFolder2 *iface) IPersistFolder2 *iface)
{ {
IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface ); IDesktopFolderImpl *This = impl_from_IPersistFolder2( iface );
return IShellFolder2_Release((IShellFolder2*)This); return IShellFolder2_Release(&This->IShellFolder2_iface);
} }
static HRESULT WINAPI ISF_Desktop_IPersistFolder2_fnGetClassID( static HRESULT WINAPI ISF_Desktop_IPersistFolder2_fnGetClassID(
...@@ -958,8 +963,8 @@ HRESULT WINAPI ISF_Desktop_Constructor ( ...@@ -958,8 +963,8 @@ HRESULT WINAPI ISF_Desktop_Constructor (
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
sf->ref = 1; sf->ref = 1;
sf->lpVtbl = &vt_MCFldr_ShellFolder2; sf->IShellFolder2_iface.lpVtbl = &vt_MCFldr_ShellFolder2;
sf->lpVtblPF2 = &vt_IPersistFolder2; sf->IPersistFolder2_iface.lpVtbl = &vt_IPersistFolder2;
sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */ sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) ); sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
lstrcpyW( sf->sPathTarget, szMyPath ); lstrcpyW( sf->sPathTarget, szMyPath );
...@@ -973,5 +978,5 @@ HRESULT WINAPI ISF_Desktop_Constructor ( ...@@ -973,5 +978,5 @@ HRESULT WINAPI ISF_Desktop_Constructor (
} }
} }
return IUnknown_QueryInterface( (IShellFolder2*)cached_sf, riid, ppv ); return IUnknown_QueryInterface( &cached_sf->IShellFolder2_iface, riid, ppv );
} }
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