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

dpnet: Store DPN_SP_CAPS as part of the object.

parent 3cd86c9f
......@@ -99,6 +99,8 @@ extern HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN pu
extern HRESULT DPNET_CreateDirectPlay8LobbiedApp(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPNET_CreateDirectPlay8ThreadPool(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
extern void init_dpn_sp_caps(DPN_SP_CAPS *dpnspcaps) DECLSPEC_HIDDEN;
/* used for generic dumping (copied from ddraw) */
typedef struct {
DWORD val;
......
......@@ -47,6 +47,8 @@ typedef struct IDirectPlay8PeerImpl
PFNDPNMESSAGEHANDLER msghandler;
DWORD flags;
void *usercontext;
DPN_SP_CAPS spcaps;
} IDirectPlay8PeerImpl;
static inline IDirectPlay8PeerImpl *impl_from_IDirectPlay8Peer(IDirectPlay8Peer *iface)
......@@ -416,22 +418,19 @@ static HRESULT WINAPI IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer *iface, co
static HRESULT WINAPI IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
{
TRACE("(%p)->(%p,%p,%x)\n", iface, pguidSP, pdpspCaps, dwFlags);
IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
TRACE("(%p)->(%p,%p,%x)\n", This, pguidSP, pdpspCaps, dwFlags);
if(!This->msghandler)
return DPNERR_UNINITIALIZED;
if(pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
{
return DPNERR_INVALIDPARAM;
}
pdpspCaps->dwFlags = DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST |
DPNSPCAPS_SUPPORTSALLADAPTERS | DPNSPCAPS_SUPPORTSTHREADPOOL;
pdpspCaps->dwNumThreads = 3;
pdpspCaps->dwDefaultEnumCount = 5;
pdpspCaps->dwDefaultEnumRetryInterval = 1500;
pdpspCaps->dwDefaultEnumTimeout = 1500;
pdpspCaps->dwMaxEnumPayloadSize = 983;
pdpspCaps->dwBuffersPerThread = 1;
pdpspCaps->dwSystemBufferSize = 0x10000;
*pdpspCaps = This->spcaps;
return DPN_OK;
}
......@@ -501,6 +500,19 @@ static const IDirectPlay8PeerVtbl DirectPlay8Peer_Vtbl =
IDirectPlay8PeerImpl_TerminateSession
};
void init_dpn_sp_caps(DPN_SP_CAPS *dpnspcaps)
{
dpnspcaps->dwFlags = DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST |
DPNSPCAPS_SUPPORTSALLADAPTERS | DPNSPCAPS_SUPPORTSTHREADPOOL;
dpnspcaps->dwNumThreads = 3;
dpnspcaps->dwDefaultEnumCount = 5;
dpnspcaps->dwDefaultEnumRetryInterval = 1500;
dpnspcaps->dwDefaultEnumTimeout = 1500;
dpnspcaps->dwMaxEnumPayloadSize = 983;
dpnspcaps->dwBuffersPerThread = 1;
dpnspcaps->dwSystemBufferSize = 0x10000;
};
HRESULT DPNET_CreateDirectPlay8Peer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj)
{
IDirectPlay8PeerImpl* Client;
......@@ -522,6 +534,8 @@ HRESULT DPNET_CreateDirectPlay8Peer(IClassFactory *iface, IUnknown *pUnkOuter, R
Client->msghandler = NULL;
Client->flags = 0;
init_dpn_sp_caps(&Client->spcaps);
ret = IDirectPlay8Peer_QueryInterface(&Client->IDirectPlay8Peer_iface, riid, ppobj);
IDirectPlay8Peer_Release(&Client->IDirectPlay8Peer_iface);
......
......@@ -34,6 +34,7 @@ static HRESULT WINAPI DirectPlayMessageHandler(PVOID context, DWORD message_id,
static void test_init_dp(void)
{
HRESULT hr;
DPN_SP_CAPS caps;
hr = CoInitialize(0);
ok(hr == S_OK, "CoInitialize failed with %x\n", hr);
......@@ -41,6 +42,12 @@ 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);
memset(&caps, 0, sizeof(DPN_SP_CAPS));
caps.dwSize = sizeof(DPN_SP_CAPS);
hr = IDirectPlay8Peer_GetSPCaps(peer, &CLSID_DP8SP_TCPIP, &caps, 0);
ok(hr == DPNERR_UNINITIALIZED, "GetSPCaps failed with %x\n", hr);
hr = IDirectPlay8Peer_Initialize(peer, NULL, NULL, 0);
ok(hr == DPNERR_INVALIDPARAM, "got %x\n", hr);
......
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