Replace the ICOM_THIS_From macros by inline functions.

diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c
index bce7b3d..5238937 100644
--- a/dlls/devenum/mediacatenum.c
+++ b/dlls/devenum/mediacatenum.c
@@ -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);
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 0fce581..28986b7 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -63,12 +63,12 @@
    * The first two are supported by the first vtable, the next two are
    * supported by the second table and the last two have their own.
    */
-  const IFontVtbl*                     lpvtbl1;
-  const IDispatchVtbl*                 lpvtbl2;
-  const IPersistStreamVtbl*            lpvtbl3;
-  const IConnectionPointContainerVtbl* lpvtbl4;
-  const IPersistPropertyBagVtbl*       lpvtbl5;
-  const IPersistStreamInitVtbl*        lpvtbl6;
+  const IFontVtbl*                     lpVtbl;
+  const IDispatchVtbl*                 lpvtblIDispatch;
+  const IPersistStreamVtbl*            lpvtblIPersistStream;
+  const IConnectionPointContainerVtbl* lpvtblIConnectionPointContainer;
+  const IPersistPropertyBagVtbl*       lpvtblIPersistPropertyBag;
+  const IPersistStreamInitVtbl*        lpvtblIPersistStreamInit;
   /*
    * Reference count for that instance of the class.
    */
@@ -104,11 +104,31 @@
  * There is a version to accommodate all of the VTables implemented
  * by this object.
  */
-#define _ICOM_THIS_From_IDispatch(class, name) class* this = (class*)(((char*)name)-sizeof(void*))
-#define _ICOM_THIS_From_IPersistStream(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*))
-#define _ICOM_THIS_From_IConnectionPointContainer(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*))
-#define _ICOM_THIS_From_IPersistPropertyBag(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*))
-#define _ICOM_THIS_From_IPersistStreamInit(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*))
+
+static inline OLEFontImpl *impl_from_IDispatch( IDispatch *iface )
+{
+    return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIDispatch));
+}
+
+static inline OLEFontImpl *impl_from_IPersistStream( IPersistStream *iface )
+{
+    return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStream));
+}
+
+static inline OLEFontImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
+{
+    return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIConnectionPointContainer));
+}
+
+static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *iface )
+{
+    return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistPropertyBag));
+}
+
+static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface )
+{
+    return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStreamInit));
+}
 
 
 /***********************************************************************
@@ -402,12 +422,12 @@
   /*
    * Initialize the virtual function table.
    */
