dplaysp.h 13.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright 2000 Peter Hunnisett
 *
 * 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
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 18
 */

19 20 21
#ifndef __WINE_DIRECT_PLAY_SP_H
#define __WINE_DIRECT_PLAY_SP_H

22 23 24 25
#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
26
#include "winuser.h"
27 28 29 30 31
#include "dplay.h"
#include "dplobby.h"

/* GUID for IDirectPlaySP  {0C9F6360-CC61-11cf-ACEC-00AA006886E3} */
DEFINE_GUID(IID_IDirectPlaySP, 0xc9f6360, 0xcc61, 0x11cf, 0xac, 0xec, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
32
typedef struct IDirectPlaySP *LPDIRECTPLAYSP;
33 34


35
typedef BOOL (CALLBACK *LPENUMMRUCALLBACK)( LPCVOID lpData,
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
                                            DWORD  dwDataSize,
                                            LPVOID lpContext );

/* For SP. Top 16 bits is dplay, bottom 16 is SP */
#define DPSP_MAJORVERSION 0x00060000
#define DPSP_DX5VERSION   0x00050000
#define DPSP_DX3VERSION   0x00040000

#define DPSP_MAJORVERSIONMASK 0xFFFF0000
#define DPSP_MINORVERSIONMASK 0x0000FFFF


/* Some flags */
#define DPLAYI_PLAYER_SYSPLAYER      0x00000001
#define DPLAYI_PLAYER_NAMESRVR       0x00000002
#define DPLAYI_PLAYER_PLAYERINGROUP  0x00000004
#define DPLAYI_PLAYER_PLAYERLOCAL    0x00000008
#define DPLAYI_GROUP_SYSGROUP        0x00000020
#define DPLAYI_GROUP_DPLAYOWNS       0x00000040
#define DPLAYI_PLAYER_APPSERVER      0x00000080
#define DPLAYI_GROUP_HIDDEN          0x00000400

/* Define the COM interface */
59
#define INTERFACE IDirectPlaySP
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
DECLARE_INTERFACE_(IDirectPlaySP,IUnknown)
{
    /*** IUnknown methods ***/
    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
    STDMETHOD_(ULONG,Release)(THIS) PURE;
    /*** IDirectPlaySP methods ***/
    STDMETHOD(AddMRUEntry)(THIS_ LPCWSTR lpSection, LPCWSTR lpKey, LPCVOID lpData, DWORD dwDataSize, DWORD dwMaxEntries ) PURE;
    STDMETHOD(CreateAddress)(THIS_ REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize, LPVOID lpAddress,LPDWORD lpdwAddressSize) PURE;
    STDMETHOD(EnumAddress)(THIS_ LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress, DWORD dwAddressSize, LPVOID lpContext ) PURE;
    STDMETHOD(EnumMRUEntries)(THIS_ LPCWSTR lpSection, LPCWSTR lpKey, LPENUMMRUCALLBACK lpEnumMRUCallback, LPVOID lpContext ) PURE;
    STDMETHOD(GetPlayerFlags)(THIS_ DPID idPlayer, LPDWORD lpdwPlayerFlags ) PURE;
    STDMETHOD(GetSPPlayerData)(THIS_ DPID idPlayer, LPVOID *lplpData, LPDWORD lpdwDataSize, DWORD dwFlags ) PURE;
    STDMETHOD(HandleMessage)(THIS_ LPVOID lpMessageBody, DWORD dwMessageBodySize, LPVOID lpMessageHeader ) PURE;
    STDMETHOD(SetSPPlayerData)(THIS_ DPID idPlayer, LPVOID lpData, DWORD dwDataSize, DWORD dwFlags ) PURE;
    STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount, LPVOID lpAddress, LPDWORD lpdwAddressSize ) PURE;
    STDMETHOD(GetSPData)(THIS_ LPVOID *lplpData, LPDWORD dwDataSize, DWORD dwFlags ) PURE;
    STDMETHOD(SetSPData)(THIS_ LPVOID lpData, DWORD dwDataSize, DWORD dwFlags ) PURE;
    STDMETHOD_(VOID,SendComplete)(THIS_ LPVOID , DWORD  ) PURE;
};
80
#undef INTERFACE
81

