client.c 19.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* 
 * 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
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20 21 22 23 24
 *
 */


#include <stdarg.h>

25
#define COBJMACROS
26 27 28 29 30 31 32 33 34 35 36
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "wine/debug.h"

#include "dpnet_private.h"

WINE_DEFAULT_DEBUG_CHANNEL(dpnet);

37 38 39 40
typedef struct IDirectPlay8LobbyClientImpl
{
    IDirectPlay8LobbyClient IDirectPlay8LobbyClient_iface;
    LONG ref;
41 42 43 44

    PFNDPNMESSAGEHANDLER msghandler;
    DWORD flags;
    void *usercontext;
45 46 47 48 49 50 51
} IDirectPlay8LobbyClientImpl;

static inline IDirectPlay8LobbyClientImpl *impl_from_IDirectPlay8LobbyClient(IDirectPlay8LobbyClient *iface)
{
    return CONTAINING_RECORD(iface, IDirectPlay8LobbyClientImpl, IDirectPlay8LobbyClient_iface);
}

52 53 54 55 56
static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8Client *iface)
{
    return CONTAINING_RECORD(iface, IDirectPlay8ClientImpl, IDirectPlay8Client_iface);
}

57
/* IDirectPlay8Client IUnknown parts follow: */
58 59
static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
        void **ppobj)
60
{
61
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
62 63 64

    if (IsEqualGUID(riid, &IID_IUnknown)
        || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
65
        IUnknown_AddRef(iface);
66 67 68 69 70 71 72 73
        *ppobj = This;
        return DPN_OK;
    }

    WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
    return E_NOINTERFACE;
}

74 75 76
static ULONG WINAPI IDirectPlay8ClientImpl_AddRef(IDirectPlay8Client *iface)
{
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
77
    ULONG ref = InterlockedIncrement(&This->ref);
78

79
    TRACE("(%p) ref=%u\n", This, ref);
80

81
    return ref;
82 83
}

84 85 86
static ULONG WINAPI IDirectPlay8ClientImpl_Release(IDirectPlay8Client *iface)
{
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
87
    ULONG ref = InterlockedDecrement(&This->ref);
88

89
    TRACE("(%p) ref=%u\n", This, ref);
90

91 92 93 94 95
    if (!ref)
    {
        heap_free(This->username);
        heap_free(This->data);
        heap_free(This);
96
    }
97
    return ref;
98 99 100 101
}

/* IDirectPlay8Client Interface follow: */

102 103 104
static HRESULT WINAPI IDirectPlay8ClientImpl_Initialize(IDirectPlay8Client *iface,
        void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags)
{
105 106 107 108 109 110 111 112 113 114 115
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);

    TRACE("(%p):(%p,%p,%x)\n", This, pvUserContext, pfn, dwFlags);

    if(!pfn)
        return DPNERR_INVALIDPARAM;

    This->usercontext = pvUserContext;
    This->msghandler = pfn;
    This->flags = dwFlags;

116 117
    init_winsock();

118
    return DPN_OK;
119 120
}

121 122 123 124 125
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)
{
126 127 128 129 130 131 132 133 134 135 136
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
    TRACE("(%p)->(%s,%s,%p,%p,%p,%x)\n", This, debugstr_guid(pguidServiceProvider), debugstr_guid(pguidApplication),
                                             pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags);

    if(dwFlags)
        FIXME("Unhandled flags %x\n", dwFlags);

    if(pguidApplication)
        FIXME("Application guid %s is currently being ignored\n", debugstr_guid(pguidApplication));

    return enum_services_providers(pguidServiceProvider, pSPInfoBuffer, pcbEnumData, pcReturned);
137 138
}

139 140 141 142 143 144 145
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)
{
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);

    FIXME("(%p):(%p,%p,%p,%p,%u,%u,%u,%u,%p,%p,%x)\n", This, pApplicationDesc, pAddrHost, pDeviceInfo, pUserEnumData,
        dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut, pvUserContext, pAsyncHandle, dwFlags);

    if(!This->msghandler)
        return DPNERR_UNINITIALIZED;

    if((dwFlags & DPNENUMHOSTS_SYNC) && pAsyncHandle)
        return DPNERR_INVALIDPARAM;

    if(dwUserEnumDataSize > This->spcaps.dwMaxEnumPayloadSize)
        return DPNERR_ENUMQUERYTOOLARGE;

    return (dwFlags & DPNENUMHOSTS_SYNC) ? DPN_OK : DPNSUCCESS_PENDING;
