Commit 32fe620c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ole32: Use ifaces instead of vtbl pointers in Context.

parent e362c67a
...@@ -3742,26 +3742,26 @@ HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChann ...@@ -3742,26 +3742,26 @@ HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChann
typedef struct Context typedef struct Context
{ {
const IComThreadingInfoVtbl *lpVtbl; IComThreadingInfo IComThreadingInfo_iface;
const IContextCallbackVtbl *lpCallbackVtbl; IContextCallback IContextCallback_iface;
const IObjContextVtbl *lpContextVtbl; IObjContext IObjContext_iface;
LONG refs; LONG refs;
APTTYPE apttype; APTTYPE apttype;
} Context; } Context;
static inline Context *impl_from_IComThreadingInfo( IComThreadingInfo *iface ) static inline Context *impl_from_IComThreadingInfo( IComThreadingInfo *iface )
{ {
return (Context *)((char*)iface - FIELD_OFFSET(Context, lpVtbl)); return CONTAINING_RECORD(iface, Context, IComThreadingInfo_iface);
} }
static inline Context *impl_from_IContextCallback( IContextCallback *iface ) static inline Context *impl_from_IContextCallback( IContextCallback *iface )
{ {
return (Context *)((char*)iface - FIELD_OFFSET(Context, lpCallbackVtbl)); return CONTAINING_RECORD(iface, Context, IContextCallback_iface);
} }
static inline Context *impl_from_IObjContext( IObjContext *iface ) static inline Context *impl_from_IObjContext( IObjContext *iface )
{ {
return (Context *)((char*)iface - FIELD_OFFSET(Context, lpContextVtbl)); return CONTAINING_RECORD(iface, Context, IObjContext_iface);
} }
static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv) static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv)
...@@ -3771,15 +3771,15 @@ static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv) ...@@ -3771,15 +3771,15 @@ static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv)
if (IsEqualIID(riid, &IID_IComThreadingInfo) || if (IsEqualIID(riid, &IID_IComThreadingInfo) ||
IsEqualIID(riid, &IID_IUnknown)) IsEqualIID(riid, &IID_IUnknown))
{ {
*ppv = &iface->lpVtbl; *ppv = &iface->IComThreadingInfo_iface;
} }
else if (IsEqualIID(riid, &IID_IContextCallback)) else if (IsEqualIID(riid, &IID_IContextCallback))
{ {
*ppv = &iface->lpCallbackVtbl; *ppv = &iface->IContextCallback_iface;
} }
else if (IsEqualIID(riid, &IID_IObjContext)) else if (IsEqualIID(riid, &IID_IObjContext))
{ {
*ppv = &iface->lpContextVtbl; *ppv = &iface->IObjContext_iface;
} }
if (*ppv) if (*ppv)
...@@ -4056,9 +4056,9 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv) ...@@ -4056,9 +4056,9 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
if (!context) if (!context)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
context->lpVtbl = &Context_Threading_Vtbl; context->IComThreadingInfo_iface.lpVtbl = &Context_Threading_Vtbl;
context->lpCallbackVtbl = &Context_Callback_Vtbl; context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
context->lpContextVtbl = &Context_Object_Vtbl; context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
context->refs = 1; context->refs = 1;
if (apt->multi_threaded) if (apt->multi_threaded)
context->apttype = APTTYPE_MTA; context->apttype = APTTYPE_MTA;
...@@ -4067,8 +4067,8 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv) ...@@ -4067,8 +4067,8 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
else else
context->apttype = APTTYPE_STA; context->apttype = APTTYPE_STA;
hr = IUnknown_QueryInterface((IUnknown *)&context->lpVtbl, riid, ppv); hr = IUnknown_QueryInterface((IUnknown *)&context->IComThreadingInfo_iface, riid, ppv);
IUnknown_Release((IUnknown *)&context->lpVtbl); IUnknown_Release((IUnknown *)&context->IComThreadingInfo_iface);
return hr; return hr;
} }
......
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