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 @@
#include "wine/debug.h"
/* #define ICOM_THIS_From_IROTData(class, name) class* This = (class*)(((char*)name)-sizeof(void*)) */
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface);
......
......@@ -125,10 +125,10 @@ typedef struct OLEPictureImpl {
* IPicture handles IUnknown
*/
const IPictureVtbl *lpvtbl1;
const IDispatchVtbl *lpvtbl2;
const IPersistStreamVtbl *lpvtbl3;
const IConnectionPointContainerVtbl *lpvtbl4;
const IPictureVtbl *lpVtbl;
const IDispatchVtbl *lpvtblIDispatch;
const IPersistStreamVtbl *lpvtblIPersistStream;
const IConnectionPointContainerVtbl *lpvtblIConnectionPointContainer;
/* Object reference count */
LONG ref;
......@@ -168,12 +168,21 @@ typedef struct OLEPictureImpl {
/*
* 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*));
#define ICOM_THIS_From_IPersistStream(impl, name) \
impl *This = (impl*)(((char*)name)-2*sizeof(void*));
#define ICOM_THIS_From_IConnectionPointContainer(impl, name) \
impl *This = (impl*)(((char*)name)-3*sizeof(void*));
static inline OLEPictureImpl *impl_from_IDispatch( IDispatch *iface )
{
return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIDispatch));
}
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.
......@@ -265,10 +274,10 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
/*
* Initialize the virtual function table.
*/
newObject->lpvtbl1 = &OLEPictureImpl_VTable;
newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable;
newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable;
newObject->lpvtbl4 = &OLEPictureImpl_IConnectionPointContainer_VTable;
newObject->lpVtbl = &OLEPictureImpl_VTable;
newObject->lpvtblIDispatch = &OLEPictureImpl_IDispatch_VTable;
newObject->lpvtblIPersistStream = &OLEPictureImpl_IPersistStream_VTable;
newObject->lpvtblIConnectionPointContainer = &OLEPictureImpl_IConnectionPointContainer_VTable;
CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP);
......@@ -407,19 +416,19 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface(
}
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)
{
*ppvObject = (IDispatch*)&(This->lpvtbl2);
*ppvObject = (IDispatch*)&(This->lpvtblIDispatch);
}
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)
{
*ppvObject = (IConnectionPointContainer*)&(This->lpvtbl4);
*ppvObject = (IConnectionPointContainer*)&(This->lpvtblIConnectionPointContainer);
}
/*
* Check that we obtained an interface.
......@@ -791,34 +800,34 @@ static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface(
IConnectionPointContainer* iface,
REFIID riid,
VOID** ppvoid
) {
ICOM_THIS_From_IConnectionPointContainer(IPicture,iface);
VOID** ppvoid)
{
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(
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(
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(
IConnectionPointContainer* iface,
IEnumConnectionPoints** ppEnum
) {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
IEnumConnectionPoints** ppEnum)
{
OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p,%p), stub!\n",This,ppEnum);
return E_NOTIMPL;
......@@ -827,9 +836,9 @@ static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint(
IConnectionPointContainer* iface,
REFIID riid,
IConnectionPoint **ppCP
) {
ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl, iface);
IConnectionPoint **ppCP)
{
OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP);
if (!ppCP)
return E_POINTER;
......@@ -852,9 +861,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
REFIID riid,
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(
static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
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(
static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
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(
static HRESULT WINAPI OLEPictureImpl_GetClassID(
IPersistStream* iface,CLSID* pClassID)
{
ICOM_THIS_From_IPersistStream(IPicture, iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This);
return E_FAIL;
}
......@@ -900,7 +909,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID(
static HRESULT WINAPI OLEPictureImpl_IsDirty(
IPersistStream* iface)
{
ICOM_THIS_From_IPersistStream(IPicture, iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This);
return E_NOTIMPL;
}
......@@ -1028,7 +1037,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
DWORD header[2];
WORD magic;
STATSTG statstg;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p,%p)\n",This,pStm);
......@@ -1519,7 +1528,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
ULONG dummy;
int iSerializeResult = 0;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface);
switch (This->desc.picType) {
case PICTYPE_ICON:
......@@ -1837,7 +1846,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
IPersistStream* iface,ULARGE_INTEGER*pcbSize)
{
ICOM_THIS_From_IPersistStream(IPicture, iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p,%p),stub!\n",This,pcbSize);
return E_NOTIMPL;
}
......@@ -1855,9 +1864,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
REFIID riid,
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(
static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
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(
static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
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
static const ITypeLib2Vtbl tlbvt;
static const ITypeCompVtbl tlbtcvt;
#define _ITypeComp_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeComp)))
#define ICOM_THIS_From_ITypeComp(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeComp_Offset(impl))
static inline ITypeLibImpl *impl_from_ITypeComp( ITypeComp *iface )
{
return (ITypeLibImpl *)((char*)iface - FIELD_OFFSET(ITypeLibImpl, lpVtblTypeComp));
}
/* ITypeLib methods */
static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength);
......@@ -995,6 +997,11 @@ typedef struct tagITypeInfoImpl
struct tagITypeInfoImpl * next;
} ITypeInfoImpl;
static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
{
return (ITypeInfoImpl *)((char*)iface - FIELD_OFFSET(ITypeInfoImpl, lpVtblTypeComp));
}
static const ITypeInfo2Vtbl tinfvt;
static const ITypeCompVtbl tcompvt;
......@@ -4003,23 +4010,23 @@ static const ITypeLib2Vtbl tlbvt = {
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)
{
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)
{
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(
......@@ -5955,21 +5962,21 @@ HRESULT WINAPI CreateDispTypeInfo(
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);
}
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);
}
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);
}
......@@ -5983,7 +5990,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
DESCKIND * pDescKind,
BINDPTR * pBindPtr)
{
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface);
ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
TLBFuncDesc * pFDesc;
TLBVarDesc * pVDesc;
......
......@@ -166,8 +166,10 @@ typedef struct tagICreateTypeLib2Impl
struct tagICreateTypeInfo2Impl *last_typeinfo;
} ICreateTypeLib2Impl;
#define _ITypeLib2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeLib2)))
#define ICOM_THIS_From_ITypeLib2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeLib2_Offset(impl))
static inline ICreateTypeLib2Impl *impl_from_ITypeLib2( ITypeLib2 *iface )
{
return (ICreateTypeLib2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeLib2Impl, lpVtblTypeLib2));
}
typedef struct tagICreateTypeInfo2Impl
{
......@@ -192,8 +194,10 @@ typedef struct tagICreateTypeInfo2Impl
struct tagICreateTypeInfo2Impl *next_typeinfo;
} ICreateTypeInfo2Impl;
#define _ITypeInfo2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeInfo2)))
#define ICOM_THIS_From_ITypeInfo2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeInfo2_Offset(impl))
static inline ICreateTypeInfo2Impl *impl_from_ITypeInfo2( ITypeInfo2 *iface )
{
return (ICreateTypeInfo2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeInfo2Impl, lpVtblTypeInfo2));
}
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
......@@ -2198,7 +2202,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetName(
*/
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);
}
......@@ -2210,7 +2214,7 @@ static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID rii
*/
static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
{
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This);
}
......@@ -2222,7 +2226,7 @@ static ULONG WINAPI ITypeInfo2_fnAddRef(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);
}
......@@ -2461,7 +2465,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib(
ITypeLib** ppTLib,
UINT* pIndex)
{
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex);
......@@ -3431,7 +3435,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(
*/
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);
}
......@@ -3443,7 +3447,7 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid,
*/
static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This);
}
......@@ -3455,7 +3459,7 @@ static ULONG WINAPI ITypeLib2_fnAddRef(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);
}
......@@ -3468,7 +3472,7 @@ static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
static UINT WINAPI ITypeLib2_fnGetTypeInfoCount(
ITypeLib2 * iface)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p)\n", iface);
......@@ -3485,7 +3489,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
UINT index,
ITypeInfo** ppTInfo)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, ppTInfo);
......@@ -3506,7 +3510,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
UINT index,
TYPEKIND* pTKind)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, pTKind);
......@@ -3529,7 +3533,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid(
REFGUID guid,
ITypeInfo** ppTinfo)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
int guidoffset;
int typeinfo;
......@@ -3554,9 +3558,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLib2 * iface,
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;
}
......@@ -3570,9 +3574,9 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp(
ITypeLib2 * iface,
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;
}
......@@ -3590,9 +3594,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
DWORD* pdwHelpContext,
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;
}
......@@ -3608,7 +3612,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
ULONG lHashVal,
BOOL* pfName)
{
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
char *encoded_name;
int nameoffset;
......@@ -3646,9 +3650,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
MEMBERID* rgMemId,
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;
}
......@@ -3662,9 +3666,9 @@ static void WINAPI ITypeLib2_fnReleaseTLibAttr(
ITypeLib2 * iface,
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(
REFGUID guid, /* [I] The GUID under which the custom data is stored. */
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;
}
......@@ -3705,9 +3709,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibStatistics(
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. */
{
/* 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;
}
......@@ -3730,9 +3734,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2(
DWORD* pdwHelpStringContext,
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;
}
......@@ -3751,9 +3755,9 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData(
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. */
{
/* 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;
}
......
......@@ -58,11 +58,10 @@ static const IAsyncReaderVtbl FileAsyncReader_Vtbl;
static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
#define _IFileSourceFilter_Offset ((int)(&(((AsyncReader*)0)->lpVtblFSF)))
#define ICOM_THIS_From_IFileSourceFilter(impl, iface) impl* This = (impl*)(((char*)iface)-_IFileSourceFilter_Offset);
#define _IAsyncReader_Offset ((int)(&(((FileAsyncReader*)0)->lpVtblAR)))
#define ICOM_THIS_From_IAsyncReader(impl, iface) impl* This = (impl*)(((char*)iface)-_IAsyncReader_Offset);
static inline AsyncReader *impl_from_IFileSourceFilter( IFileSourceFilter *iface )
{
return (AsyncReader *)((char*)iface - FIELD_OFFSET(AsyncReader, lpVtblFSF));
}
static HRESULT process_extensions(HKEY hkeyExtensions, LPCOLESTR pszFileName, GUID * majorType, GUID * minorType)
{
......@@ -541,21 +540,21 @@ static const IBaseFilterVtbl AsyncReader_Vtbl =
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);
}
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);
}
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);
}
......@@ -565,7 +564,7 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
HRESULT hr;
HANDLE hFile;
IAsyncReader * pReader = NULL;
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface);
AsyncReader *This = impl_from_IFileSourceFilter(iface);
TRACE("(%s, %p)\n", debugstr_w(pszFileName), pmt);
......@@ -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)
{
ICOM_THIS_From_IFileSourceFilter(AsyncReader, iface);
AsyncReader *This = impl_from_IFileSourceFilter(iface);
TRACE("(%p, %p)\n", ppszFileName, pmt);
......@@ -697,6 +696,11 @@ typedef struct FileAsyncReader
CRITICAL_SECTION csList; /* critical section to protect operations on list */
} 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)
{
AsyncReader *This = (AsyncReader *)iface;
......@@ -865,21 +869,21 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter
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);
}
static ULONG WINAPI FileAsyncReader_AddRef(IAsyncReader * iface)
{
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
return IPin_AddRef((IPin *)This);
}
static ULONG WINAPI FileAsyncReader_Release(IAsyncReader * iface)
{
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
return IPin_Release((IPin *)This);
}
......@@ -947,7 +951,7 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader * iface, IMediaSample
DATAREQUEST * pDataRq;
BYTE * pBuffer;
HRESULT hr = S_OK;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%p, %lx)\n", pSample, dwUser);
......@@ -1025,7 +1029,7 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
{
HRESULT hr = S_OK;
DATAREQUEST * pDataRq = NULL;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%lu, %p, %p)\n", dwTimeout, ppSample, pdwUser);
......@@ -1115,7 +1119,7 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader * iface, LONGLONG ll
{
OVERLAPPED ovl;
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);
......@@ -1150,7 +1154,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT
{
DWORD dwSizeLow;
DWORD dwSizeHigh;
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("(%p, %p)\n", pTotal, pAvailable);
......@@ -1167,7 +1171,7 @@ static HRESULT WINAPI FileAsyncReader_Length(IAsyncReader * iface, LONGLONG * pT
static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
{
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("()\n");
......@@ -1182,7 +1186,7 @@ static HRESULT WINAPI FileAsyncReader_BeginFlush(IAsyncReader * iface)
static HRESULT WINAPI FileAsyncReader_EndFlush(IAsyncReader * iface)
{
ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
FileAsyncReader *This = impl_from_IAsyncReader(iface);
TRACE("()\n");
......
......@@ -52,8 +52,10 @@ typedef struct FilterMapper2Impl
static const IFilterMapper2Vtbl fm2vtbl;
static const IFilterMapperVtbl fmvtbl;
#define _IFilterMapper_Offset ((int)(&(((FilterMapper2Impl*)0)->lpVtblFilterMapper)))
#define ICOM_THIS_From_IFilterMapper(impl, iface) impl* This = (impl*)(((char*)iface)-_IFilterMapper_Offset)
static inline FilterMapper2Impl *impl_from_IFilterMapper( IFilterMapper *iface )
{
return (FilterMapper2Impl *)((char*)iface - FIELD_OFFSET(FilterMapper2Impl, lpVtblFilterMapper));
}
static const WCHAR wszClsidSlash[] = {'C','L','S','I','D','\\',0};
static const WCHAR wszSlashInstance[] = {'\\','I','n','s','t','a','n','c','e','\\',0};
......@@ -1053,7 +1055,7 @@ static const IFilterMapper2Vtbl fm2vtbl =
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);
......@@ -1062,14 +1064,14 @@ static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID
static ULONG WINAPI FilterMapper_AddRef(IFilterMapper * iface)
{
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface);
FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
return FilterMapper2_AddRef((IFilterMapper2*)This);
}
static ULONG WINAPI FilterMapper_Release(IFilterMapper * iface)
{
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface);
FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
return FilterMapper2_Release((IFilterMapper2*)This);
}
......@@ -1088,7 +1090,7 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
CLSID clsOutMaj,
CLSID clsOutSub)
{
ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface);
FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
GUID InputType[2];
GUID OutputType[2];
IEnumMoniker* ppEnumMoniker;
......
......@@ -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);
#define _IMediaSeeking_Offset ((int)(&(((Parser_OutputPin*)0)->mediaSeeking)))
#define ICOM_THIS_From_IMediaSeeking(impl, iface) impl* This = (impl*)(((char*)iface)-_IMediaSeeking_Offset);
static inline Parser_OutputPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
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)
{
......@@ -550,21 +553,21 @@ static HRESULT Parser_ChangeRate(LPVOID iface)
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);
}
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);
}
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);
}
......
......@@ -37,8 +37,11 @@ static const IPinVtbl PullPin_Vtbl;
#define ALIGNDOWN(value,boundary) ((value) & ~(boundary-1))
#define ALIGNUP(value,boundary) (ALIGNDOWN(value - 1, boundary) + boundary)
#define _IMemInputPin_Offset ((int)(&(((InputPin*)0)->lpVtblMemInput)))
#define ICOM_THIS_From_IMemInputPin(impl, iface) impl* This = (impl*)(((char*)iface)-_IMemInputPin_Offset);
static inline InputPin *impl_from_IMemInputPin( IMemInputPin *iface )
{
return (InputPin *)((char*)iface - FIELD_OFFSET(InputPin, lpVtblMemInput));
}
static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc)
{
......@@ -529,28 +532,28 @@ static const IPinVtbl InputPin_Vtbl =
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);
}
ULONG WINAPI MemInputPin_AddRef(IMemInputPin * iface)
{
ICOM_THIS_From_IMemInputPin(InputPin, iface);
InputPin *This = impl_from_IMemInputPin(iface);
return IPin_AddRef((IPin *)&This->pin);
}
ULONG WINAPI MemInputPin_Release(IMemInputPin * iface)
{
ICOM_THIS_From_IMemInputPin(InputPin, iface);
InputPin *This = impl_from_IMemInputPin(iface);
return IPin_Release((IPin *)&This->pin);
}
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);
......@@ -563,7 +566,7 @@ HRESULT WINAPI MemInputPin_GetAllocator(IMemInputPin * iface, IMemAllocator ** p
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);
......@@ -578,7 +581,7 @@ HRESULT WINAPI MemInputPin_NotifyAllocator(IMemInputPin * iface, IMemAllocator *
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);
......@@ -589,7 +592,7 @@ HRESULT WINAPI MemInputPin_GetAllocatorRequirements(IMemInputPin * iface, ALLOCA
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 */
/*TRACE("(%p/%p)->(%p)\n", This, iface, 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 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);
......@@ -616,7 +619,7 @@ HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin * iface, IMediaSample **
HRESULT WINAPI MemInputPin_ReceiveCanBlock(IMemInputPin * iface)
{
ICOM_THIS_From_IMemInputPin(InputPin, iface);
InputPin *This = impl_from_IMemInputPin(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