161 162
}

163 164 165 166
static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
        const DPNHANDLE hAsyncHandle, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
167
  FIXME("(%p):(%u,%x): Stub\n", This, hAsyncHandle, dwFlags);
168 169 170
  return DPN_OK; 
}

171 172 173 174 175 176 177 178
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);
179
  FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
180 181 182
  return DPN_OK; 
}

183 184 185 186 187
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);
188
  FIXME("(%p):(%p,%p,%x): Stub\n", This, pvAsyncContext, phAsyncHandle, dwFlags);
189 190 191
  return DPN_OK; 
}

192 193 194 195
static HRESULT WINAPI IDirectPlay8ClientImpl_GetSendQueueInfo(IDirectPlay8Client *iface,
        DWORD * const pdwNumMsgs, DWORD * const pdwNumBytes, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
196
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
197 198 199
  return DPN_OK; 
}

200 201 202 203
static HRESULT WINAPI IDirectPlay8ClientImpl_GetApplicationDesc(IDirectPlay8Client *iface,
        DPN_APPLICATION_DESC * const pAppDescBuffer, DWORD * const pcbDataSize, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
204
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
205 206 207
  return DPN_OK; 
}

208 209 210 211
static HRESULT WINAPI IDirectPlay8ClientImpl_SetClientInfo(IDirectPlay8Client *iface,
        const DPN_PLAYER_INFO * const pdpnPlayerInfo, void * const pvAsyncContext,
        DPNHANDLE * const phAsyncHandle, const DWORD dwFlags)
{
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
    FIXME("(%p):(%p,%p,%x): Semi-stub.\n", This, pvAsyncContext, phAsyncHandle, dwFlags);

    if(!pdpnPlayerInfo)
       return E_POINTER;

    if(phAsyncHandle)
        FIXME("Async handle currently not supported.\n");

    if (pdpnPlayerInfo->dwInfoFlags & DPNINFO_NAME)
    {
        heap_free(This->username);
        This->username = NULL;

        if(pdpnPlayerInfo->pwszName)
        {
            This->username = heap_strdupW(pdpnPlayerInfo->pwszName);
            if (!This->username)
                return E_OUTOFMEMORY;
        }
    }

    if (pdpnPlayerInfo->dwInfoFlags & DPNINFO_DATA)
    {
        heap_free(This->data);
        This->data = NULL;
        This->datasize = 0;

        if(!pdpnPlayerInfo->pvData && pdpnPlayerInfo->dwDataSize)
            return E_POINTER;

        if(pdpnPlayerInfo->dwDataSize && pdpnPlayerInfo->pvData)
        {
            This->data = heap_alloc(pdpnPlayerInfo->dwDataSize);
            if (!This->data)
                return E_OUTOFMEMORY;

            This->datasize = pdpnPlayerInfo->dwDataSize;

            memcpy(This->data, pdpnPlayerInfo->pvData, pdpnPlayerInfo->dwDataSize);
        }
    }

    return DPN_OK;
256 257
}

258 259 260 261
static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerInfo(IDirectPlay8Client *iface,
        DPN_PLAYER_INFO * const pdpnPlayerInfo, DWORD * const pdwSize, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
262
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
263 264 265
  return DPN_OK; 
}

266 267 268 269
static HRESULT WINAPI IDirectPlay8ClientImpl_GetServerAddress(IDirectPlay8Client *iface,
        IDirectPlay8Address ** const pAddress, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
270
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
271 272 273
  return DPN_OK; 
}

274 275
static HRESULT WINAPI IDirectPlay8ClientImpl_Close(IDirectPlay8Client *iface, const DWORD dwFlags)
{
276 277 278 279 280 281
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
    FIXME("(%p):(%x): Stub\n", This, dwFlags);

    This->msghandler = NULL;

    return DPN_OK;
282 283
}