-  newObject->lpvtbl1 = &OLEFontImpl_VTable;
-  newObject->lpvtbl2 = &OLEFontImpl_IDispatch_VTable;
-  newObject->lpvtbl3 = &OLEFontImpl_IPersistStream_VTable;
-  newObject->lpvtbl4 = &OLEFontImpl_IConnectionPointContainer_VTable;
-  newObject->lpvtbl5 = &OLEFontImpl_IPersistPropertyBag_VTable;
-  newObject->lpvtbl6 = &OLEFontImpl_IPersistStreamInit_VTable;
+  newObject->lpVtbl = &OLEFontImpl_VTable;
+  newObject->lpvtblIDispatch = &OLEFontImpl_IDispatch_VTable;
+  newObject->lpvtblIPersistStream = &OLEFontImpl_IPersistStream_VTable;
+  newObject->lpvtblIConnectionPointContainer = &OLEFontImpl_IConnectionPointContainer_VTable;
+  newObject->lpvtblIPersistPropertyBag = &OLEFontImpl_IPersistPropertyBag_VTable;
+  newObject->lpvtblIPersistStreamInit = &OLEFontImpl_IPersistStreamInit_VTable;
 
   /*
    * Start with one reference count. The caller of this function
@@ -495,17 +515,17 @@
   if (IsEqualGUID(&IID_IFont, riid))
     *ppvObject = (IFont*)this;
   if (IsEqualGUID(&IID_IDispatch, riid))
-    *ppvObject = (IDispatch*)&(this->lpvtbl2);
+    *ppvObject = (IDispatch*)&(this->lpvtblIDispatch);
   if (IsEqualGUID(&IID_IFontDisp, riid))
-    *ppvObject = (IDispatch*)&(this->lpvtbl2);
+    *ppvObject = (IDispatch*)&(this->lpvtblIDispatch);
   if (IsEqualGUID(&IID_IPersistStream, riid))
-    *ppvObject = (IPersistStream*)&(this->lpvtbl3);
+    *ppvObject = (IPersistStream*)&(this->lpvtblIPersistStream);
   if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
-    *ppvObject = (IConnectionPointContainer*)&(this->lpvtbl4);
+    *ppvObject = (IConnectionPointContainer*)&(this->lpvtblIConnectionPointContainer);
   if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
-    *ppvObject = (IPersistPropertyBag*)&(this->lpvtbl5);
+    *ppvObject = (IPersistPropertyBag*)&(this->lpvtblIPersistPropertyBag);
   if (IsEqualGUID(&IID_IPersistStreamInit, riid))
-    *ppvObject = (IPersistStreamInit*)&(this->lpvtbl6);
+    *ppvObject = (IPersistStreamInit*)&(this->lpvtblIPersistStreamInit);
 
   /*
    * Check that we obtained an interface.
@@ -1156,9 +1176,9 @@
   REFIID     riid,
   VOID**     ppvoid)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
 
-  return IFont_QueryInterface(this, riid, ppvoid);
+  return IFont_QueryInterface((IFont *)this, riid, ppvoid);
 }
 
 /************************************************************************
@@ -1169,9 +1189,9 @@
 static ULONG WINAPI OLEFontImpl_IDispatch_Release(
   IDispatch* iface)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
 
-  return IFont_Release(this);
+  return IFont_Release((IFont *)this);
 }
 
 /************************************************************************
@@ -1182,9 +1202,9 @@
 static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(
   IDispatch* iface)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
 
-  return IFont_AddRef(this);
+  return IFont_AddRef((IFont *)this);
 }
 
 /************************************************************************
@@ -1196,7 +1216,7 @@
   IDispatch*    iface,
   unsigned int* pctinfo)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
   FIXME("(%p)->(%p): Stub\n", this, pctinfo);
 
   return E_NOTIMPL;
@@ -1217,7 +1237,7 @@
   ITypeLib *tl;
   HRESULT hres;
 
-  _ICOM_THIS_From_IDispatch(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
   TRACE("(%p, iTInfo=%d, lcid=%04x, %p)\n", this, iTInfo, (int)lcid, ppTInfo);
   if (iTInfo != 0)
     return E_FAIL;
@@ -1246,7 +1266,7 @@
   LCID        lcid,
   DISPID*     rgDispId)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
   FIXME("(%p,%s,%p,%d,%04x,%p), stub!\n", this, debugstr_guid(riid), rgszNames,
 	cNames, (int)lcid, rgDispId
   );
@@ -1273,7 +1293,7 @@
   EXCEPINFO*  pExepInfo,
   UINT*     puArgErr)
 {
-  _ICOM_THIS_From_IDispatch(IFont, iface);
+  OLEFontImpl *this = impl_from_IDispatch(iface);
   OLEFontImpl *xthis = (OLEFontImpl*)this;
 
   switch (dispIdMember) {
@@ -1282,7 +1302,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_BSTR;
-      return OLEFontImpl_get_Name(this, &V_BSTR(pVarResult));
+      return OLEFontImpl_get_Name((IFont *)this, &V_BSTR(pVarResult));
     case DISPATCH_PROPERTYPUT: {
       BSTR name;
       BOOL freename;
@@ -1334,7 +1354,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_BOOL;
-      return OLEFontImpl_get_Bold(this, (BOOL*)&V_BOOL(pVarResult));
+      return OLEFontImpl_get_Bold((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
     case DISPATCH_PROPERTYPUT:
       if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
 	FIXME("DISPID_FONT_BOLD/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@@ -1350,7 +1370,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_BOOL;
-      return OLEFontImpl_get_Italic(this, (BOOL*)&V_BOOL(pVarResult));
+      return OLEFontImpl_get_Italic((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
     case DISPATCH_PROPERTYPUT:
       if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
 	FIXME("DISPID_FONT_ITALIC/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@@ -1366,7 +1386,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_BOOL;
-      return OLEFontImpl_get_Underline(this, (BOOL*)&V_BOOL(pVarResult));
+      return OLEFontImpl_get_Underline((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
     case DISPATCH_PROPERTYPUT:
       if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
 	FIXME("DISPID_FONT_UNDER/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@@ -1382,7 +1402,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_BOOL;
-      return OLEFontImpl_get_Strikethrough(this, (BOOL*)&V_BOOL(pVarResult));
+      return OLEFontImpl_get_Strikethrough((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
     case DISPATCH_PROPERTYPUT:
       if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
 	FIXME("DISPID_FONT_STRIKE/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@@ -1412,7 +1432,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_CY;
-      return OLEFontImpl_get_Size(this, &V_CY(pVarResult));
+      return OLEFontImpl_get_Size((IFont *)this, &V_CY(pVarResult));
     }
     break;
   case DISPID_FONT_CHARSET:
@@ -1426,7 +1446,7 @@
     case DISPATCH_PROPERTYGET:
     case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
       V_VT(pVarResult) = VT_I2;
-      return OLEFontImpl_get_Charset(this, &V_I2(pVarResult));
+      return OLEFontImpl_get_Charset((IFont *)this, &V_I2(pVarResult));
     }
     break;
   }
@@ -1447,9 +1467,9 @@
   REFIID     riid,
   VOID**     ppvoid)
 {
-  _ICOM_THIS_From_IPersistStream(IFont, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
-  return IFont_QueryInterface(this, riid, ppvoid);
+  return IFont_QueryInterface((IFont *)this, riid, ppvoid);
 }
 
 /************************************************************************
@@ -1460,9 +1480,9 @@
 static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
   IPersistStream* iface)
 {
-  _ICOM_THIS_From_IPersistStream(IFont, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
-  return IFont_Release(this);
+  return IFont_Release((IFont *)this);
 }
 
 /************************************************************************
@@ -1473,9 +1493,9 @@
 static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(
   IPersistStream* iface)
 {
-  _ICOM_THIS_From_IPersistStream(IFont, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
-  return IFont_AddRef(this);
+  return IFont_AddRef((IFont *)this);
 }
 
 /************************************************************************
@@ -1540,7 +1560,7 @@
   BYTE  bStringSize;
   INT len;
 
-  _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
   /*
    * Read the version byte
@@ -1632,7 +1652,7 @@
   BYTE  bAttributes;
   BYTE  bStringSize;
 
-  _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
   /*
    * Read the version byte
@@ -1725,7 +1745,7 @@
   IPersistStream*  iface,
   ULARGE_INTEGER*  pcbSize)
 {
-  _ICOM_THIS_From_IPersistStream(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IPersistStream(iface);
 
   if (pcbSize==NULL)
     return E_POINTER;
@@ -1756,7 +1776,7 @@
   REFIID     riid,
   VOID**     ppvoid)
 {
-  _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
 
   return IFont_QueryInterface((IFont*)this, riid, ppvoid);
 }
@@ -1769,7 +1789,7 @@
 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
   IConnectionPointContainer* iface)
 {
-  _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
 
   return IFont_Release((IFont*)this);
 }
@@ -1782,7 +1802,7 @@
 static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
   IConnectionPointContainer* iface)
 {
-  _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
 
   return IFont_AddRef((IFont*)this);
 }
@@ -1797,7 +1817,7 @@
   IConnectionPointContainer* iface,
   IEnumConnectionPoints **ppEnum)
 {
-  _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
 
   FIXME("(%p)->(%p): stub\n", this, ppEnum);
   return E_NOTIMPL;
@@ -1814,7 +1834,7 @@
    REFIID riid,
    IConnectionPoint **ppCp)
 {
-  _ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface);
+  OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
   TRACE("(%p)->(%s, %p): stub\n", this, debugstr_guid(riid), ppCp);
 
   if(memcmp(riid, &IID_IPropertyNotifySink, sizeof(IID_IPropertyNotifySink)) == 0) {
@@ -1832,22 +1852,22 @@
 static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface(
    IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj
 ) {
-  _ICOM_THIS_From_IPersistPropertyBag(IFont, iface);
-  return IFont_QueryInterface(this,riid,ppvObj);
+  OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
+  return IFont_QueryInterface((IFont *)this,riid,ppvObj);
 }
 
 static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef(
    IPersistPropertyBag *iface
 ) {
-  _ICOM_THIS_From_IPersistPropertyBag(IFont, iface);
-  return IFont_AddRef(this);
+  OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
+  return IFont_AddRef((IFont *)this);
 }
 
 static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release(
    IPersistPropertyBag *iface
 ) {
-  _ICOM_THIS_From_IPersistPropertyBag(IFont, iface);
-  return IFont_Release(this);
+  OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
+  return IFont_Release((IFont *)this);
 }
 
 static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID(
@@ -1886,7 +1906,7 @@
     VARIANT rawAttr;
     VARIANT valueAttr;
     HRESULT iRes = S_OK;
-    _ICOM_THIS_From_IPersistPropertyBag(IFont, iface);
+    OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
 
     VariantInit(&rawAttr);
     VariantInit(&valueAttr);
@@ -1897,7 +1917,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BSTR);
             if (iRes == S_OK)
-                iRes = IFont_put_Name(this, V_BSTR(&valueAttr));
+                iRes = IFont_put_Name((IFont *)this, V_BSTR(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1911,7 +1931,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_CY);
             if (iRes == S_OK)
-                iRes = IFont_put_Size(this, V_CY(&valueAttr));
+                iRes = IFont_put_Size((IFont *)this, V_CY(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1925,7 +1945,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2);
             if (iRes == S_OK)
-                iRes = IFont_put_Charset(this, V_I2(&valueAttr));
+                iRes = IFont_put_Charset((IFont *)this, V_I2(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1939,7 +1959,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2);
             if (iRes == S_OK)
-                iRes = IFont_put_Weight(this, V_I2(&valueAttr));
+                iRes = IFont_put_Weight((IFont *)this, V_I2(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1954,7 +1974,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
             if (iRes == S_OK)
-                iRes = IFont_put_Underline(this, V_BOOL(&valueAttr));
+                iRes = IFont_put_Underline((IFont *)this, V_BOOL(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1968,7 +1988,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
             if (iRes == S_OK)
-                iRes = IFont_put_Italic(this, V_BOOL(&valueAttr));
+                iRes = IFont_put_Italic((IFont *)this, V_BOOL(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -1982,7 +2002,7 @@
         {
             iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
             if (iRes == S_OK)
-                IFont_put_Strikethrough(this, V_BOOL(&valueAttr));
+                IFont_put_Strikethrough((IFont *)this, V_BOOL(&valueAttr));
         }
         else if (iRes == E_INVALIDARG)
             iRes = S_OK;
@@ -2021,22 +2041,22 @@
 static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface(
    IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj
 ) {
-  _ICOM_THIS_From_IPersistStreamInit(IFont, iface);
-  return IFont_QueryInterface(this,riid,ppvObj);
+  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
+  return IFont_QueryInterface((IFont *)this,riid,ppvObj);
 }
 
 static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef(
    IPersistStreamInit *iface
 ) {
-  _ICOM_THIS_From_IPersistStreamInit(IFont, iface);
-  return IFont_AddRef(this);
+  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
+  return IFont_AddRef((IFont *)this);
 }
 
 static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release(
    IPersistStreamInit *iface
 ) {
-  _ICOM_THIS_From_IPersistStreamInit(IFont, iface);
-  return IFont_Release(this);
+  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
+  return IFont_Release((IFont *)this);
 }
 
 static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID(
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 171ee03..ca5b569 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -125,10 +125,10 @@
    * 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 @@
 /*
  * 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 @@
   /*
    * 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 @@
   }
   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_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_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 @@
   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 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_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 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_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 @@
   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 @@
     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 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 @@
   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 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_Release(
   IDispatch* iface)
 {
-  ICOM_THIS_From_IDispatch(IPicture, iface);
+  OLEPictureImpl *This = impl_from_IDispatch(iface);
 
-  return IPicture_Release(This);
+  return IPicture_Release((IPicture *)This);
 }
 
 /************************************************************************
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index e49fa4a..46b0880 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -885,8 +885,10 @@
 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 @@
     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 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 @@
 
 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 @@
     DESCKIND * pDescKind,
     BINDPTR * pBindPtr)
 {
-    ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface);
+    ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
     TLBFuncDesc * pFDesc;
     TLBVarDesc * pVDesc;
 
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index ffc5b88..8818d60 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -166,8 +166,10 @@
     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 @@
     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 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 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_fnRelease(ITypeInfo2 * iface)
 {
-    ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
+    ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
 
     return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This);
 }
@@ -2461,7 +2465,7 @@
         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 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 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_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 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 @@
         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 @@
         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 @@
         REFGUID guid,
         ITypeInfo** ppTinfo)
 {
-    ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+    ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
 
     int guidoffset;
     int typeinfo;
@@ -3554,9 +3558,9 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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;
 }
diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c
index a7f2b75..b47ae9c 100644
--- a/dlls/qcap/capturegraph.c
+++ b/dlls/qcap/capturegraph.c
@@ -65,11 +65,15 @@
 static const ICaptureGraphBuilderVtbl builder_Vtbl;
 static const ICaptureGraphBuilder2Vtbl builder2_Vtbl;
 
-#define _ICaptureGraphBuilder_Offset ((int)(&(((CaptureGraphImpl*)0)->lpVtbl)))
-#define _ICOM_THIS_From_ICaptureGraphBuilder(class, name) class* This = (class*)(((char*)name)-_ICaptureGraphBuilder_Offset)
+static inline CaptureGraphImpl *impl_from_ICaptureGraphBuilder( ICaptureGraphBuilder *iface )
+{
+    return (CaptureGraphImpl *)((char*)iface - FIELD_OFFSET(CaptureGraphImpl, lpVtbl));
+}
 
-#define _ICaptureGraphBuilder2_Offset ((int)(&(((CaptureGraphImpl*)0)->lpVtbl2)))
-#define _ICOM_THIS_From_ICaptureGraphBuilder2(class, name) class* This = (class*)(((char*)name)-_ICaptureGraphBuilder2_Offset)
+static inline CaptureGraphImpl *impl_from_ICaptureGraphBuilder2( ICaptureGraphBuilder2 *iface )
+{
+    return (CaptureGraphImpl *)((char*)iface - FIELD_OFFSET(CaptureGraphImpl, lpVtbl2));
+}
 
 /*
   converts This to an interface pointer
@@ -112,7 +116,7 @@
                                       REFIID riid,
                                       LPVOID * ppv)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
 
@@ -138,7 +142,7 @@
 static ULONG WINAPI
 fnCaptureGraphBuilder2_AddRef(ICaptureGraphBuilder2 * iface)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
     DWORD ref = InterlockedIncrement(&This->ref);
 
     TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, ref - 1);
@@ -148,7 +152,7 @@
 static ULONG WINAPI
 fnCaptureGraphBuilder2_Release(ICaptureGraphBuilder2 * iface)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
     DWORD ref = InterlockedDecrement(&This->ref);
 
     TRACE("(%p/%p)->() Release from %ld\n", This, iface, ref + 1);
@@ -175,7 +179,7 @@
    this method. If you call this method after the graph builder has created its
    own filter graph, the call will fail. */
     IMediaEvent *pmev;
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     TRACE("(%p/%p)->(%p)\n", This, iface, pfg);
 
