Commit 87f42eb8 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dispex/tests: Use an iface instead of a vtbl pointer in dispex.

parent 278b7a04
...@@ -140,10 +140,15 @@ static void end_host_object(DWORD tid, HANDLE thread) ...@@ -140,10 +140,15 @@ static void end_host_object(DWORD tid, HANDLE thread)
typedef struct typedef struct
{ {
const IDispatchExVtbl *lpVtbl; IDispatchEx IDispatchEx_iface;
LONG refs; LONG refs;
} dispex; } dispex;
static inline dispex *impl_from_IDispatchEx(IDispatchEx *iface)
{
return CONTAINING_RECORD(iface, dispex, IDispatchEx_iface);
}
static HRESULT WINAPI dispex_QueryInterface(IDispatchEx* iface, static HRESULT WINAPI dispex_QueryInterface(IDispatchEx* iface,
REFIID iid, void **obj) REFIID iid, void **obj)
{ {
...@@ -164,7 +169,7 @@ static HRESULT WINAPI dispex_QueryInterface(IDispatchEx* iface, ...@@ -164,7 +169,7 @@ static HRESULT WINAPI dispex_QueryInterface(IDispatchEx* iface,
static ULONG WINAPI dispex_AddRef(IDispatchEx* iface) static ULONG WINAPI dispex_AddRef(IDispatchEx* iface)
{ {
dispex *This = (dispex *)iface; dispex *This = impl_from_IDispatchEx(iface);
trace("AddRef\n"); trace("AddRef\n");
return InterlockedIncrement(&This->refs); return InterlockedIncrement(&This->refs);
...@@ -172,7 +177,7 @@ static ULONG WINAPI dispex_AddRef(IDispatchEx* iface) ...@@ -172,7 +177,7 @@ static ULONG WINAPI dispex_AddRef(IDispatchEx* iface)
static ULONG WINAPI dispex_Release(IDispatchEx* iface) static ULONG WINAPI dispex_Release(IDispatchEx* iface)
{ {
dispex *This = (dispex *)iface; dispex *This = impl_from_IDispatchEx(iface);
ULONG refs = InterlockedDecrement(&This->refs); ULONG refs = InterlockedDecrement(&This->refs);
trace("Release\n"); trace("Release\n");
if(!refs) if(!refs)
...@@ -349,7 +354,7 @@ static IDispatchEx *dispex_create(void) ...@@ -349,7 +354,7 @@ static IDispatchEx *dispex_create(void)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return NULL; if (!This) return NULL;
This->lpVtbl = &dispex_vtable; This->IDispatchEx_iface.lpVtbl = &dispex_vtable;
This->refs = 1; This->refs = 1;
return (IDispatchEx *)This; return (IDispatchEx *)This;
} }
......
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