284 285 286 287
static HRESULT WINAPI IDirectPlay8ClientImpl_ReturnBuffer(IDirectPlay8Client *iface,
        const DPNHANDLE hBufferHandle, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
288
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
289 290 291
  return DPN_OK; 
}

292 293 294 295
static HRESULT WINAPI IDirectPlay8ClientImpl_GetCaps(IDirectPlay8Client *iface,
        DPN_CAPS * const pdpCaps, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
296
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
297 298
  return DPN_OK; 
}
299

300 301 302 303
static HRESULT WINAPI IDirectPlay8ClientImpl_SetCaps(IDirectPlay8Client *iface,
        const DPN_CAPS * const pdpCaps, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
304
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
305 306 307
  return DPN_OK; 
}

308 309 310
static HRESULT WINAPI IDirectPlay8ClientImpl_SetSPCaps(IDirectPlay8Client *iface,
        const GUID * const pguidSP, const DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
{
311 312 313 314 315 316 317 318 319 320 321
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);

    TRACE("(%p)->(%p,%p,%x): stub\n", iface, pguidSP, pdpspCaps, dwFlags);

    if(!This->msghandler || pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
        return DPNERR_INVALIDPARAM;

    /* Only dwSystemBufferSize is set by this call. */
    This->spcaps.dwSystemBufferSize = pdpspCaps->dwSystemBufferSize;

    return DPN_OK;
322 323
}

324 325 326
static HRESULT WINAPI IDirectPlay8ClientImpl_GetSPCaps(IDirectPlay8Client *iface,
        const GUID * const pguidSP, DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
{
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(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 = This->spcaps;

    return DPN_OK;
342 343
}

344 345 346 347
static HRESULT WINAPI IDirectPlay8ClientImpl_GetConnectionInfo(IDirectPlay8Client *iface,
        DPN_CONNECTION_INFO * const pdpConnectionInfo, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
348
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
349 350 351
  return DPN_OK; 
}

352 353 354 355 356
static HRESULT WINAPI IDirectPlay8ClientImpl_RegisterLobby(IDirectPlay8Client *iface,
        const DPNHANDLE dpnHandle,
        struct IDirectPlay8LobbiedApplication * const pIDP8LobbiedApplication, const DWORD dwFlags)
{
  IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
357
  FIXME("(%p):(%x): Stub\n", This, dwFlags);
358 359
  return DPN_OK; 
}
360

361
static const IDirectPlay8ClientVtbl DirectPlay8Client_Vtbl =
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
{
    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
};

387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
HRESULT DPNET_CreateDirectPlay8Client(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
    IDirectPlay8ClientImpl* client;
    HRESULT hr;

    TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppv);

    *ppv = NULL;

    if(pUnkOuter)
        return CLASS_E_NOAGGREGATION;

    client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8ClientImpl));
    if (!client)
        return E_OUTOFMEMORY;

    client->IDirectPlay8Client_iface.lpVtbl = &DirectPlay8Client_Vtbl;
    client->ref = 1;

406 407
    init_dpn_sp_caps(&client->spcaps);

408 409 410 411
    hr = IDirectPlay8ClientImpl_QueryInterface(&client->IDirectPlay8Client_iface, riid, ppv);
    IDirectPlay8ClientImpl_Release(&client->IDirectPlay8Client_iface);

    return hr;
412
}
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

static HRESULT WINAPI lobbyclient_QueryInterface(IDirectPlay8LobbyClient *iface, REFIID riid, void **obj)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);

    *obj = NULL;

    if (IsEqualGUID(riid, &IID_IUnknown) ||
        IsEqualGUID(riid, &IID_IDirectPlay8LobbyClient))
    {
        *obj = &This->IDirectPlay8LobbyClient_iface;
        IUnknown_AddRef( (IUnknown*)*obj);

        return DPN_OK;
    }

    WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),obj);
    return E_NOINTERFACE;
}

