dpnet: Store information when Initialize is called.

This commit is contained in:
Alistair Leslie-Hughes 2014-01-20 09:59:41 +11:00 committed by Alexandre Julliard
parent 9b68329429
commit 658a5f450b
2 changed files with 19 additions and 0 deletions

View File

@ -43,6 +43,10 @@ typedef struct IDirectPlay8PeerImpl
{
IDirectPlay8Peer IDirectPlay8Peer_iface;
LONG ref;
PFNDPNMESSAGEHANDLER msghandler;
DWORD flags;
void *usercontext;
} IDirectPlay8PeerImpl;
static inline IDirectPlay8PeerImpl *impl_from_IDirectPlay8Peer(IDirectPlay8Peer *iface)
@ -96,8 +100,17 @@ static ULONG WINAPI IDirectPlay8PeerImpl_Release(IDirectPlay8Peer *iface)
static HRESULT WINAPI IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer *iface,
void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
{
IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
TRACE("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags);
if(!pfn)
return DPNERR_INVALIDPARAM;
This->usercontext = pvUserContext;
This->msghandler = pfn;
This->flags = dwFlags;
return DPN_OK;
}
@ -502,6 +515,9 @@ HRESULT DPNET_CreateDirectPlay8Peer(IClassFactory *iface, IUnknown *pUnkOuter, R
Client->IDirectPlay8Peer_iface.lpVtbl = &DirectPlay8Peer_Vtbl;
Client->ref = 1;
Client->usercontext = NULL;
Client->msghandler = NULL;
Client->flags = 0;
ret = IDirectPlay8Peer_QueryInterface(&Client->IDirectPlay8Peer_iface, riid, ppobj);
IDirectPlay8Peer_Release(&Client->IDirectPlay8Peer_iface);

View File

@ -51,6 +51,9 @@ static void test_init_dp(void)
hr = CoCreateInstance(&CLSID_DirectPlay8Peer, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay8Peer, (void **)&peer);
ok(hr == S_OK, "CoCreateInstance failed with 0x%x\n", hr);
hr = IDirectPlay8Peer_Initialize(peer, NULL, NULL, 0);
ok(hr == DPNERR_INVALIDPARAM, "got %x\n", hr);
hr = IDirectPlay8Peer_Initialize(peer, NULL, DirectPlayMessageHandler, 0);
ok(hr == S_OK, "IDirectPlay8Peer_Initialize failed with %x\n", hr);
}