82

83
/* NOTE: The microsoft provided header file doesn't have these access
84 85
 * functions
 */
86
#if !defined (__cplusplus) || defined(CINTERFACE)
87
/*** IUnknown methods ***/
88 89 90
#define IDirectPlaySP_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectPlaySP_AddRef(p)                    (p)->lpVtbl->AddRef(p)
#define IDirectPlaySP_Release(p)                   (p)->lpVtbl->Release(p)
91
/*** IDirectPlaySP methods ***/
92 93 94 95 96 97 98 99 100 101 102 103 104
#define IDirectPlaySP_AddMRUEntry(p,a,b,c,d,e)     (p)->lpVtbl->AddMRUEntry(p,a,b,c,d,e)
#define IDirectPlaySP_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f)
#define IDirectPlaySP_EnumAddress(p,a,b,c,d)       (p)->lpVtbl->EnumAddress(p,a,b,c,d)
#define IDirectPlaySP_EnumMRUEntries(p,a,b,c,d)    (p)->lpVtbl->EnumMRUEntries(p,a,b,c,d)
#define IDirectPlaySP_GetPlayerFlags(p,a,b)        (p)->lpVtbl->GetPlayerFlags(p,a,b)
#define IDirectPlaySP_GetSPPlayerData(p,a,b,c,d)   (p)->lpVtbl->GetSPPlayerData(p,a,b,c,d)
#define IDirectPlaySP_HandleMessage(p,a,b,c)       (p)->lpVtbl->HandleMessage(p,a,b,c)
#define IDirectPlaySP_SetSPPlayerData(p,a,b,c,d)   (p)->lpVtbl->SetSPPlayerData(p,a,b,c,d)
#define IDirectPlaySP_CreateCompoundAddress(p,a,b,c,d)  (p)->lpVtbl->CreateCompoundAddress(p,a,b,c,d)
#define IDirectPlaySP_GetSPData(p,a,b,c)           (p)->lpVtbl->GetSPData(p,a,b,c)
#define IDirectPlaySP_SetSPData(p,a,b,c)           (p)->lpVtbl->SetSPData(p,a,b,c)
#define IDirectPlaySP_SendComplete(p,a,b)          (p)->lpVtbl->SendComplete(p,a,b)
#endif
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199

/* SP Callback stuff */

typedef struct tagDPSP_ADDPLAYERTOGROUPDATA
{
  DPID           idPlayer;
  DPID           idGroup;
  IDirectPlaySP* lpISP;
} DPSP_ADDPLAYERTOGROUPDATA, *LPDPSP_ADDPLAYERTOGROUPDATA;

typedef struct tagDPSP_CLOSEDATA
{
  IDirectPlaySP* lpISP;
} DPSP_CLOSEDATA, *LPDPSP_CLOSEDATA;

typedef struct tagDPSP_CREATEGROUPDATA
{
  DPID           idGroup;
  DWORD          dwFlags;
  LPVOID         lpSPMessageHeader;
  IDirectPlaySP* lpISP;
} DPSP_CREATEGROUPDATA, *LPDPSP_CREATEGROUPDATA;

typedef struct tagDPSP_CREATEPLAYERDATA
{
  DPID           idPlayer;
  DWORD          dwFlags;
  LPVOID         lpSPMessageHeader;
  IDirectPlaySP* lpISP;
} DPSP_CREATEPLAYERDATA, *LPDPSP_CREATEPLAYERDATA;

typedef struct tagDPSP_DELETEGROUPDATA
{
  DPID           idGroup;
  DWORD          dwFlags;
  IDirectPlaySP* lpISP;
} DPSP_DELETEGROUPDATA, *LPDPSP_DELETEGROUPDATA;

