dpnet: Implement IDirectPlay8LobbiedApplication Initialize.

This commit is contained in:
Alistair Leslie-Hughes 2014-02-14 14:53:40 +11:00 committed by Alexandre Julliard
parent 2cef8dbcc2
commit d9ae2b828e
4 changed files with 76 additions and 9 deletions

View File

@ -78,8 +78,13 @@ struct IDirectPlay8AddressImpl
*/
struct IDirectPlay8LobbiedApplicationImpl
{
IDirectPlay8LobbiedApplication IDirectPlay8LobbiedApplication_iface;
LONG ref;
IDirectPlay8LobbiedApplication IDirectPlay8LobbiedApplication_iface;
LONG ref;
PFNDPNMESSAGEHANDLER msghandler;
DWORD flags;
void *usercontext;
DPNHANDLE *connection;
};
/*****************************************************************************

View File

@ -89,9 +89,19 @@ static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Initialize(IDirectPlay8
void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn,
DPNHANDLE * const pdpnhConnection, const DWORD dwFlags)
{
IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
FIXME("(%p): stub\n", This);
return DPN_OK;
IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
TRACE("(%p)->(%p %p %p %x)\n", This, pvUserContext, pfn, pdpnhConnection, dwFlags);
if(!pfn)
return DPNERR_INVALIDPOINTER;
This->msghandler = pfn;
This->flags = dwFlags;
This->usercontext = pvUserContext;
This->connection = pdpnhConnection;
return DPN_OK;
}
static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_RegisterProgram(IDirectPlay8LobbiedApplication *iface,

View File

@ -21,10 +21,12 @@
#include <stdio.h>
#include <dplay8.h>
#include <dplobby8.h>
#include "wine/test.h"
static IDirectPlay8Client* client = NULL;
static IDirectPlay8LobbiedApplication* lobbied = NULL;
static const GUID appguid = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa5 } };
static HRESULT WINAPI DirectPlayMessageHandler(PVOID context, DWORD message_id, PVOID buffer)
@ -33,10 +35,17 @@ static HRESULT WINAPI DirectPlayMessageHandler(PVOID context, DWORD message_id,
return S_OK;
}
static HRESULT WINAPI DirectPlayLobbyMessageHandler(PVOID context, DWORD message_id, PVOID buffer)
{
trace("DirectPlayLobbyMessageHandler: 0x%08x\n", message_id);
return S_OK;
}
static BOOL test_init_dp(void)
{
HRESULT hr;
DPN_SP_CAPS caps;
DPNHANDLE lobbyConnection;
hr = CoInitialize(0);
ok(hr == S_OK, "CoInitialize failed with %x\n", hr);
@ -56,6 +65,14 @@ static BOOL test_init_dp(void)
hr = IDirectPlay8Client_Initialize(client, NULL, DirectPlayMessageHandler, 0);
ok(hr == S_OK, "IDirectPlay8Client_Initialize failed with %x\n", hr);
hr = CoCreateInstance(&CLSID_DirectPlay8LobbiedApplication, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectPlay8LobbiedApplication, (void **)&lobbied);
ok(hr == S_OK, "CoCreateInstance failed with 0x%x\n", hr);
hr = IDirectPlay8LobbiedApplication_Initialize(lobbied, NULL, DirectPlayLobbyMessageHandler,
&lobbyConnection, 0);
ok(hr == S_OK, "IDirectPlay8LobbiedApplication_Initialize failed with %x\n", hr);
return client != NULL;
}
@ -195,8 +212,15 @@ static void test_cleanup_dp(void)
hr = IDirectPlay8Client_Close(client, 0);
ok(hr == S_OK, "IDirectPlay8Client_Close failed with %x\n", hr);
hr = IDirectPlay8Client_Release(client);
ok(hr == S_OK, "IDirectPlay8Client_Release failed with %x\n", hr);
if(lobbied)
{
hr = IDirectPlay8LobbiedApplication_Close(lobbied, 0);
ok(hr == S_OK, "IDirectPlay8LobbiedApplication_Close failed with %x\n", hr);
IDirectPlay8LobbiedApplication_Release(lobbied);
}
IDirectPlay8Client_Release(client);
CoUninitialize();
}

View File

@ -20,10 +20,12 @@
#include <stdio.h>
#include <dplay8.h>
#include <dplobby8.h>
#include "wine/test.h"
static IDirectPlay8Peer* peer = NULL;
static IDirectPlay8LobbiedApplication* lobbied = NULL;
static HRESULT WINAPI DirectPlayMessageHandler(PVOID context, DWORD message_id, PVOID buffer)
{
@ -31,10 +33,17 @@ static HRESULT WINAPI DirectPlayMessageHandler(PVOID context, DWORD message_id,
return S_OK;
}
static HRESULT WINAPI DirectPlayLobbyMessageHandler(PVOID context, DWORD message_id, PVOID buffer)
{
trace("DirectPlayLobbyMessageHandler: 0x%08x\n", message_id);
return S_OK;
}
static void test_init_dp(void)
{
HRESULT hr;
DPN_SP_CAPS caps;
DPNHANDLE lobbyConnection;
hr = CoInitialize(0);
ok(hr == S_OK, "CoInitialize failed with %x\n", hr);
@ -53,6 +62,18 @@ static void test_init_dp(void)
hr = IDirectPlay8Peer_Initialize(peer, NULL, DirectPlayMessageHandler, 0);
ok(hr == S_OK, "IDirectPlay8Peer_Initialize failed with %x\n", hr);
hr = CoCreateInstance(&CLSID_DirectPlay8LobbiedApplication, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectPlay8LobbiedApplication, (void **)&lobbied);
ok(hr == S_OK, "CoCreateInstance failed with 0x%x\n", hr);
hr = IDirectPlay8LobbiedApplication_Initialize(lobbied, NULL, NULL,
&lobbyConnection, 0);
ok(hr == DPNERR_INVALIDPOINTER, "Failed with %x\n", hr);
hr = IDirectPlay8LobbiedApplication_Initialize(lobbied, NULL, DirectPlayLobbyMessageHandler,
&lobbyConnection, 0);
ok(hr == S_OK, "IDirectPlay8LobbiedApplication_Initialize failed with %x\n", hr);
}
static void test_enum_service_providers(void)
@ -198,8 +219,15 @@ static void test_cleanup_dp(void)
hr = IDirectPlay8Peer_Close(peer, 0);
ok(hr == S_OK, "IDirectPlay8Peer_Close failed with %x\n", hr);
hr = IDirectPlay8Peer_Release(peer);
ok(hr == S_OK, "IDirectPlay8Peer_Release failed with %x\n", hr);
if(lobbied)
{
hr = IDirectPlay8LobbiedApplication_Close(lobbied, 0);
ok(hr == S_OK, "IDirectPlay8LobbiedApplication_Close failed with %x\n", hr);
IDirectPlay8LobbiedApplication_Release(lobbied);
}
IDirectPlay8Peer_Release(peer);
CoUninitialize();
}