@@ -200,7 +204,7 @@
 fnCaptureGraphBuilder2_GetFilterGraph(ICaptureGraphBuilder2 * iface,
                                       IGraphBuilder **pfg)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     TRACE("(%p/%p)->(%p)\n", This, iface, pfg);
 
@@ -227,7 +231,7 @@
                                          IBaseFilter **ppf,
                                          IFileSinkFilter **ppSink)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %s, %p, %p) Stub!\n", This, iface,
           debugstr_guid(pType), debugstr_w(lpstrFile), ppf, ppSink);
@@ -243,7 +247,7 @@
                                      REFIID riid,
                                      void **ppint)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %s, %p, %s, %p) - workaround stub!\n", This, iface,
           debugstr_guid(pCategory), debugstr_guid(pType),
@@ -264,7 +268,7 @@
                                     IBaseFilter *pfCompressor,
                                     IBaseFilter *pfRenderer)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %s, %p, %p, %p) Stub!\n", This, iface,
           debugstr_guid(pCategory), debugstr_guid(pType),
@@ -283,7 +287,7 @@
                                      WORD wStartCookie,
                                      WORD wStopCookie)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %s, %p, %p, %p, %i, %i) Stub!\n", This, iface,
           debugstr_guid(pCategory), debugstr_guid(pType),
