Commit 738e88db authored by Alexandre Julliard's avatar Alexandre Julliard

Replace the ICOM_THIS_From macros by inline functions.

parent 54de6149
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#include "wine/debug.h" #include "wine/debug.h"
/* #define ICOM_THIS_From_IROTData(class, name) class* This = (class*)(((char*)name)-sizeof(void*)) */
WINE_DEFAULT_DEBUG_CHANNEL(devenum); WINE_DEFAULT_DEBUG_CHANNEL(devenum);
static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface); static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface);
......
...@@ -125,10 +125,10 @@ typedef struct OLEPictureImpl { ...@@ -125,10 +125,10 @@ typedef struct OLEPictureImpl {
* IPicture handles IUnknown * IPicture handles IUnknown
*/ */
const IPictureVtbl *lpvtbl1; const IPictureVtbl *lpVtbl;
const IDispatchVtbl *lpvtbl2; const IDispatchVtbl *lpvtblIDispatch;
const IPersistStreamVtbl *lpvtbl3; const IPersistStreamVtbl *lpvtblIPersistStream;
const IConnectionPointContainerVtbl *lpvtbl4; const IConnectionPointContainerVtbl *lpvtblIConnectionPointContainer;
/* Object reference count */ /* Object reference count */
LONG ref; LONG ref;
...@@ -168,12 +168,21 @@ typedef struct OLEPictureImpl { ...@@ -168,12 +168,21 @@ typedef struct OLEPictureImpl {
/* /*
* Macros to retrieve pointer to IUnknown (IPicture) from the other VTables. * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
*/ */
#define ICOM_THIS_From_IDispatch(impl, name) \
impl *This = (impl*)(((char*)name)-sizeof(void*)); static inline OLEPictureImpl *impl_from_IDispatch( IDispatch *iface )
#define ICOM_THIS_From_IPersistStream(impl, name) \ {
impl *This = (impl*)(((char*)name)-2*sizeof(void*)); return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIDispatch));
#define ICOM_THIS_From_IConnectionPointContainer(impl, name) \ }
impl *This = (impl*)(((char*)name)-3*sizeof(void*));
static inline OLEPictureImpl *impl_from_IPersistStream( IPersistStream *iface )
{
return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIPersistStream));
}
static inline OLEPictureImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
{
return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIConnectionPointContainer));
}
/* /*
* Predeclare VTables. They get initialized at the end. * Predeclare VTables. They get initialized at the end.
...@@ -265,10 +274,10 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn) ...@@ -265,10 +274,10 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
/* /*
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newObject->lpvtbl1 = &OLEPictureImpl_VTable; newObject->lpVtbl = &OLEPictureImpl_VTable;
newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable; newObject->lpvtblIDispatch = &OLEPictureImpl_IDispatch_VTable;
newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable; newObject->lpvtblIPersistStream = &OLEPictureImpl_IPersistStream_VTable;
newObject->lpvtbl4 = &OLEPictureImpl_IConnectionPointContainer_VTable; newObject->lpvtblIConnectionPointContainer = &OLEPictureImpl_IConnectionPointContainer_VTable;
CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP); CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP);
...@@ -407,19 +416,19 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface( ...@@ -407,19 +416,19 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface(
} }
else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0) else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
{ {
*ppvObject = (IDispatch*)&(This->lpvtbl2); *ppvObject = (IDispatch*)&(This->lpvtblIDispatch);
} }
else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0) else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0)
{ {
*ppvObject = (IDispatch*)&(This->lpvtbl2); *ppvObject = (IDispatch*)&(This->lpvtblIDispatch);
} }
else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0) else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
{ {
*ppvObject = (IPersistStream*)&(This->lpvtbl3); *ppvObject = (IPersistStream*)&(This->lpvtblIPersistStream);
} }
else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0) else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0)
{ {
*ppvObject = (IConnectionPointContainer*)&(This->lpvtbl4); *ppvObject = (IConnectionPointContainer*)&(This->lpvtblIConnectionPointContainer);
} }
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
...@@ -791,34 +800,34 @@ static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface, ...@@ -791,34 +800,34 @@ static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface( static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
REFIID riid, REFIID riid,
VOID** ppvoid VOID** ppvoid)
) { {
ICOM_THIS_From_IConnectionPointContainer(IPicture,iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_QueryInterface(This,riid,ppvoid); return IPicture_QueryInterface((IPicture *)This,riid,ppvoid);
} }
static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef( static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release( static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints( static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
IEnumConnectionPoints** ppEnum IEnumConnectionPoints** ppEnum)
) { {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p,%p), stub!\n",This,ppEnum); FIXME("(%p,%p), stub!\n",This,ppEnum);
return E_NOTIMPL; return E_NOTIMPL;
...@@ -827,9 +836,9 @@ static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints( ...@@ -827,9 +836,9 @@ static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint( static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
REFIID riid, REFIID riid,
IConnectionPoint **ppCP IConnectionPoint **ppCP)
) { {
ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP); TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP);
if (!ppCP) if (!ppCP)
return E_POINTER; return E_POINTER;
...@@ -852,9 +861,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface( ...@@ -852,9 +861,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_QueryInterface(This, riid, ppvoid); return IPicture_QueryInterface((IPicture *)This, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
...@@ -865,9 +874,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface( ...@@ -865,9 +874,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef( static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
/************************************************************************ /************************************************************************
...@@ -878,9 +887,9 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef( ...@@ -878,9 +887,9 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
static ULONG WINAPI OLEPictureImpl_IPersistStream_Release( static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
/************************************************************************ /************************************************************************
...@@ -889,7 +898,7 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_Release( ...@@ -889,7 +898,7 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
static HRESULT WINAPI OLEPictureImpl_GetClassID( static HRESULT WINAPI OLEPictureImpl_GetClassID(
IPersistStream* iface,CLSID* pClassID) IPersistStream* iface,CLSID* pClassID)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This); FIXME("(%p),stub!\n",This);
return E_FAIL; return E_FAIL;
} }
...@@ -900,7 +909,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID( ...@@ -900,7 +909,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID(
static HRESULT WINAPI OLEPictureImpl_IsDirty( static HRESULT WINAPI OLEPictureImpl_IsDirty(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This); FIXME("(%p),stub!\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -1028,7 +1037,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { ...@@ -1028,7 +1037,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
DWORD header[2]; DWORD header[2];
WORD magic; WORD magic;
STATSTG statstg; STATSTG statstg;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p,%p)\n",This,pStm); TRACE("(%p,%p)\n",This,pStm);
...@@ -1519,7 +1528,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( ...@@ -1519,7 +1528,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
ULONG dummy; ULONG dummy;
int iSerializeResult = 0; int iSerializeResult = 0;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
switch (This->desc.picType) { switch (This->desc.picType) {
case PICTYPE_ICON: case PICTYPE_ICON:
...@@ -1837,7 +1846,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength) ...@@ -1837,7 +1846,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
static HRESULT WINAPI OLEPictureImpl_GetSizeMax( static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
IPersistStream* iface,ULARGE_INTEGER*pcbSize) IPersistStream* iface,ULARGE_INTEGER*pcbSize)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p,%p),stub!\n",This,pcbSize); FIXME("(%p,%p),stub!\n",This,pcbSize);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -1855,9 +1864,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface( ...@@ -1855,9 +1864,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_QueryInterface(This, riid, ppvoid); return IPicture_QueryInterface((IPicture *)This, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
...@@ -1868,9 +1877,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface( ...@@ -1868,9 +1877,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef( static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
IDispatch* iface) IDispatch* iface)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
/************************************************************************ /************************************************************************
...@@ -1881,9 +1890,9 @@ static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef( ...@@ -1881,9 +1890,9 @@ static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
static ULONG WINAPI OLEPictureImpl_IDispatch_Release( static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
IDispatch* iface) IDispatch* iface)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
/************************************************************************ /************************************************************************
......
...@@ -885,8 +885,10 @@ typedef struct tagITypeLibImpl ...@@ -885,8 +885,10 @@ typedef struct tagITypeLibImpl
static const ITypeLib2Vtbl tlbvt; static const ITypeLib2Vtbl tlbvt;
static const ITypeCompVtbl tlbtcvt; static const ITypeCompVtbl tlbtcvt;
#define _ITypeComp_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeComp))) static inline ITypeLibImpl *impl_from_ITypeComp( ITypeComp *iface )
#define ICOM_THIS_From_ITypeComp(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeComp_Offset(impl)) {
return (ITypeLibImpl *)((char*)iface - FIELD_OFFSET(ITypeLibImpl, lpVtblTypeComp));
}
/* ITypeLib methods */ /* ITypeLib methods */
static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength); static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength);
...@@ -995,6 +997,11 @@ typedef struct tagITypeInfoImpl ...@@ -995,6 +997,11 @@ typedef struct tagITypeInfoImpl
struct tagITypeInfoImpl * next; struct tagITypeInfoImpl * next;
} ITypeInfoImpl; } ITypeInfoImpl;
static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
{
return (ITypeInfoImpl *)((char*)iface - FIELD_OFFSET(ITypeInfoImpl, lpVtblTypeComp));
}
static const ITypeInfo2Vtbl tinfvt; static const ITypeInfo2Vtbl tinfvt;
static const ITypeCompVtbl tcompvt; static const ITypeCompVtbl tcompvt;
...@@ -4003,23 +4010,23 @@ static const ITypeLib2Vtbl tlbvt = { ...@@ -4003,23 +4010,23 @@ static const ITypeLib2Vtbl tlbvt = {
static HRESULT WINAPI ITypeLibComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeLibComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv); return ITypeLib2_QueryInterface((ITypeLib *)This, riid, ppv);
} }
static ULONG WINAPI ITypeLibComp_fnAddRef(ITypeComp * iface) static ULONG WINAPI ITypeLibComp_fnAddRef(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_AddRef((ITypeInfo *)This); return ITypeLib2_AddRef((ITypeLib2 *)This);
} }
static ULONG WINAPI ITypeLibComp_fnRelease(ITypeComp * iface) static ULONG WINAPI ITypeLibComp_fnRelease(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_Release((ITypeInfo *)This); return ITypeLib2_Release((ITypeLib2 *)This);
} }
static HRESULT WINAPI ITypeLibComp_fnBind( static HRESULT WINAPI ITypeLibComp_fnBind(
...@@ -5955,21 +5962,21 @@ HRESULT WINAPI CreateDispTypeInfo( ...@@ -5955,21 +5962,21 @@ HRESULT WINAPI CreateDispTypeInfo(
static HRESULT WINAPI ITypeComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv); return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv);
} }
static ULONG WINAPI ITypeComp_fnAddRef(ITypeComp * iface) static ULONG WINAPI ITypeComp_fnAddRef(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_AddRef((ITypeInfo *)This); return ITypeInfo_AddRef((ITypeInfo *)This);
} }
static ULONG WINAPI ITypeComp_fnRelease(ITypeComp * iface) static ULONG WINAPI ITypeComp_fnRelease(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_Release((ITypeInfo *)This); return ITypeInfo_Release((ITypeInfo *)This);
} }
...@@ -5983,7 +5990,7 @@ static HRESULT WINAPI ITypeComp_fnBind( ...@@ -5983,7 +5990,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
DESCKIND * pDescKind, DESCKIND * pDescKind,
BINDPTR * pBindPtr) BINDPTR * pBindPtr)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
TLBFuncDesc * pFDesc; TLBFuncDesc * pFDesc;
TLBVarDesc * pVDesc; TLBVarDesc * pVDesc;
......
...@@ -166,8 +166,10 @@ typedef struct tagICreateTypeLib2Impl ...@@ -166,8 +166,10 @@ typedef struct tagICreateTypeLib2Impl
struct tagICreateTypeInfo2Impl *last_typeinfo; struct tagICreateTypeInfo2Impl *last_typeinfo;
} ICreateTypeLib2Impl; } ICreateTypeLib2Impl;
#define _ITypeLib2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeLib2))) static inline ICreateTypeLib2Impl *impl_from_ITypeLib2( ITypeLib2 *iface )
#define ICOM_THIS_From_ITypeLib2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeLib2_Offset(impl)) {
return (ICreateTypeLib2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeLib2Impl, lpVtblTypeLib2));
}
typedef struct tagICreateTypeInfo2Impl typedef struct tagICreateTypeInfo2Impl
{ {
...@@ -192,8 +194,10 @@ typedef struct tagICreateTypeInfo2Impl ...@@ -192,8 +194,10 @@ typedef struct tagICreateTypeInfo2Impl
struct tagICreateTypeInfo2Impl *next_typeinfo; struct tagICreateTypeInfo2Impl *next_typeinfo;
} ICreateTypeInfo2Impl; } ICreateTypeInfo2Impl;
#define _ITypeInfo2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeInfo2))) static inline ICreateTypeInfo2Impl *impl_from_ITypeInfo2( ITypeInfo2 *iface )
#define ICOM_THIS_From_ITypeInfo2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeInfo2_Offset(impl)) {
return (ICreateTypeInfo2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeInfo2Impl, lpVtblTypeInfo2));
}
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface); static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
...@@ -2198,7 +2202,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetName( ...@@ -2198,7 +2202,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetName(
*/ */
static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This, riid, ppv); return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This, riid, ppv);
} }
...@@ -2210,7 +2214,7 @@ static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID rii ...@@ -2210,7 +2214,7 @@ static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID rii
*/ */
static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface) static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This); return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This);
} }
...@@ -2222,7 +2226,7 @@ static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface) ...@@ -2222,7 +2226,7 @@ static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
*/ */
static ULONG WINAPI ITypeInfo2_fnRelease(ITypeInfo2 * iface) static ULONG WINAPI ITypeInfo2_fnRelease(ITypeInfo2 * iface)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This); return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This);
} }
...@@ -2461,7 +2465,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib( ...@@ -2461,7 +2465,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib(
ITypeLib** ppTLib, ITypeLib** ppTLib,
UINT* pIndex) UINT* pIndex)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex); TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex);
...@@ -3431,7 +3435,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll( ...@@ -3431,7 +3435,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(
*/ */
static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_QueryInterface((ICreateTypeLib2 *)This, riid, ppv); return ICreateTypeLib2_QueryInterface((ICreateTypeLib2 *)This, riid, ppv);
} }
...@@ -3443,7 +3447,7 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, ...@@ -3443,7 +3447,7 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid,
*/ */
static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface) static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This); return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This);
} }
...@@ -3455,7 +3459,7 @@ static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface) ...@@ -3455,7 +3459,7 @@ static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
*/ */
static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface) static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_Release((ICreateTypeLib2 *)This); return ICreateTypeLib2_Release((ICreateTypeLib2 *)This);
} }
...@@ -3468,7 +3472,7 @@ static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface) ...@@ -3468,7 +3472,7 @@ static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
static UINT WINAPI ITypeLib2_fnGetTypeInfoCount( static UINT WINAPI ITypeLib2_fnGetTypeInfoCount(
ITypeLib2 * iface) ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p)\n", iface); TRACE("(%p)\n", iface);
...@@ -3485,7 +3489,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo( ...@@ -3485,7 +3489,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
UINT index, UINT index,
ITypeInfo** ppTInfo) ITypeInfo** ppTInfo)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, ppTInfo); TRACE("(%p,%d,%p)\n", iface, index, ppTInfo);
...@@ -3506,7 +3510,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType( ...@@ -3506,7 +3510,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
UINT index, UINT index,
TYPEKIND* pTKind) TYPEKIND* pTKind)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, pTKind); TRACE("(%p,%d,%p)\n", iface, index, pTKind);
...@@ -3529,7 +3533,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid( ...@@ -3529,7 +3533,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid(
REFGUID guid, REFGUID guid,
ITypeInfo** ppTinfo) ITypeInfo** ppTinfo)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
int guidoffset; int guidoffset;
int typeinfo; int typeinfo;
...@@ -3554,9 +3558,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr( ...@@ -3554,9 +3558,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLib2 * iface, ITypeLib2 * iface,
TLIBATTR** ppTLibAttr) TLIBATTR** ppTLibAttr)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, ppTLibAttr); FIXME("(%p,%p), stub!\n", This, ppTLibAttr);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3570,9 +3574,9 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp( ...@@ -3570,9 +3574,9 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp(
ITypeLib2 * iface, ITypeLib2 * iface,
ITypeComp** ppTComp) ITypeComp** ppTComp)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, ppTComp); FIXME("(%p,%p), stub!\n", This, ppTComp);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3590,9 +3594,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation( ...@@ -3590,9 +3594,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
DWORD* pdwHelpContext, DWORD* pdwHelpContext,
BSTR* pBstrHelpFile) BSTR* pBstrHelpFile)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", iface, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile); FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", This, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3608,7 +3612,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName( ...@@ -3608,7 +3612,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
ULONG lHashVal, ULONG lHashVal,
BOOL* pfName) BOOL* pfName)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
char *encoded_name; char *encoded_name;
int nameoffset; int nameoffset;
...@@ -3646,9 +3650,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName( ...@@ -3646,9 +3650,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
MEMBERID* rgMemId, MEMBERID* rgMemId,
USHORT* pcFound) USHORT* pcFound)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%s,%lx,%p,%p,%p), stub!\n", iface, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound); FIXME("(%p,%s,%lx,%p,%p,%p), stub!\n", This, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3662,9 +3666,9 @@ static void WINAPI ITypeLib2_fnReleaseTLibAttr( ...@@ -3662,9 +3666,9 @@ static void WINAPI ITypeLib2_fnReleaseTLibAttr(
ITypeLib2 * iface, ITypeLib2 * iface,
TLIBATTR* pTLibAttr) TLIBATTR* pTLibAttr)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, pTLibAttr); FIXME("(%p,%p), stub!\n", This, pTLibAttr);
} }
/****************************************************************************** /******************************************************************************
...@@ -3682,9 +3686,9 @@ static HRESULT WINAPI ITypeLib2_fnGetCustData( ...@@ -3682,9 +3686,9 @@ static HRESULT WINAPI ITypeLib2_fnGetCustData(
REFGUID guid, /* [I] The GUID under which the custom data is stored. */ REFGUID guid, /* [I] The GUID under which the custom data is stored. */
VARIANT* pVarVal) /* [O] The custom data. */ VARIANT* pVarVal) /* [O] The custom data. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%s,%p), stub!\n", iface, debugstr_guid(guid), pVarVal); FIXME("(%p,%s,%p), stub!\n", This, debugstr_guid(guid), pVarVal);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3705,9 +3709,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibStatistics( ...@@ -3705,9 +3709,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibStatistics(
ULONG* pcUniqueNames, /* [O] The number of unique names in the type library. */ ULONG* pcUniqueNames, /* [O] The number of unique names in the type library. */
ULONG* pcchUniqueNames) /* [O] The number of changed (?) characters in names in the type library. */ ULONG* pcchUniqueNames) /* [O] The number of changed (?) characters in names in the type library. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p,%p), stub!\n", iface, pcUniqueNames, pcchUniqueNames); FIXME("(%p,%p,%p), stub!\n", This, pcUniqueNames, pcchUniqueNames);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3730,9 +3734,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( ...@@ -3730,9 +3734,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2(
DWORD* pdwHelpStringContext, DWORD* pdwHelpStringContext,
BSTR* pbstrHelpStringDll) BSTR* pbstrHelpStringDll)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%d,%ld,%p,%p,%p), stub!\n", iface, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll); FIXME("(%p,%d,%ld,%p,%p,%p), stub!\n", This, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -3751,9 +3755,9 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData( ...@@ -3751,9 +3755,9 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData(
ITypeLib2 * iface, /* [I] The type library in which to find the custom data. */ ITypeLib2 * iface, /* [I] The type library in which to find the custom data. */
CUSTDATA* pCustData) /* [O] The structure in which to place the custom data. */ CUSTDATA* pCustData) /* [O] The structure in which to place the custom data. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, pCustData); FIXME("(%p,%p), stub!\n", This, pCustData);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
......
...@@ -58,11 +58,10 @@ static const IAsyncReaderVtbl FileAsyncReader_Vtbl; ...@@ -58,11 +58,10 @@ static const IAsyncReaderVtbl FileAsyncReader_Vtbl;
static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
#define _IFileSourceFilter_Offset ((int)(&(((AsyncReader*)0)->lpVtblFSF))) static inline AsyncReader *impl_from_IFileSourceFilter( IFileSourceFilter *iface )
#define ICOM_THIS_From_IFileSourceFilter(impl, iface) impl* This = (impl*)(((char*)iface)-_IFileSourceFilter_Offset); {
return (AsyncReader *)((char*)iface - FIELD_OFFSET(AsyncReader, lpVtblFSF));
#define _IAsyncReader_Offset ((int)(&(((FileAsyncReader*)0)->lpVtblAR))) }
#define ICOM_THIS_From_IAsyncReader(impl, iface) impl* This = (impl*)(((char*)iface)-_IAsyncReader_Offset);
static HRESULT process_extensions(HKEY hkeyExtensions, LPCOLESTR pszFileName, GUID * majorType, GUID * minorType) static HRESULT process_extensions(HKEY hkeyExtensions, LPCOLESTR pszFileName, GUID * majorType, GUID * minorType)
{ {
...@@ -541,21 +540,21 @@ static const IBaseFilterVtbl AsyncReader_Vtbl = ...@@ -541,21 +540,21 @@ static const IBaseFilterVtbl AsyncReader_Vtbl =
static HRESULT WINAPI FileSource_QueryInterface(IFileSourceFilter * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI FileSource_QueryInterface(IFileSourceFilter * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
return IBaseFilter_QueryInterface((IFileSourceFilter*)&This->lpVtbl, riid, ppv); return IBaseFilter_QueryInterface((IFileSourceFilter*)&This->lpVtbl, riid, ppv);
} }
static ULONG WINAPI FileSource_AddRef(IFileSourceFilter * iface) static ULONG WINAPI FileSource_AddRef(IFileSourceFilter * iface)
{ {
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
return IBaseFilter_AddRef((IFileSourceFilter*)&This->lpVtbl); return IBaseFilter_AddRef((IFileSourceFilter*)&This->lpVtbl);
} }
static ULONG WINAPI FileSource_Release(IFileSourceFilter * iface) static ULONG WINAPI FileSource_Release(IFileSourceFilter * iface)
{ {
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
return IBaseFilter_Release((IFileSourceFilter*)&This->lpVtbl); return IBaseFilter_Release((IFileSourceFilter*)&This->lpVtbl);
} }
...@@ -565,7 +564,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -565,7 +564,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
HRESULT hr; HRESULT hr;
HANDLE hFile; HANDLE hFile;
IAsyncReader * pReader = NULL; IAsyncReader * pReader = NULL;
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
TRACE("(%s, %p)\n", debugstr_w(pszFileName), pmt); TRACE("(%s, %p)\n", debugstr_w(pszFileName), pmt);
...@@ -634,7 +633,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -634,7 +633,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter * iface, LPOLESTR * ppszFileName, AM_MEDIA_TYPE * pmt) static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter * iface, LPOLESTR * ppszFileName, AM_MEDIA_TYPE * pmt)
{ {
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
TRACE("(%p, %p)\n", ppszFileName, pmt); TRACE("(%p, %p)\n", ppszFileName, pmt);
...@@ -697,6 +696,11 @@ typedef struct FileAsyncReader ...@@ -697,6 +696,11 @@ typedef struct FileAsyncReader
CRITICAL_SECTION csList; /* critical section to protect operations on list */ CRITICAL_SECTION csList; /* critical section to protect operations on list */
} FileAsyncReader; } FileAsyncReader;
static inline FileAsyncReader *impl_from_IAsyncReader( IAsyncReader *iface )
{
return (FileAsyncReader *)((char*)iface - FIELD_OFFSET(FileAsyncReader, lpVtblAR));
}
static HRESULT AcceptProcAFR(LPVOID iface, const AM_MEDIA_TYPE *pmt) static HRESULT AcceptProcAFR(LPVOID iface, const AM_MEDIA_TYPE *pmt)
{ {
AsyncReader *This = (AsyncReader *)iface; AsyncReader *This = (AsyncReader *)iface;
...@@ -865,21 +869,21 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter ...@@ -865,21 +869,21 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter
static HRESULT WINAPI FileAsyncReader_QueryInterface(IAsyncReader * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI FileAsyncReader_QueryInterface(IAsyncReader * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
return IPin_QueryInterface((IPin *)This, riid, ppv); return IPin_QueryInterface((IPin *)This, riid, ppv);
} }
static ULONG WINAPI FileAsyncReader_AddRef(IAsyncReader * iface) static ULONG WINAPI FileAsyncReader_AddRef(IAsyncReader * iface)
{ {
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
return IPin_AddRef((IPin *)This); return IPin_AddRef((IPin *)This);
} }
static ULONG WINAPI FileAsyncReader_Release(IAsyncReader * iface) static ULONG WINAPI FileAsyncReader_Release(IAsyncReader * iface)
{ {
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
return IPin_Release((IPin *)This); return IPin_Release((IPin *)This);
} }
...@@ -947,7 +951,7 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader * iface, IMediaSample ...@@ -947,7 +951,7 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader * iface, IMediaSample
DATAREQUEST * pDataRq; DATAREQUEST * pDataRq;
BYTE * pBuffer; BYTE * pBuffer;
HRESULT hr = S_OK; HRESULT hr = S_OK;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%p, %lx)\n", pSample, dwUser); TRACE("(%p, %lx)\n", pSample, dwUser);
...@@ -1025,7 +1029,7 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw ...@@ -1025,7 +1029,7 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
DATAREQUEST * pDataRq = NULL; DATAREQUEST * pDataRq = NULL;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%lu, %p, %p)\n", dwTimeout, ppSample, pdwUser); TRACE("(%lu, %p, %p)\n", dwTimeout, ppSample, pdwUser);
...@@ -1115,7 +1119,7 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader * iface, LONGLONG ll ...@@ -1115,7 +1119,7 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader * iface, LONGLONG ll
{ {
OVERLAPPED ovl; OVERLAPPED ovl;
HRESULT hr = S_OK; HRESULT hr = S_OK;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%lx%08lx, %ld, %p)\n", (ULONG)(llPosition >> 32), (ULONG)llPosition, lLength, pBuffer); TRACE("(%lx%08lx, %ld, %p)\n", (ULONG)(llPosition >> 32), (ULONG)llPosition, lLength, pBuffer);
...@@ -1150,7 +1154,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT ...@@ -1150,7 +1154,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT
{ {
DWORD dwSizeLow; DWORD dwSizeLow;
DWORD dwSizeHigh; DWORD dwSizeHigh;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%p, %p)\n", pTotal, pAvailable); TRACE("(%p, %p)\n", pTotal, pAvailable);
...@@ -1167,7 +1171,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT ...@@ -1167,7 +1171,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT
static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface) static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
{ {
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("()\n"); TRACE("()\n");
...@@ -1182,7 +1186,7 @@ static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface) ...@@ -1182,7 +1186,7 @@ static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
static HRESULT WINAPI FileAsyncReader_EndFlush(IAsyncReader * iface) static HRESULT WINAPI FileAsyncReader_EndFlush(IAsyncReader * iface)
{ {
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface); FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("()\n"); TRACE("()\n");
......
...@@ -52,8 +52,10 @@ typedef struct FilterMapper2Impl ...@@ -52,8 +52,10 @@ typedef struct FilterMapper2Impl
static const IFilterMapper2Vtbl fm2vtbl; static const IFilterMapper2Vtbl fm2vtbl;
static const IFilterMapperVtbl fmvtbl; static const IFilterMapperVtbl fmvtbl;
#define _IFilterMapper_Offset ((int)(&(((FilterMapper2Impl*)0)->lpVtblFilterMapper))) static inline FilterMapper2Impl *impl_from_IFilterMapper( IFilterMapper *iface )
#define ICOM_THIS_From_IFilterMapper(impl, iface) impl* This = (impl*)(((char*)iface)-_IFilterMapper_Offset) {
return (FilterMapper2Impl *)((char*)iface - FIELD_OFFSET(FilterMapper2Impl, lpVtblFilterMapper));
}
static const WCHAR wszClsidSlash[] = {'C','L','S','I','D','\\',0}; static const WCHAR wszClsidSlash[] = {'C','L','S','I','D','\\',0};
static const WCHAR wszSlashInstance[] = {'\\','I','n','s','t','a','n','c','e','\\',0}; static const WCHAR wszSlashInstance[] = {'\\','I','n','s','t','a','n','c','e','\\',0};
...@@ -1053,7 +1055,7 @@ static const IFilterMapper2Vtbl fm2vtbl = ...@@ -1053,7 +1055,7 @@ static const IFilterMapper2Vtbl fm2vtbl =
static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID riid, LPVOID *ppv) static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID riid, LPVOID *ppv)
{ {
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface); FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
...@@ -1062,14 +1064,14 @@ static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID ...@@ -1062,14 +1064,14 @@ static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID
static ULONG WINAPI FilterMapper_AddRef(IFilterMapper * iface) static ULONG WINAPI FilterMapper_AddRef(IFilterMapper * iface)
{ {
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface); FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
return FilterMapper2_AddRef((IFilterMapper2*)This); return FilterMapper2_AddRef((IFilterMapper2*)This);
} }
static ULONG WINAPI FilterMapper_Release(IFilterMapper * iface) static ULONG WINAPI FilterMapper_Release(IFilterMapper * iface)
{ {
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface); FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
return FilterMapper2_Release((IFilterMapper2*)This); return FilterMapper2_Release((IFilterMapper2*)This);
} }
...@@ -1088,7 +1090,7 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters( ...@@ -1088,7 +1090,7 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
CLSID clsOutMaj, CLSID clsOutMaj,
CLSID clsOutSub) CLSID clsOutSub)
{ {
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface); FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
GUID InputType[2]; GUID InputType[2];
GUID OutputType[2]; GUID OutputType[2];
IEnumMoniker* ppEnumMoniker; IEnumMoniker* ppEnumMoniker;
......
...@@ -54,8 +54,11 @@ static HRESULT Parser_ChangeRate(LPVOID iface); ...@@ -54,8 +54,11 @@ static HRESULT Parser_ChangeRate(LPVOID iface);
static HRESULT Parser_InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); static HRESULT Parser_InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
#define _IMediaSeeking_Offset ((int)(&(((Parser_OutputPin*)0)->mediaSeeking))) static inline Parser_OutputPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
#define ICOM_THIS_From_IMediaSeeking(impl, iface) impl* This = (impl*)(((char*)iface)-_IMediaSeeking_Offset); {
return (Parser_OutputPin *)((char*)iface - FIELD_OFFSET(Parser_OutputPin, mediaSeeking.lpVtbl));
}
HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect) HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect)
{ {
...@@ -550,21 +553,21 @@ static HRESULT Parser_ChangeRate(LPVOID iface) ...@@ -550,21 +553,21 @@ static HRESULT Parser_ChangeRate(LPVOID iface)
static HRESULT WINAPI Parser_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI Parser_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_IMediaSeeking(Parser_OutputPin, iface); Parser_OutputPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_QueryInterface((IUnknown *)This, riid, ppv); return IUnknown_QueryInterface((IUnknown *)This, riid, ppv);
} }
static ULONG WINAPI Parser_Seeking_AddRef(IMediaSeeking * iface) static ULONG WINAPI Parser_Seeking_AddRef(IMediaSeeking * iface)
{ {
ICOM_THIS_From_IMediaSeeking(Parser_OutputPin, iface); Parser_OutputPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_AddRef((IUnknown *)This); return IUnknown_AddRef((IUnknown *)This);
} }
static ULONG WINAPI Parser_Seeking_Release(IMediaSeeking * iface) static ULONG WINAPI Parser_Seeking_Release(IMediaSeeking * iface)
{ {
ICOM_THIS_From_IMediaSeeking(Parser_OutputPin, iface); Parser_OutputPin *This = impl_from_IMediaSeeking(iface);
return IUnknown_Release((IUnknown *)This); return IUnknown_Release((IUnknown *)This);
} }
......
...@@ -37,8 +37,11 @@ static const IPinVtbl PullPin_Vtbl; ...@@ -37,8 +37,11 @@ static const IPinVtbl PullPin_Vtbl;
#define ALIGNDOWN(value,boundary) ((value) & ~(boundary-1)) #define ALIGNDOWN(value,boundary) ((value) & ~(boundary-1))
#define ALIGNUP(value,boundary) (ALIGNDOWN(value - 1, boundary) + boundary) #define ALIGNUP(value,boundary) (ALIGNDOWN(value - 1, boundary) + boundary)
#define _IMemInputPin_Offset ((int)(&(((InputPin*)0)->lpVtblMemInput))) static inline InputPin *impl_from_IMemInputPin( IMemInputPin *iface )
#define ICOM_THIS_From_IMemInputPin(impl, iface) impl* This = (impl*)(((char*)iface)-_IMemInputPin_Offset); {
return (InputPin *)((char*)iface - FIELD_OFFSET(InputPin, lpVtblMemInput));
}
static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc) static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc)
{ {
...@@ -529,28 +532,28 @@ static const IPinVtbl InputPin_Vtbl = ...@@ -529,28 +532,28 @@ static const IPinVtbl InputPin_Vtbl =
HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv) HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
return IPin_QueryInterface((IPin *)&This->pin, riid, ppv); return IPin_QueryInterface((IPin *)&This->pin, riid, ppv);
} }
ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface) ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
return IPin_AddRef((IPin *)&This->pin); return IPin_AddRef((IPin *)&This->pin);
} }
ULONG WINAPI MemInputPin_Release(IMemInputPin * iface) ULONG WINAPI MemInputPin_Release(IMemInputPin * iface)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
return IPin_Release((IPin *)&This->pin); return IPin_Release((IPin *)&This->pin);
} }
HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator) HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** ppAllocator)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, ppAllocator); TRACE("(%p/%p)->(%p)\n", This, iface, ppAllocator);
...@@ -563,7 +566,7 @@ HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** p ...@@ -563,7 +566,7 @@ HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** p
HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly) HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * pAllocator, BOOL bReadOnly)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
TRACE("(%p/%p)->(%p, %d)\n", This, iface, pAllocator, bReadOnly); TRACE("(%p/%p)->(%p, %d)\n", This, iface, pAllocator, bReadOnly);
...@@ -578,7 +581,7 @@ HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator * ...@@ -578,7 +581,7 @@ HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator *
HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps) HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCATOR_PROPERTIES * pProps)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pProps); TRACE("(%p/%p)->(%p)\n", This, iface, pProps);
...@@ -589,7 +592,7 @@ HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCA ...@@ -589,7 +592,7 @@ HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCA
HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample) HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
/* this trace commented out for performance reasons */ /* this trace commented out for performance reasons */
/*TRACE("(%p/%p)->(%p)\n", This, iface, pSample);*/ /*TRACE("(%p/%p)->(%p)\n", This, iface, pSample);*/
...@@ -600,7 +603,7 @@ HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample) ...@@ -600,7 +603,7 @@ HRESULT WINAPI MemInputPin_Receive(IMemInputPin * iface, IMediaSample * pSample)
HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed) HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** pSamples, long nSamples, long *nSamplesProcessed)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
TRACE("(%p/%p)->(%p, %ld, %p)\n", This, iface, pSamples, nSamples, nSamplesProcessed); TRACE("(%p/%p)->(%p, %ld, %p)\n", This, iface, pSamples, nSamples, nSamplesProcessed);
...@@ -616,7 +619,7 @@ HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample ** ...@@ -616,7 +619,7 @@ HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample **
HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface) HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface)
{ {
ICOM_THIS_From_IMemInputPin(InputPin, iface); InputPin *This = impl_from_IMemInputPin(iface);
FIXME("(%p/%p)->()\n", This, iface); FIXME("(%p/%p)->()\n", This, iface);
......
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