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

shell32: Use an iface instead of a vtbl pointer in IShellItemArrayImpl.

parent ec1f8b53
...@@ -656,18 +656,23 @@ HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv) ...@@ -656,18 +656,23 @@ HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv)
* IShellItemArray implementation * IShellItemArray implementation
*/ */
typedef struct { typedef struct {
const IShellItemArrayVtbl *lpVtbl; IShellItemArray IShellItemArray_iface;
LONG ref; LONG ref;
IShellItem **array; IShellItem **array;
DWORD item_count; DWORD item_count;
} IShellItemArrayImpl; } IShellItemArrayImpl;
static inline IShellItemArrayImpl *impl_from_IShellItemArray(IShellItemArray *iface)
{
return CONTAINING_RECORD(iface, IShellItemArrayImpl, IShellItemArray_iface);
}
static HRESULT WINAPI IShellItemArray_fnQueryInterface(IShellItemArray *iface, static HRESULT WINAPI IShellItemArray_fnQueryInterface(IShellItemArray *iface,
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvObject); TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvObject);
*ppvObject = NULL; *ppvObject = NULL;
...@@ -688,7 +693,7 @@ static HRESULT WINAPI IShellItemArray_fnQueryInterface(IShellItemArray *iface, ...@@ -688,7 +693,7 @@ static HRESULT WINAPI IShellItemArray_fnQueryInterface(IShellItemArray *iface,
static ULONG WINAPI IShellItemArray_fnAddRef(IShellItemArray *iface) static ULONG WINAPI IShellItemArray_fnAddRef(IShellItemArray *iface)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
LONG ref = InterlockedIncrement(&This->ref); LONG ref = InterlockedIncrement(&This->ref);
TRACE("%p - ref %d\n", This, ref); TRACE("%p - ref %d\n", This, ref);
...@@ -697,7 +702,7 @@ static ULONG WINAPI IShellItemArray_fnAddRef(IShellItemArray *iface) ...@@ -697,7 +702,7 @@ static ULONG WINAPI IShellItemArray_fnAddRef(IShellItemArray *iface)
static ULONG WINAPI IShellItemArray_fnRelease(IShellItemArray *iface) static ULONG WINAPI IShellItemArray_fnRelease(IShellItemArray *iface)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
TRACE("%p - ref %d\n", This, ref); TRACE("%p - ref %d\n", This, ref);
...@@ -723,7 +728,7 @@ static HRESULT WINAPI IShellItemArray_fnBindToHandler(IShellItemArray *iface, ...@@ -723,7 +728,7 @@ static HRESULT WINAPI IShellItemArray_fnBindToHandler(IShellItemArray *iface,
REFIID riid, REFIID riid,
void **ppvOut) void **ppvOut)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
FIXME("Stub: %p (%p, %s, %s, %p)\n", FIXME("Stub: %p (%p, %s, %s, %p)\n",
This, pbc, shdebugstr_guid(bhid), shdebugstr_guid(riid), ppvOut); This, pbc, shdebugstr_guid(bhid), shdebugstr_guid(riid), ppvOut);
...@@ -735,7 +740,7 @@ static HRESULT WINAPI IShellItemArray_fnGetPropertyStore(IShellItemArray *iface, ...@@ -735,7 +740,7 @@ static HRESULT WINAPI IShellItemArray_fnGetPropertyStore(IShellItemArray *iface,
REFIID riid, REFIID riid,
void **ppv) void **ppv)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
FIXME("Stub: %p (%x, %s, %p)\n", This, flags, shdebugstr_guid(riid), ppv); FIXME("Stub: %p (%x, %s, %p)\n", This, flags, shdebugstr_guid(riid), ppv);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -746,7 +751,7 @@ static HRESULT WINAPI IShellItemArray_fnGetPropertyDescriptionList(IShellItemArr ...@@ -746,7 +751,7 @@ static HRESULT WINAPI IShellItemArray_fnGetPropertyDescriptionList(IShellItemArr
REFIID riid, REFIID riid,
void **ppv) void **ppv)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
FIXME("Stub: %p (%p, %s, %p)\n", FIXME("Stub: %p (%p, %s, %p)\n",
This, keyType, shdebugstr_guid(riid), ppv); This, keyType, shdebugstr_guid(riid), ppv);
...@@ -758,7 +763,7 @@ static HRESULT WINAPI IShellItemArray_fnGetAttributes(IShellItemArray *iface, ...@@ -758,7 +763,7 @@ static HRESULT WINAPI IShellItemArray_fnGetAttributes(IShellItemArray *iface,
SFGAOF sfgaoMask, SFGAOF sfgaoMask,
SFGAOF *psfgaoAttribs) SFGAOF *psfgaoAttribs)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
FIXME("Stub: %p (%x, %x, %p)\n", This, AttribFlags, sfgaoMask, psfgaoAttribs); FIXME("Stub: %p (%x, %x, %p)\n", This, AttribFlags, sfgaoMask, psfgaoAttribs);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -767,7 +772,7 @@ static HRESULT WINAPI IShellItemArray_fnGetAttributes(IShellItemArray *iface, ...@@ -767,7 +772,7 @@ static HRESULT WINAPI IShellItemArray_fnGetAttributes(IShellItemArray *iface,
static HRESULT WINAPI IShellItemArray_fnGetCount(IShellItemArray *iface, static HRESULT WINAPI IShellItemArray_fnGetCount(IShellItemArray *iface,
DWORD *pdwNumItems) DWORD *pdwNumItems)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
TRACE("%p (%p)\n", This, pdwNumItems); TRACE("%p (%p)\n", This, pdwNumItems);
*pdwNumItems = This->item_count; *pdwNumItems = This->item_count;
...@@ -779,7 +784,7 @@ static HRESULT WINAPI IShellItemArray_fnGetItemAt(IShellItemArray *iface, ...@@ -779,7 +784,7 @@ static HRESULT WINAPI IShellItemArray_fnGetItemAt(IShellItemArray *iface,
DWORD dwIndex, DWORD dwIndex,
IShellItem **ppsi) IShellItem **ppsi)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
TRACE("%p (%x, %p)\n", This, dwIndex, ppsi); TRACE("%p (%x, %p)\n", This, dwIndex, ppsi);
/* zero indexed */ /* zero indexed */
...@@ -795,7 +800,7 @@ static HRESULT WINAPI IShellItemArray_fnGetItemAt(IShellItemArray *iface, ...@@ -795,7 +800,7 @@ static HRESULT WINAPI IShellItemArray_fnGetItemAt(IShellItemArray *iface,
static HRESULT WINAPI IShellItemArray_fnEnumItems(IShellItemArray *iface, static HRESULT WINAPI IShellItemArray_fnEnumItems(IShellItemArray *iface,
IEnumShellItems **ppenumShellItems) IEnumShellItems **ppenumShellItems)
{ {
IShellItemArrayImpl *This = (IShellItemArrayImpl *)iface; IShellItemArrayImpl *This = impl_from_IShellItemArray(iface);
FIXME("Stub: %p (%p)\n", This, ppenumShellItems); FIXME("Stub: %p (%p)\n", This, ppenumShellItems);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -829,12 +834,12 @@ static HRESULT IShellItemArray_Constructor(IUnknown *pUnkOuter, REFIID riid, voi ...@@ -829,12 +834,12 @@ static HRESULT IShellItemArray_Constructor(IUnknown *pUnkOuter, REFIID riid, voi
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->ref = 1; This->ref = 1;
This->lpVtbl = &vt_IShellItemArray; This->IShellItemArray_iface.lpVtbl = &vt_IShellItemArray;
This->array = NULL; This->array = NULL;
This->item_count = 0; This->item_count = 0;
ret = IShellItemArray_QueryInterface((IShellItemArray*)This, riid, ppv); ret = IShellItemArray_QueryInterface(&This->IShellItemArray_iface, riid, ppv);
IShellItemArray_Release((IShellItemArray*)This); IShellItemArray_Release(&This->IShellItemArray_iface);
return ret; return ret;
} }
...@@ -875,7 +880,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, ...@@ -875,7 +880,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
{ {
This->array = array; This->array = array;
This->item_count = cidl; This->item_count = cidl;
*ppsiItemArray = (IShellItemArray*)This; *ppsiItemArray = &This->IShellItemArray_iface;
return ret; return ret;
} }
......
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