@@ -297,7 +301,7 @@
                                     LPCOLESTR lpwstr,
                                     DWORDLONG dwlSize)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %lld) Stub!\n", This, iface,
           debugstr_w(lpwstr), dwlSize);
@@ -312,7 +316,7 @@
                                        int fAllowEscAbort,
                                        IAMCopyCaptureFileProgress *pCallback)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%s, %s, %i, %p) Stub!\n", This, iface,
           debugstr_w(lpwstrOld), debugstr_w(lpwstrNew),
@@ -331,7 +335,7 @@
                                int num,
                                IPin **ppPin)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder2(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
 
     FIXME("(%p/%p)->(%p, %x, %s, %s, %d, %i, %p) Stub!\n", This, iface,
           pSource, pindir, debugstr_guid(pCategory), debugstr_guid(pType),
@@ -361,7 +365,7 @@
 fnCaptureGraphBuilder_QueryInterface(ICaptureGraphBuilder * iface,
                                      REFIID riid, LPVOID * ppv)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return IUnknown_QueryInterface(_ICaptureGraphBuilder2_(This), riid, ppv);
 }
@@ -369,7 +373,7 @@
 static ULONG WINAPI
 fnCaptureGraphBuilder_AddRef(ICaptureGraphBuilder * iface)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return IUnknown_AddRef(_ICaptureGraphBuilder2_(This));
 }