typedef struct tagDPSP_DELETEPLAYERDATA
{
  DPID           idPlayer;
  DWORD          dwFlags;
  IDirectPlaySP* lpISP;
} DPSP_DELETEPLAYERDATA, *LPDPSP_DELETEPLAYERDATA;

typedef struct tagDPSP_ENUMSESSIONSDATA
{
  LPVOID         lpMessage;
  DWORD          dwMessageSize;
  IDirectPlaySP* lpISP;
  BOOL           bReturnStatus;
} DPSP_ENUMSESSIONSDATA, *LPDPSP_ENUMSESSIONSDATA;

typedef struct _DPSP_GETADDRESSDATA
{
  DPID           idPlayer;
  DWORD          dwFlags;
  LPDPADDRESS    lpAddress;
  LPDWORD        lpdwAddressSize;
  IDirectPlaySP* lpISP;
} DPSP_GETADDRESSDATA, *LPDPSP_GETADDRESSDATA;

typedef struct tagDPSP_GETADDRESSCHOICESDATA
{
  LPDPADDRESS    lpAddress;
  LPDWORD        lpdwAddressSize;
  IDirectPlaySP* lpISP;
} DPSP_GETADDRESSCHOICESDATA, *LPDPSP_GETADDRESSCHOICESDATA;

typedef struct tagDPSP_GETCAPSDATA
{
  DPID           idPlayer;
  LPDPCAPS       lpCaps;
  DWORD          dwFlags;
  IDirectPlaySP* lpISP;
} DPSP_GETCAPSDATA, *LPDPSP_GETCAPSDATA;

typedef struct tagDPSP_OPENDATA
{
  BOOL           bCreate;
  LPVOID         lpSPMessageHeader;
  IDirectPlaySP* lpISP;
  BOOL           bReturnStatus;
  DWORD          dwOpenFlags;
  DWORD          dwSessionFlags;
} DPSP_OPENDATA, *LPDPSP_OPENDATA;

typedef struct tagDPSP_REMOVEPLAYERFROMGROUPDATA
{
  DPID           idPlayer;
  DPID           idGroup;
  IDirectPlaySP* lpISP;
} DPSP_REMOVEPLAYERFROMGROUPDATA, *LPDPSP_REMOVEPLAYERFROMGROUPDATA;

typedef struct tagDPSP_REPLYDATA
200
{
201 202 203 204 205 206 207 208 209 210 211 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 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
  LPVOID         lpSPMessageHeader;
  LPVOID         lpMessage;
  DWORD          dwMessageSize;
  DPID           idNameServer;
  IDirectPlaySP* lpISP;
} DPSP_REPLYDATA, *LPDPSP_REPLYDATA;

typedef struct tagDPSP_SENDDATA
{
  DWORD          dwFlags;
  DPID           idPlayerTo;
  DPID           idPlayerFrom;
  LPVOID         lpMessage;
  DWORD          dwMessageSize;
  BOOL           bSystemMessage;
  IDirectPlaySP* lpISP;
} DPSP_SENDDATA, *LPDPSP_SENDDATA;

typedef struct tagDPSP_SENDTOGROUPDATA
{
  DWORD          dwFlags;
  DPID           idGroupTo;
  DPID           idPlayerFrom;
  LPVOID         lpMessage;
  DWORD          dwMessageSize;
  IDirectPlaySP* lpISP;
} DPSP_SENDTOGROUPDATA, *LPDPSP_SENDTOGROUPDATA;

typedef struct tagDPSP_SENDEXDATA
{
  IDirectPlaySP* lpISP;
  DWORD          dwFlags;
  DPID           idPlayerTo;
  DPID           idPlayerFrom;
  LPSGBUFFER     lpSendBuffers;
  DWORD          cBuffers;
  DWORD          dwMessageSize;
  DWORD          dwPriority;
  DWORD          dwTimeout;
  LPVOID         lpDPContext;
  LPDWORD        lpdwSPMsgID;
  BOOL           bSystemMessage;
} DPSP_SENDEXDATA, *LPDPSP_SENDEXDATA;

