Commit d9ae2b82 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dpnet: Implement IDirectPlay8LobbiedApplication Initialize.

parent 2cef8dbc
......@@ -80,6 +80,11 @@ struct IDirectPlay8LobbiedApplicationImpl
{
IDirectPlay8LobbiedApplication IDirectPlay8LobbiedApplication_iface;
LONG ref;
PFNDPNMESSAGEHANDLER msghandler;
DWORD flags;
void *usercontext;
DPNHANDLE *connection;
};
/*****************************************************************************
......
......@@ -90,7 +90,17 @@ static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Initialize(IDirectPlay8
DPNHANDLE * const pdpnhConnection, const DWORD dwFlags)
{
IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
FIXME("(%p): stub\n", This);
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;
}
......
......@@ -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();
}
......
......@@ -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();
}
......
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