static ULONG WINAPI lobbyclient_AddRef(IDirectPlay8LobbyClient *iface)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
    ULONG ref = InterlockedIncrement(&This->ref);

    TRACE("(%p) ref=%u\n", This, ref);

    return ref;
}

static ULONG WINAPI lobbyclient_Release(IDirectPlay8LobbyClient *iface)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
    ULONG ref = InterlockedDecrement(&This->ref);

    TRACE("(%p) ref=%u\n", This, ref);

    if (!ref)
    {
        HeapFree(GetProcessHeap(), 0, This);
    }

    return ref;
}

static HRESULT WINAPI lobbyclient_Initialize(IDirectPlay8LobbyClient *iface, void *context,
                                             PFNDPNMESSAGEHANDLER msghandler, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

465
    TRACE("(%p):(%p,%p,%x)\n", This, context, msghandler, flags);
466

467 468 469 470 471 472 473
    if(!msghandler)
        return E_POINTER;

    This->usercontext = context;
    This->msghandler = msghandler;
    This->flags = flags;

474 475
    init_winsock();

476
    return DPN_OK;
477 478 479 480 481 482 483 484 485
}

static HRESULT WINAPI lobbyclient_EnumLocalPrograms(IDirectPlay8LobbyClient *iface, GUID* guidapplication,
                                                    BYTE *enumdata, DWORD *enumDataSize, DWORD *items, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%p %p %p %p 0x%08x)\n", This, guidapplication, enumdata, enumDataSize, items, flags);

486 487 488 489
    if(enumDataSize)
        *enumDataSize = 0;

    return S_OK;
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
}

static HRESULT WINAPI lobbyclient_ConnectApplication(IDirectPlay8LobbyClient *iface, DPL_CONNECT_INFO *connectioninfo,
                                                     void *connectioncontext, DPNHANDLE *application, DWORD timeout,
                                                     DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%p %p %p %u 0x%08x)\n", This, connectioninfo, connectioncontext, application, timeout, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI lobbyclient_Send(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, BYTE *buffer, DWORD buffersize, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%u %p %u 0x%08x)\n", This, connection, buffer, buffersize, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI lobbyclient_ReleaseApplication(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%u 0x%08x)\n", This, connection, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI lobbyclient_Close(IDirectPlay8LobbyClient *iface, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(0x%08x)\n", This, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI lobbyclient_GetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DPL_CONNECTION_SETTINGS *sessioninfo, DWORD *infosize, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%u %p %p 0x%08x)\n", This, connection, sessioninfo, infosize, flags);

    return E_NOTIMPL;
}

static HRESULT WINAPI lobbyclient_SetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, const DPL_CONNECTION_SETTINGS *sessioninfo, DWORD flags)
{
    IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);

    FIXME("(%p)->(%u %p 0x%08x)\n", This, connection, sessioninfo, flags);

    return E_NOTIMPL;
}

static const IDirectPlay8LobbyClientVtbl DirectPlay8LobbiedClient_Vtbl =
{
    lobbyclient_QueryInterface,
    lobbyclient_AddRef,
    lobbyclient_Release,
    lobbyclient_Initialize,
    lobbyclient_EnumLocalPrograms,
    lobbyclient_ConnectApplication,
    lobbyclient_Send,
    lobbyclient_ReleaseApplication,
    lobbyclient_Close,
    lobbyclient_GetConnectionSettings,
    lobbyclient_SetConnectionSettings
};

HRESULT DPNET_CreateDirectPlay8LobbyClient(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
{
    IDirectPlay8LobbyClientImpl *client;
    HRESULT ret;

    TRACE("%p (%p, %s, %p)\n", iface, outer, debugstr_guid(riid), obj);

    client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*client));
    if (!client)
    {
        *obj = NULL;
        return E_OUTOFMEMORY;
    }

    client->IDirectPlay8LobbyClient_iface.lpVtbl = &DirectPlay8LobbiedClient_Vtbl;
    client->ref = 1;

    ret = lobbyclient_QueryInterface(&client->IDirectPlay8LobbyClient_iface, riid, obj);
    lobbyclient_Release(&client->IDirectPlay8LobbyClient_iface);

    return ret;
}