2004-04-07 22:39:00 +02:00
|
|
|
/*
|
|
|
|
* DirectPlay8 Client
|
|
|
|
*
|
|
|
|
* Copyright 2004 Raphael Junqueira
|
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-04-07 22:39:00 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2006-06-10 11:57:38 +02:00
|
|
|
#define COBJMACROS
|
2004-04-07 22:39:00 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "dplay8.h"
|
|
|
|
#include "dpnet_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8Client *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectPlay8ClientImpl, IDirectPlay8Client_iface);
|
|
|
|
}
|
|
|
|
|
2004-04-07 22:39:00 +02:00
|
|
|
/* IDirectPlay8Client IUnknown parts follow: */
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
|
|
|
|
void **ppobj)
|
2004-04-07 22:39:00 +02:00
|
|
|
{
|
2011-08-03 12:07:37 +02:00
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2004-04-07 22:39:00 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
|
|
|
|| IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
|
2006-06-10 11:57:38 +02:00
|
|
|
IUnknown_AddRef(iface);
|
2004-04-07 22:39:00 +02:00
|
|
|
*ppobj = This;
|
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(IDirectPlay8Client *iface)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
|
|
|
|
2006-10-08 23:50:09 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
|
|
|
return refCount;
|
2004-04-07 22:39:00 +02:00
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static ULONG WINAPI IDirectPlay8ClientImpl_Release(IDirectPlay8Client *iface)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
|
|
|
|
2006-10-08 23:50:09 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
|
|
|
if (!refCount) {
|
2004-04-07 22:39:00 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2004-04-07 22:39:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* IDirectPlay8Client Interface follow: */
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(IDirectPlay8Client *iface,
|
|
|
|
void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pfn, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_EnumServiceProviders(IDirectPlay8Client *iface,
|
|
|
|
const GUID * const pguidServiceProvider, const GUID * const pguidApplication,
|
|
|
|
DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, PDWORD const pcbEnumData,
|
|
|
|
PDWORD const pcReturned, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface,
|
|
|
|
PDPN_APPLICATION_DESC const pApplicationDesc, IDirectPlay8Address * const pAddrHost,
|
|
|
|
IDirectPlay8Address * const pDeviceInfo, void * const pUserEnumData,
|
|
|
|
const DWORD dwUserEnumDataSize, const DWORD dwEnumCount, const DWORD dwRetryInterval,
|
|
|
|
const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle,
|
|
|
|
const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
|
|
|
|
const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_Connect(IDirectPlay8Client *iface,
|
|
|
|
const DPN_APPLICATION_DESC * const pdnAppDesc, IDirectPlay8Address * const pHostAddr,
|
|
|
|
IDirectPlay8Address * const pDeviceInfo, const DPN_SECURITY_DESC * const pdnSecurity,
|
|
|
|
const DPN_SECURITY_CREDENTIALS * const pdnCredentials, const void * const pvUserConnectData,
|
|
|
|
const DWORD dwUserConnectDataSize, void * const pvAsyncContext,
|
|
|
|
DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_Send(IDirectPlay8Client *iface,
|
|
|
|
const DPN_BUFFER_DESC * const prgBufferDesc, const DWORD cBufferDesc, const DWORD dwTimeOut,
|
|
|
|
void * const pvAsyncContext, DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(IDirectPlay8Client *iface,
|
|
|
|
DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(IDirectPlay8Client *iface,
|
|
|
|
DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_SetClientInfo(IDirectPlay8Client *iface,
|
|
|
|
const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
|
|
|
|
DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(IDirectPlay8Client *iface,
|
|
|
|
DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(IDirectPlay8Client *iface,
|
|
|
|
IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_Close(IDirectPlay8Client *iface, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(IDirectPlay8Client *iface,
|
|
|
|
const DPNHANDLE hBufferHandle, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(IDirectPlay8Client *iface,
|
|
|
|
DPN_CAPS * const pdpCaps, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
2004-04-07 22:39:00 +02:00
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(IDirectPlay8Client *iface,
|
|
|
|
const DPN_CAPS * const pdpCaps, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(IDirectPlay8Client *iface,
|
|
|
|
const GUID * const pguidSP, const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(IDirectPlay8Client *iface,
|
|
|
|
const GUID * const pguidSP, DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(IDirectPlay8Client *iface,
|
|
|
|
DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-03 12:07:37 +02:00
|
|
|
static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(IDirectPlay8Client *iface,
|
|
|
|
const DPNHANDLE dpnHandle,
|
|
|
|
struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
|
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
|
2006-10-08 23:50:09 +02:00
|
|
|
FIXME("(%p):(%x): Stub\n", This, dwFlags);
|
2004-04-08 06:38:26 +02:00
|
|
|
return DPN_OK;
|
|
|
|
}
|
2004-04-07 22:39:00 +02:00
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
|
2004-04-07 22:39:00 +02:00
|
|
|
{
|
|
|
|
IDirectPlay8ClientImpl_QueryInterface,
|
|
|
|
IDirectPlay8ClientImpl_AddRef,
|
|
|
|
IDirectPlay8ClientImpl_Release,
|
|
|
|
IDirectPlay8ClientImpl_Initialize,
|
|
|
|
IDirectPlay8ClientImpl_EnumServiceProviders,
|
|
|
|
IDirectPlay8ClientImpl_EnumHosts,
|
|
|
|
IDirectPlay8ClientImpl_CancelAsyncOperation,
|
|
|
|
IDirectPlay8ClientImpl_Connect,
|
|
|
|
IDirectPlay8ClientImpl_Send,
|
|
|
|
IDirectPlay8ClientImpl_GetSendQueueInfo,
|
|
|
|
IDirectPlay8ClientImpl_GetApplicationDesc,
|
|
|
|
IDirectPlay8ClientImpl_SetClientInfo,
|
|
|
|
IDirectPlay8ClientImpl_GetServerInfo,
|
|
|
|
IDirectPlay8ClientImpl_GetServerAddress,
|
|
|
|
IDirectPlay8ClientImpl_Close,
|
|
|
|
IDirectPlay8ClientImpl_ReturnBuffer,
|
|
|
|
IDirectPlay8ClientImpl_GetCaps,
|
|
|
|
IDirectPlay8ClientImpl_SetCaps,
|
|
|
|
IDirectPlay8ClientImpl_SetSPCaps,
|
|
|
|
IDirectPlay8ClientImpl_GetSPCaps,
|
|
|
|
IDirectPlay8ClientImpl_GetConnectionInfo,
|
|
|
|
IDirectPlay8ClientImpl_RegisterLobby
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT DPNET_CreateDirectPlay8Client(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
|
|
|
|
IDirectPlay8ClientImpl* client;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
|
|
|
|
|
|
|
|
client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
|
|
|
|
if (NULL == client) {
|
|
|
|
*ppobj = NULL;
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2011-08-03 12:07:37 +02:00
|
|
|
client->IDirectPlay8Client_iface.lpVtbl = &DirectPlay8Client_Vtbl;
|
2004-04-07 22:39:00 +02:00
|
|
|
client->ref = 0; /* will be inited with QueryInterface */
|
2011-08-03 12:07:37 +02:00
|
|
|
return IDirectPlay8ClientImpl_QueryInterface(&client->IDirectPlay8Client_iface, riid, ppobj);
|
2004-04-07 22:39:00 +02:00
|
|
|
}
|