diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h index 8207a67fa97..9254295794e 100644 --- a/dlls/dpnet/dpnet_private.h +++ b/dlls/dpnet/dpnet_private.h @@ -93,9 +93,8 @@ struct IDirectPlay8PeerImpl */ struct IDirectPlay8ThreadPoolImpl { - /* IUnknown fields */ - const IDirectPlay8ThreadPoolVtbl *lpVtbl; - LONG ref; + IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface; + LONG ref; }; /** diff --git a/dlls/dpnet/threadpool.c b/dlls/dpnet/threadpool.c index f94a3fa194e..274789d28b6 100644 --- a/dlls/dpnet/threadpool.c +++ b/dlls/dpnet/threadpool.c @@ -37,11 +37,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(dpnet); -/* IUnknown interface follows */ - -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(PDIRECTPLAY8THREADPOOL iface, REFIID riid, LPVOID *ppobj) +static inline IDirectPlay8ThreadPoolImpl *impl_from_IDirectPlay8ThreadPool(IDirectPlay8ThreadPool *iface) { - IDirectPlay8ThreadPoolImpl *This = (IDirectPlay8ThreadPoolImpl*)iface; + return CONTAINING_RECORD(iface, IDirectPlay8ThreadPoolImpl, IDirectPlay8ThreadPool_iface); +} + +/* IUnknown interface follows */ +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(IDirectPlay8ThreadPool *iface, + REFIID riid, void **ppobj) +{ + IDirectPlay8ThreadPoolImpl *This = impl_from_IDirectPlay8ThreadPool(iface); if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool)) @@ -55,17 +60,17 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(PDIRECTPLAY8THRE return E_NOINTERFACE; } -static ULONG WINAPI IDirectPlay8ThreadPoolImpl_AddRef(PDIRECTPLAY8THREADPOOL iface) +static ULONG WINAPI IDirectPlay8ThreadPoolImpl_AddRef(IDirectPlay8ThreadPool *iface) { - IDirectPlay8ThreadPoolImpl* This = (IDirectPlay8ThreadPoolImpl*)iface; + IDirectPlay8ThreadPoolImpl* This = impl_from_IDirectPlay8ThreadPool(iface); ULONG RefCount = InterlockedIncrement(&This->ref); return RefCount; } -static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(PDIRECTPLAY8THREADPOOL iface) +static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(IDirectPlay8ThreadPool *iface) { - IDirectPlay8ThreadPoolImpl* This = (IDirectPlay8ThreadPoolImpl*)iface; + IDirectPlay8ThreadPoolImpl* This = impl_from_IDirectPlay8ThreadPool(iface); ULONG RefCount = InterlockedDecrement(&This->ref); if(!RefCount) @@ -75,31 +80,36 @@ static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(PDIRECTPLAY8THREADPOOL if } /* IDirectPlay8ThreadPool interface follows */ -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(PDIRECTPLAY8THREADPOOL iface, PVOID CONST pvUserContext, CONST PFNDPNMESSAGEHANDLER pfn, CONST DWORD dwFlags) +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(IDirectPlay8ThreadPool *iface, + void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) { FIXME("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags); return DPN_OK; } -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(PDIRECTPLAY8THREADPOOL iface, CONST DWORD dwFlags) +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(IDirectPlay8ThreadPool *iface, + const DWORD dwFlags) { return DPN_OK; } -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_GetThreadCount(PDIRECTPLAY8THREADPOOL iface, CONST DWORD dwProcessorNum, DWORD* CONST pdwNumThreads, CONST DWORD dwFlags) +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_GetThreadCount(IDirectPlay8ThreadPool *iface, + const DWORD dwProcessorNum, DWORD * const pdwNumThreads, const DWORD dwFlags) { FIXME("(%p)->(%x,%p,%x): stub\n", iface, dwProcessorNum, pdwNumThreads, dwFlags); *pdwNumThreads = 0; return DPN_OK; } -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_SetThreadCount(PDIRECTPLAY8THREADPOOL iface, CONST DWORD dwProcessorNum, CONST DWORD dwNumThreads, CONST DWORD dwFlags) +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_SetThreadCount(IDirectPlay8ThreadPool *iface, + const DWORD dwProcessorNum, const DWORD dwNumThreads, const DWORD dwFlags) { FIXME("(%p)->(%x,%x,%x): stub\n", iface, dwProcessorNum, dwNumThreads, dwFlags); return DPN_OK; } -static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_DoWork(PDIRECTPLAY8THREADPOOL iface, CONST DWORD dwAllowedTimeSlice, CONST DWORD dwFlags) +static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_DoWork(IDirectPlay8ThreadPool *iface, + const DWORD dwAllowedTimeSlice, const DWORD dwFlags) { static BOOL Run = FALSE; @@ -136,8 +146,9 @@ HRESULT DPNET_CreateDirectPlay8ThreadPool(LPCLASSFACTORY iface, LPUNKNOWN punkOu return E_OUTOFMEMORY; } - Client->lpVtbl = &DirectPlay8ThreadPool_Vtbl; + Client->IDirectPlay8ThreadPool_iface.lpVtbl = &DirectPlay8ThreadPool_Vtbl; Client->ref = 0; - return IDirectPlay8ThreadPoolImpl_QueryInterface((PDIRECTPLAY8THREADPOOL)Client, riid, ppobj); + return IDirectPlay8ThreadPoolImpl_QueryInterface(&Client->IDirectPlay8ThreadPool_iface, riid, + ppobj); }