ole32: Standardize COM aggregation for the FreeThreadedMarshaler.

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-07-05 09:54:38 +02:00 committed by Alexandre Julliard
parent 9525b1e2cf
commit a60b189787
1 changed files with 11 additions and 12 deletions

View File

@ -39,16 +39,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
typedef struct _FTMarshalImpl { typedef struct _FTMarshalImpl {
IUnknown IUnknown_iface; IUnknown IUnknown_inner;
LONG ref;
IMarshal IMarshal_iface; IMarshal IMarshal_iface;
IUnknown *outer_unk;
IUnknown *pUnkOuter; LONG ref;
} FTMarshalImpl; } FTMarshalImpl;
static inline FTMarshalImpl *impl_from_IUnknown(IUnknown *iface) static inline FTMarshalImpl *impl_from_IUnknown(IUnknown *iface)
{ {
return CONTAINING_RECORD(iface, FTMarshalImpl, IUnknown_iface); return CONTAINING_RECORD(iface, FTMarshalImpl, IUnknown_inner);
} }
static inline FTMarshalImpl *impl_from_IMarshal( IMarshal *iface ) static inline FTMarshalImpl *impl_from_IMarshal( IMarshal *iface )
@ -67,7 +66,7 @@ IiFTMUnknown_fnQueryInterface (IUnknown * iface, REFIID riid, LPVOID * ppv)
*ppv = NULL; *ppv = NULL;
if (IsEqualIID (&IID_IUnknown, riid)) if (IsEqualIID (&IID_IUnknown, riid))
*ppv = &This->IUnknown_iface; *ppv = &This->IUnknown_inner;
else if (IsEqualIID (&IID_IMarshal, riid)) else if (IsEqualIID (&IID_IMarshal, riid))
*ppv = &This->IMarshal_iface; *ppv = &This->IMarshal_iface;
else { else {
@ -113,7 +112,7 @@ FTMarshalImpl_QueryInterface (LPMARSHAL iface, REFIID riid, LPVOID * ppv)
FTMarshalImpl *This = impl_from_IMarshal(iface); FTMarshalImpl *This = impl_from_IMarshal(iface);
TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppv); TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppv);
return IUnknown_QueryInterface (This->pUnkOuter, riid, ppv); return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
} }
static ULONG WINAPI static ULONG WINAPI
@ -123,7 +122,7 @@ FTMarshalImpl_AddRef (LPMARSHAL iface)
FTMarshalImpl *This = impl_from_IMarshal(iface); FTMarshalImpl *This = impl_from_IMarshal(iface);
TRACE ("\n"); TRACE ("\n");
return IUnknown_AddRef (This->pUnkOuter); return IUnknown_AddRef(This->outer_unk);
} }
static ULONG WINAPI static ULONG WINAPI
@ -133,7 +132,7 @@ FTMarshalImpl_Release (LPMARSHAL iface)
FTMarshalImpl *This = impl_from_IMarshal(iface); FTMarshalImpl *This = impl_from_IMarshal(iface);
TRACE ("\n"); TRACE ("\n");
return IUnknown_Release (This->pUnkOuter); return IUnknown_Release(This->outer_unk);
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -342,12 +341,12 @@ HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN * p
if (!ftm) if (!ftm)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ftm->IUnknown_iface.lpVtbl = &iunkvt; ftm->IUnknown_inner.lpVtbl = &iunkvt;
ftm->IMarshal_iface.lpVtbl = &ftmvtbl; ftm->IMarshal_iface.lpVtbl = &ftmvtbl;
ftm->ref = 1; ftm->ref = 1;
ftm->pUnkOuter = punkOuter ? punkOuter : &ftm->IUnknown_iface; ftm->outer_unk = punkOuter ? punkOuter : &ftm->IUnknown_inner;
*ppunkMarshal = &ftm->IUnknown_iface; *ppunkMarshal = &ftm->IUnknown_inner;
return S_OK; return S_OK;
} }