@@ -377,7 +381,7 @@
 static ULONG WINAPI
 fnCaptureGraphBuilder_Release(ICaptureGraphBuilder * iface)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return IUnknown_Release(_ICaptureGraphBuilder2_(This));
 }
@@ -386,7 +390,7 @@
 fnCaptureGraphBuilder_SetFiltergraph(ICaptureGraphBuilder * iface,
                                      IGraphBuilder *pfg)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_SetFiltergraph(_ICaptureGraphBuilder2_(This), pfg);
 }
@@ -395,7 +399,7 @@
 fnCaptureGraphBuilder_GetFiltergraph(ICaptureGraphBuilder * iface,
                                      IGraphBuilder **pfg)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_GetFiltergraph(_ICaptureGraphBuilder2_(This), pfg);
 }
@@ -405,7 +409,7 @@
                                         const GUID *pType, LPCOLESTR lpstrFile,
                                         IBaseFilter **ppf, IFileSinkFilter **ppSink)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_SetOutputFileName(_ICaptureGraphBuilder2_(This),
                                                    pType, lpstrFile, ppf, ppSink);
@@ -416,7 +420,7 @@
                                     const GUID *pCategory, IBaseFilter *pf,
                                     REFIID riid, void **ppint)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_FindInterface(_ICaptureGraphBuilder2_(This),
                                                pCategory, NULL, pf, riid, ppint);
