dpnet: COM cleanup for the IDirectPlay8ThreadPool iface.

This commit is contained in:
Michael Stefaniuc 2011-08-05 13:12:43 +02:00 committed by Alexandre Julliard
parent 2e01ea4bda
commit 41059e1606
2 changed files with 28 additions and 18 deletions

View File

@ -93,9 +93,8 @@ struct IDirectPlay8PeerImpl
*/ */
struct IDirectPlay8ThreadPoolImpl struct IDirectPlay8ThreadPoolImpl
{ {
/* IUnknown fields */ IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface;
const IDirectPlay8ThreadPoolVtbl *lpVtbl; LONG ref;
LONG ref;
}; };
/** /**

View File

@ -37,11 +37,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(dpnet); WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
/* IUnknown interface follows */ static inline IDirectPlay8ThreadPoolImpl *impl_from_IDirectPlay8ThreadPool(IDirectPlay8ThreadPool *iface)
static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(PDIRECTPLAY8THREADPOOL iface, REFIID riid, LPVOID *ppobj)
{ {
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) || if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool)) IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool))
@ -55,17 +60,17 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(PDIRECTPLAY8THRE
return E_NOINTERFACE; 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); ULONG RefCount = InterlockedIncrement(&This->ref);
return RefCount; 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); ULONG RefCount = InterlockedDecrement(&This->ref);
if(!RefCount) if(!RefCount)
@ -75,31 +80,36 @@ static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(PDIRECTPLAY8THREADPOOL if
} }
/* IDirectPlay8ThreadPool interface follows */ /* 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); FIXME("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags);
return DPN_OK; 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; 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); FIXME("(%p)->(%x,%p,%x): stub\n", iface, dwProcessorNum, pdwNumThreads, dwFlags);
*pdwNumThreads = 0; *pdwNumThreads = 0;
return DPN_OK; 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); FIXME("(%p)->(%x,%x,%x): stub\n", iface, dwProcessorNum, dwNumThreads, dwFlags);
return DPN_OK; 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; static BOOL Run = FALSE;
@ -136,8 +146,9 @@ HRESULT DPNET_CreateDirectPlay8ThreadPool(LPCLASSFACTORY iface, LPUNKNOWN punkOu
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
Client->lpVtbl = &DirectPlay8ThreadPool_Vtbl; Client->IDirectPlay8ThreadPool_iface.lpVtbl = &DirectPlay8ThreadPool_Vtbl;
Client->ref = 0; Client->ref = 0;
return IDirectPlay8ThreadPoolImpl_QueryInterface((PDIRECTPLAY8THREADPOOL)Client, riid, ppobj); return IDirectPlay8ThreadPoolImpl_QueryInterface(&Client->IDirectPlay8ThreadPool_iface, riid,
ppobj);
} }