dpnet: Add stubbed interface IDirectPlay8Server.

This commit is contained in:
Alistair Leslie-Hughes 2014-01-08 13:19:47 +11:00 committed by Alexandre Julliard
parent 31a283d4da
commit 64b40aeb82
3 changed files with 429 additions and 4 deletions

View File

@ -23,19 +23,377 @@
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "ocidl.h"
#include "wine/debug.h"
#include "dplay8.h"
#include "dpnet_private.h"
typedef struct IDirectPlay8ServerImpl
{
IDirectPlay8Server IDirectPlay8Server_iface;
LONG ref;
} IDirectPlay8ServerImpl;
WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
HRESULT DPNET_CreateDirectPlay8Server(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
WARN("(%p, %s, %p): stub.\n", punkOuter, debugstr_guid(riid), ppobj);
return CLASS_E_CLASSNOTAVAILABLE;
static inline IDirectPlay8ServerImpl *impl_from_IDirectPlay8Server(IDirectPlay8Server *iface)
{
return CONTAINING_RECORD(iface, IDirectPlay8ServerImpl, IDirectPlay8Server_iface);
}
static HRESULT WINAPI IDirectPlay8ServerImpl_QueryInterface(IDirectPlay8Server *iface, REFIID riid, void **ppv)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppv);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirectPlay8Server))
{
TRACE("(%p)->(IID_IDirectPlay8Server %p)\n", This, ppv);
*ppv = &This->IDirectPlay8Server_iface;
}
else {
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI IDirectPlay8ServerImpl_AddRef(IDirectPlay8Server *iface)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI IDirectPlay8ServerImpl_Release(IDirectPlay8Server *iface)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_Initialize(IDirectPlay8Server *iface, PVOID pvUserContext,
PFNDPNMESSAGEHANDLER pfn, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, pvUserContext, pfn, dwFlags);
return DPN_OK;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_EnumServiceProviders(IDirectPlay8Server *iface, const GUID *pguidServiceProvider,
const GUID *pguidApplication, DPN_SERVICE_PROVIDER_INFO *pSPInfoBuffer, PDWORD pcbEnumData,
PDWORD pcReturned, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%s %s %p %p %p %d)\n", This, debugstr_guid(pguidServiceProvider), debugstr_guid(pguidApplication),
pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_CancelAsyncOperation(IDirectPlay8Server *iface, DPNHANDLE hAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %d)\n", This, hAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetSendQueueInfo(IDirectPlay8Server *iface, DPNID dpnid, DWORD *pdwNumMsgs,
DWORD *pdwNumBytes, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %d)\n", This, dpnid, pdwNumMsgs, pdwNumBytes, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetApplicationDesc(IDirectPlay8Server *iface, DPN_APPLICATION_DESC *pAppDescBuffer,
DWORD *pcbDataSize, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, pAppDescBuffer, pcbDataSize, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SetServerInfo(IDirectPlay8Server *iface, const DPN_PLAYER_INFO *pdpnPlayerInfo,
PVOID pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %p %d)\n", This, pdpnPlayerInfo, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetClientInfo(IDirectPlay8Server *iface, DPNID dpnid, DPN_PLAYER_INFO *pdpnPlayerInfo,
DWORD *pdwSize, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %d)\n", This, dpnid, pdpnPlayerInfo, pdwSize, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetClientAddress(IDirectPlay8Server *iface, DPNID dpnid, IDirectPlay8Address **pAddress,
DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d)\n", This, dpnid, pAddress, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetLocalHostAddresses(IDirectPlay8Server *iface, IDirectPlay8Address **prgpAddress,
DWORD *pcAddress, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, prgpAddress, pcAddress, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SetApplicationDesc(IDirectPlay8Server *iface, const DPN_APPLICATION_DESC *pad, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %d)\n", This, pad, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_Host(IDirectPlay8Server *iface, const DPN_APPLICATION_DESC *pdnAppDesc,
IDirectPlay8Address **prgpDeviceInfo, DWORD cDeviceInfo, const DPN_SECURITY_DESC *pdnSecurity,
const DPN_SECURITY_CREDENTIALS *pdnCredentials, void *pvPlayerContext, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d %p %p %p %d)\n", This, pdnAppDesc, prgpDeviceInfo, cDeviceInfo, pdnSecurity, pdnCredentials,
pvPlayerContext, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SendTo(IDirectPlay8Server *iface, DPNID dpnid, const DPN_BUFFER_DESC *prgBufferDesc,
DWORD cBufferDesc, DWORD dwTimeOut, void *pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d %d %p %p %d)\n", This, dpnid, prgBufferDesc, cBufferDesc, dwTimeOut, pvAsyncContext, phAsyncHandle,
dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_CreateGroup(IDirectPlay8Server *iface, const DPN_GROUP_INFO *pdpnGroupInfo,
void *pvGroupContext, void *pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %p %p %d)\n", This, pdpnGroupInfo, pvGroupContext, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_DestroyGroup(IDirectPlay8Server *iface, DPNID idGroup, PVOID pvAsyncContext,
DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %d)\n", This, idGroup, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_AddPlayerToGroup(IDirectPlay8Server *iface, DPNID idGroup, DPNID idClient,
PVOID pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %d %p %p %d)\n", This, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_RemovePlayerFromGroup(IDirectPlay8Server *iface, DPNID idGroup, DPNID idClient,
PVOID pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %d %p %p %d)\n", This, idGroup, idClient, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SetGroupInfo(IDirectPlay8Server *iface, DPNID dpnid, DPN_GROUP_INFO *pdpnGroupInfo,
PVOID pvAsyncContext, DPNHANDLE *phAsyncHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %p %d)\n", This, dpnid, pdpnGroupInfo, pvAsyncContext, phAsyncHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetGroupInfo(IDirectPlay8Server *iface, DPNID dpnid, DPN_GROUP_INFO *pdpnGroupInfo,
DWORD *pdwSize, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %d)\n", This, dpnid, pdpnGroupInfo, pdwSize, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_EnumPlayersAndGroups(IDirectPlay8Server *iface, DPNID *prgdpnid, DWORD *pcdpnid, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, prgdpnid, pcdpnid, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_EnumGroupMembers(IDirectPlay8Server *iface, DPNID dpnid, DPNID *prgdpnid, DWORD *pcdpnid, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %p %d)\n", This, dpnid, prgdpnid, pcdpnid, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_Close(IDirectPlay8Server *iface, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d)\n", This, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_DestroyClient(IDirectPlay8Server *iface, DPNID dpnidClient, const void *pvDestroyData,
DWORD dwDestroyDataSize, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d %d)\n", This, dpnidClient, pvDestroyData, dwDestroyDataSize, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_ReturnBuffer(IDirectPlay8Server *iface, DPNHANDLE hBufferHandle, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %d)\n", This, hBufferHandle, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetPlayerContext(IDirectPlay8Server *iface, DPNID dpnid, PVOID *ppvPlayerContext, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d)\n", This, dpnid, ppvPlayerContext, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetGroupContext(IDirectPlay8Server *iface, DPNID dpnid, PVOID *ppvGroupContext, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d)\n", This, dpnid, ppvGroupContext, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetCaps(IDirectPlay8Server *iface, DPN_CAPS *pdpCaps, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %d)\n", This, pdpCaps, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SetCaps(IDirectPlay8Server *iface, const DPN_CAPS *pdpCaps, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %d)\n", This, pdpCaps, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_SetSPCaps(IDirectPlay8Server *iface, const GUID *pguidSP, const DPN_SP_CAPS *pdpspCaps, DWORD dwFlags )
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, pguidSP, pdpspCaps, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetSPCaps(IDirectPlay8Server *iface, const GUID *pguidSP, DPN_SP_CAPS *pdpspCaps, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%p %p %d)\n", This, pguidSP, pdpspCaps, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_GetConnectionInfo(IDirectPlay8Server *iface, DPNID dpnid,
DPN_CONNECTION_INFO *pdpConnectionInfo, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d)\n", This, dpnid, pdpConnectionInfo, dwFlags);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectPlay8ServerImpl_RegisterLobby(IDirectPlay8Server *iface, DPNHANDLE dpnHandle,
struct IDirectPlay8LobbiedApplication *pIDP8LobbiedApplication, DWORD dwFlags)
{
IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface);
FIXME("(%p)->(%d %p %d)\n", This, dpnHandle, pIDP8LobbiedApplication, dwFlags);
return E_NOTIMPL;
}
static const IDirectPlay8ServerVtbl DirectPlay8ServerVtbl =
{
IDirectPlay8ServerImpl_QueryInterface,
IDirectPlay8ServerImpl_AddRef,
IDirectPlay8ServerImpl_Release,
IDirectPlay8ServerImpl_Initialize,
IDirectPlay8ServerImpl_EnumServiceProviders,
IDirectPlay8ServerImpl_CancelAsyncOperation,
IDirectPlay8ServerImpl_GetSendQueueInfo,
IDirectPlay8ServerImpl_GetApplicationDesc,
IDirectPlay8ServerImpl_SetServerInfo,
IDirectPlay8ServerImpl_GetClientInfo,
IDirectPlay8ServerImpl_GetClientAddress,
IDirectPlay8ServerImpl_GetLocalHostAddresses,
IDirectPlay8ServerImpl_SetApplicationDesc,
IDirectPlay8ServerImpl_Host,
IDirectPlay8ServerImpl_SendTo,
IDirectPlay8ServerImpl_CreateGroup,
IDirectPlay8ServerImpl_DestroyGroup,
IDirectPlay8ServerImpl_AddPlayerToGroup,
IDirectPlay8ServerImpl_RemovePlayerFromGroup,
IDirectPlay8ServerImpl_SetGroupInfo,
IDirectPlay8ServerImpl_GetGroupInfo,
IDirectPlay8ServerImpl_EnumPlayersAndGroups,
IDirectPlay8ServerImpl_EnumGroupMembers,
IDirectPlay8ServerImpl_Close,
IDirectPlay8ServerImpl_DestroyClient,
IDirectPlay8ServerImpl_ReturnBuffer,
IDirectPlay8ServerImpl_GetPlayerContext,
IDirectPlay8ServerImpl_GetGroupContext,
IDirectPlay8ServerImpl_GetCaps,
IDirectPlay8ServerImpl_SetCaps,
IDirectPlay8ServerImpl_SetSPCaps,
IDirectPlay8ServerImpl_GetSPCaps,
IDirectPlay8ServerImpl_GetConnectionInfo,
IDirectPlay8ServerImpl_RegisterLobby
};
HRESULT DPNET_CreateDirectPlay8Server(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
IDirectPlay8ServerImpl *server;
HRESULT hr;
TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
*ppv = NULL;
if(pUnkOuter)
return CLASS_E_NOAGGREGATION;
server = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ServerImpl));
if (!server)
return E_OUTOFMEMORY;
server->IDirectPlay8Server_iface.lpVtbl = &DirectPlay8ServerVtbl;
server->ref = 1;
hr = IDirectPlay8Server_QueryInterface(&server->IDirectPlay8Server_iface, riid, ppv);
IDirectPlay8Server_Release(&server->IDirectPlay8Server_iface);
return hr;
}