@@ -427,7 +431,7 @@
                                    const GUID *pCategory, IUnknown *pSource,
                                    IBaseFilter *pfCompressor, IBaseFilter *pfRenderer)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_RenderStream(_ICaptureGraphBuilder2_(This),
                                               pCategory, NULL, pSource,
@@ -440,7 +444,7 @@
                                     REFERENCE_TIME *pstart, REFERENCE_TIME *pstop,
                                     WORD wStartCookie, WORD wStopCookie)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_ControlStream(_ICaptureGraphBuilder2_(This),
                                                pCategory, NULL, pFilter, pstart, 
@@ -451,7 +455,7 @@
 fnCaptureGraphBuilder_AllocCapFile(ICaptureGraphBuilder * iface,
                                    LPCOLESTR lpstr, DWORDLONG dwlSize)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_AllocCapFile(_ICaptureGraphBuilder2_(This),
                                               lpstr, dwlSize);
@@ -463,7 +467,7 @@
                                       int fAllowEscAbort,
                                       IAMCopyCaptureFileProgress *pCallback)
 {
-    _ICOM_THIS_From_ICaptureGraphBuilder(CaptureGraphImpl, iface);
+    CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder(iface);
     TRACE("%p --> Forwarding to v2 (%p)\n", iface, This);
     return ICaptureGraphBuilder2_CopyCaptureFile(_ICaptureGraphBuilder2_(This),
                                                  lpwstrOld, lpwstrNew,
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 8fac0fb..97df18e 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -58,11 +58,10 @@
 
 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 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 @@
     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_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 @@
     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 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 @@
     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 @@
 {
     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 @@
 {
     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 @@
 {
     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_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_EndFlush(IAsyncReader * iface)
 {
-    ICOM_THIS_From_IAsyncReader(FileAsyncReader, iface);
+    FileAsyncReader *This = impl_from_IAsyncReader(iface);
 
     TRACE("()\n");
 
diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index 6927274..e287af3 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -52,8 +52,10 @@
 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 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 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 @@
     CLSID clsOutMaj,
     CLSID clsOutSub)
 {
-    ICOM_THIS_From_IFilterMapper(FilterMapper2Impl, iface);
+    FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
     GUID InputType[2];
     GUID OutputType[2];
     IEnumMoniker* ppEnumMoniker;
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c
index 7bbd789..83a995f 100644
--- a/dlls/quartz/parser.c
+++ b/dlls/quartz/parser.c
@@ -54,8 +54,11 @@
 
 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 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);
 }
diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index 54b816f..70e60f0 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -37,8 +37,11 @@
 #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 @@
 
 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_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_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_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_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_ReceiveCanBlock(IMemInputPin * iface)
 {
-    ICOM_THIS_From_IMemInputPin(InputPin, iface);
+    InputPin *This = impl_from_IMemInputPin(iface);
 
     FIXME("(%p/%p)->()\n", This, iface);