typedef struct tagDPSP_SENDTOGROUPEXDATA
{
  IDirectPlaySP* lpISP;
  DWORD          dwFlags;
  DPID           idGroupTo;
  DPID           idPlayerFrom;
  LPSGBUFFER     lpSendBuffers;
  DWORD          cBuffers;
  DWORD          dwMessageSize;
  DWORD          dwPriority;
  DWORD          dwTimeout;
  LPVOID         lpDPContext;
  LPDWORD        lpdwSPMsgID;
} DPSP_SENDTOGROUPEXDATA, *LPDPSP_SENDTOGROUPEXDATA;

typedef struct tagDPSP_GETMESSAGEQUEUEDATA
{
  IDirectPlaySP* lpISP;
  DWORD          dwFlags;
  DPID           idFrom;
  DPID           idTo;
  LPDWORD        lpdwNumMsgs;
  LPDWORD        lpdwNumBytes;
} DPSP_GETMESSAGEQUEUEDATA, *LPDPSP_GETMESSAGEQUEUEDATA;

#define DPCANCELSEND_PRIORITY 0x00000001
#define DPCANCELSEND_ALL      0x00000002

typedef struct tagDPSP_CANCELDATA
{
  IDirectPlaySP* lpISP;
  DWORD          dwFlags;
  LPRGLPVOID     lprglpvSPMsgID;
  DWORD          cSPMsgID;
  DWORD          dwMinPriority;
  DWORD          dwMaxPriority;
} DPSP_CANCELDATA, *LPDPSP_CANCELDATA;

typedef struct tagDPSP_SHUTDOWNDATA
{
  IDirectPlaySP* lpISP;
} DPSP_SHUTDOWNDATA, *LPDPSP_SHUTDOWNDATA;


/* Prototypes returned by SPInit */
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
typedef HRESULT (WINAPI *LPDPSP_CREATEPLAYER)(LPDPSP_CREATEPLAYERDATA);
typedef HRESULT (WINAPI *LPDPSP_DELETEPLAYER)(LPDPSP_DELETEPLAYERDATA);
typedef HRESULT (WINAPI *LPDPSP_SEND)(LPDPSP_SENDDATA);
typedef HRESULT (WINAPI *LPDPSP_ENUMSESSIONS)(LPDPSP_ENUMSESSIONSDATA);
typedef HRESULT (WINAPI *LPDPSP_REPLY)(LPDPSP_REPLYDATA);
typedef HRESULT (WINAPI *LPDPSP_SHUTDOWN)(void);
typedef HRESULT (WINAPI *LPDPSP_CREATEGROUP)(LPDPSP_CREATEGROUPDATA);
typedef HRESULT (WINAPI *LPDPSP_DELETEGROUP)(LPDPSP_DELETEGROUPDATA);
typedef HRESULT (WINAPI *LPDPSP_ADDPLAYERTOGROUP)(LPDPSP_ADDPLAYERTOGROUPDATA);
typedef HRESULT (WINAPI *LPDPSP_REMOVEPLAYERFROMGROUP)(LPDPSP_REMOVEPLAYERFROMGROUPDATA);
typedef HRESULT (WINAPI *LPDPSP_GETCAPS)(LPDPSP_GETCAPSDATA);
typedef HRESULT (WINAPI *LPDPSP_GETADDRESS)(LPDPSP_GETADDRESSDATA);
typedef HRESULT (WINAPI *LPDPSP_GETADDRESSCHOICES)(LPDPSP_GETADDRESSCHOICESDATA);
typedef HRESULT (WINAPI *LPDPSP_OPEN)(LPDPSP_OPENDATA);
typedef HRESULT (WINAPI *LPDPSP_CLOSE)(void);
typedef HRESULT (WINAPI *LPDPSP_SENDTOGROUP)(LPDPSP_SENDTOGROUPDATA);
typedef HRESULT (WINAPI *LPDPSP_SHUTDOWNEX)(LPDPSP_SHUTDOWNDATA);
typedef HRESULT (WINAPI *LPDPSP_CLOSEEX)(LPDPSP_CLOSEDATA);
typedef HRESULT (WINAPI *LPDPSP_SENDEX)(LPDPSP_SENDEXDATA);
typedef HRESULT (WINAPI *LPDPSP_SENDTOGROUPEX)(LPDPSP_SENDTOGROUPEXDATA);
typedef HRESULT (WINAPI *LPDPSP_CANCEL)(LPDPSP_CANCELDATA);
typedef HRESULT (WINAPI *LPDPSP_GETMESSAGEQUEUE)(LPDPSP_GETMESSAGEQUEUEDATA);
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341