View File

@ -2,4 +2,5 @@ TESTDLL = dpnet.dll
IMPORTS = dpnet ole32
C_SRCS = \
peer.c
peer.c \
server.c

66
dlls/dpnet/tests/server.c Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright 2014 Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <dplay8.h>
#include "wine/test.h"
static HRESULT WINAPI DirectPlayMessageHandler(PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer)
{
return S_OK;
}
static void create_server(void)
{
HRESULT hr;
IDirectPlay8Server *server = NULL;
hr = CoCreateInstance( &CLSID_DirectPlay8Server, NULL, CLSCTX_ALL, &IID_IDirectPlay8Server, (LPVOID*)&server);
ok(hr == S_OK, "Failed to create IDirectPlay8Server object");
if( SUCCEEDED(hr) )
{
hr = IDirectPlay8Server_Close(server, 0);
todo_wine ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
hr = IDirectPlay8Server_Initialize(server, NULL, DirectPlayMessageHandler, 0);
ok(hr == S_OK, "got 0x%08x\n", hr);
if(hr == S_OK)
{
hr = IDirectPlay8Server_Close(server, 0);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
}
IDirectPlay8Server_Release(server);
}
}
START_TEST(server)
{
HRESULT hr;
hr = CoInitialize(0);
ok( hr == S_OK, "failed to init com\n");
if (hr != S_OK)
return;
create_server();
CoUninitialize();
}