typedef struct tagDPSP_SPCALLBACKS
{
    DWORD                        dwSize;
    DWORD                        dwVersion;

    LPDPSP_ENUMSESSIONS          EnumSessions;          /* Must be provided */
    LPDPSP_REPLY                 Reply;                 /* Must be provided */
    LPDPSP_SEND                  Send;                  /* Must be provided */
    LPDPSP_ADDPLAYERTOGROUP      AddPlayerToGroup;      /* Optional */
    LPDPSP_CLOSE                 Close;                 /* Optional */
    LPDPSP_CREATEGROUP           CreateGroup;           /* Optional */
    LPDPSP_CREATEPLAYER          CreatePlayer;          /* Optional */
    LPDPSP_DELETEGROUP           DeleteGroup;           /* Optional */
    LPDPSP_DELETEPLAYER          DeletePlayer;          /* Optional */
    LPDPSP_GETADDRESS            GetAddress;            /* Optional */
    LPDPSP_GETCAPS               GetCaps;               /* Optional */
    LPDPSP_OPEN                  Open;                  /* Optional */
    LPDPSP_REMOVEPLAYERFROMGROUP RemovePlayerFromGroup; /* Optional */
    LPDPSP_SENDTOGROUP           SendToGroup;           /* Optional */
    LPDPSP_SHUTDOWN              Shutdown;              /* Optional */

    LPDPSP_CLOSEEX               CloseEx;               /* Optional */
    LPDPSP_SHUTDOWNEX            ShutdownEx;            /* Optional */
    LPDPSP_GETADDRESSCHOICES     GetAddressChoices;     /* Optional */

    LPDPSP_SENDEX                SendEx;                /* Optional */
    LPDPSP_SENDTOGROUPEX         SendToGroupEx;         /* Optional */
    LPDPSP_CANCEL                Cancel;                /* Optional */
342
    LPDPSP_GETMESSAGEQUEUE       GetMessageQueue;       /* Optional */
343 344 345 346
} DPSP_SPCALLBACKS, *LPDPSP_SPCALLBACKS;

typedef struct tagSPINITDATA
{
347
    LPDPSP_SPCALLBACKS  lpCB;
348 349 350
    IDirectPlaySP*      lpISP;
    LPWSTR              lpszName;
    LPGUID              lpGuid;
351
    DWORD               dwReserved1;
352
    DWORD               dwReserved2;
353
    DWORD               dwSPHeaderSize;
354
    LPDPADDRESS         lpAddress;
355 356
    DWORD               dwAddressSize;
    DWORD               dwSPVersion;
357 358
} SPINITDATA, *LPSPINITDATA;

359
typedef HRESULT (WINAPI *LPDPSP_SPINIT)(LPSPINITDATA);
360

361 362
/* This variable is exported from the DLL at ordinal 6 to be accessed by the
 * SP directly
363
 */
364
extern DWORD gdwDPlaySPRefCount;
365 366

#endif