SysAllocStringLen16 needs to handle NULL pointers, too.
[wine] / include / dplay.h
1 #ifndef __WINE_DPLAY_H
2 #define __WINE_DPLAY_H
3
4 /* FIXME: GCC doesn't yet support annon structures so some of the structures defined here don't match the sdk exactly.
5  * I've tried to come up with suitably terse names, but this file won't cut it for inclusion into a WineLib app.
6  */
7
8 #include "wine/obj_base.h"
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif /* defined(__cplusplus) */
13
14 #include "pshpack1.h"
15
16 /*****************************************************************************
17  * Predeclare the interfaces
18  */
19 DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20, 0x8923, 0x11d0, 0x9d, 0x97, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
20
21 DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72);
22 typedef struct IDirectPlay IDirectPlay,*LPDIRECTPLAY;
23
24 DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
25 typedef struct IDirectPlay2 IDirectPlay2,*LPDIRECTPLAY2;
26
27 DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82);
28 typedef struct IDirectPlay2 IDirectPlay2A,*LPDIRECTPLAY2A;
29
30 DEFINE_GUID(IID_IDirectPlay3, 0x133efe40, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
31 typedef struct IDirectPlay3 IDirectPlay3,*LPDIRECTPLAY3;
32
33 DEFINE_GUID(IID_IDirectPlay3A,0x133efe41, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
34 typedef struct IDirectPlay3 IDirectPlay3A,*LPDIRECTPLAY3A;
35
36 DEFINE_GUID(IID_IDirectPlay4, 0xab1c530, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc);
37 typedef struct IDirectPlay4 IDirectPlay4,*LPDIRECTPLAY4;
38
39 DEFINE_GUID(IID_IDirectPlay4A,0xab1c531, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc);
40 typedef struct IDirectPlay4 IDirectPlay4A,*LPDIRECTPLAY4A;
41
42
43 /*
44  * GUIDS used by Service Providers shipped with DirectPlay
45  * Use these to identify Service Provider returned by EnumConnections
46  */
47
48 /* GUID for IPX service provider {685BC400-9D2C-11cf-A9CD-00AA006886E3} */
49 DEFINE_GUID(DPSPGUID_IPX, 0x685bc400, 0x9d2c, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
50
51 /* GUID for TCP/IP service provider {36E95EE0-8577-11cf-960C-0080C7534E82} */
52 DEFINE_GUID(DPSPGUID_TCPIP, 0x36E95EE0, 0x8577, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82);
53
54 /* GUID for Serial service provider {0F1D6860-88D9-11cf-9C4E-00A0C905425E} */
55 DEFINE_GUID(DPSPGUID_SERIAL, 0xf1d6860, 0x88d9, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
56
57 /* GUID for Modem service provider {44EAA760-CB68-11cf-9C4E-00A0C905425E} */
58 DEFINE_GUID(DPSPGUID_MODEM, 0x44eaa760, 0xcb68, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
59
60
61 /*****************************************************************************
62  * Miscellaneous
63  */
64
65 /* Return Values for Direct Play */
66 #define _FACDP  0x877
67 #define MAKE_DPHRESULT( code )    MAKE_HRESULT( 1, _FACDP, code )
68
69 #define DP_OK                           S_OK
70 #define DPERR_ALREADYINITIALIZED        MAKE_DPHRESULT(   5 )
71 #define DPERR_ACCESSDENIED              MAKE_DPHRESULT(  10 )
72 #define DPERR_ACTIVEPLAYERS             MAKE_DPHRESULT(  20 )
73 #define DPERR_BUFFERTOOSMALL            MAKE_DPHRESULT(  30 )
74 #define DPERR_CANTADDPLAYER             MAKE_DPHRESULT(  40 )
75 #define DPERR_CANTCREATEGROUP           MAKE_DPHRESULT(  50 )
76 #define DPERR_CANTCREATEPLAYER          MAKE_DPHRESULT(  60 )
77 #define DPERR_CANTCREATESESSION         MAKE_DPHRESULT(  70 )
78 #define DPERR_CAPSNOTAVAILABLEYET       MAKE_DPHRESULT(  80 )
79 #define DPERR_EXCEPTION                 MAKE_DPHRESULT(  90 )
80 #define DPERR_GENERIC                   E_FAIL
81 #define DPERR_INVALIDFLAGS              MAKE_DPHRESULT( 120 )
82 #define DPERR_INVALIDOBJECT             MAKE_DPHRESULT( 130 )
83 #define DPERR_INVALIDPARAM              E_INVALIDARG
84 #define DPERR_INVALIDPARAMS             DPERR_INVALIDPARAM
85 #define DPERR_INVALIDPLAYER             MAKE_DPHRESULT( 150 )
86 #define DPERR_INVALIDGROUP              MAKE_DPHRESULT( 155 )
87 #define DPERR_NOCAPS                    MAKE_DPHRESULT( 160 )
88 #define DPERR_NOCONNECTION              MAKE_DPHRESULT( 170 )
89 #define DPERR_NOMEMORY                  E_OUTOFMEMORY
90 #define DPERR_OUTOFMEMORY               DPERR_NOMEMORY
91 #define DPERR_NOMESSAGES                MAKE_DPHRESULT( 190 )
92 #define DPERR_NONAMESERVERFOUND         MAKE_DPHRESULT( 200 )
93 #define DPERR_NOPLAYERS                 MAKE_DPHRESULT( 210 )
94 #define DPERR_NOSESSIONS                MAKE_DPHRESULT( 220 )
95 #define DPERR_PENDING                   E_PENDING
96 #define DPERR_SENDTOOBIG                MAKE_DPHRESULT( 230 )
97 #define DPERR_TIMEOUT                   MAKE_DPHRESULT( 240 )
98 #define DPERR_UNAVAILABLE               MAKE_DPHRESULT( 250 )
99 #define DPERR_UNSUPPORTED               E_NOTIMPL
100 #define DPERR_BUSY                      MAKE_DPHRESULT( 270 )
101 #define DPERR_USERCANCEL                MAKE_DPHRESULT( 280 )
102 #define DPERR_NOINTERFACE               E_NOINTERFACE
103 #define DPERR_CANNOTCREATESERVER        MAKE_DPHRESULT( 290 )
104 #define DPERR_PLAYERLOST                MAKE_DPHRESULT( 300 )
105 #define DPERR_SESSIONLOST               MAKE_DPHRESULT( 310 )
106 #define DPERR_UNINITIALIZED             MAKE_DPHRESULT( 320 )
107 #define DPERR_NONEWPLAYERS              MAKE_DPHRESULT( 330 )
108 #define DPERR_INVALIDPASSWORD           MAKE_DPHRESULT( 340 )
109 #define DPERR_CONNECTING                MAKE_DPHRESULT( 350 )
110 #define DPERR_CONNECTIONLOST            MAKE_DPHRESULT( 360 )
111 #define DPERR_UNKNOWNMESSAGE            MAKE_DPHRESULT( 370 )
112 #define DPERR_CANCELFAILED              MAKE_DPHRESULT( 380 )
113 #define DPERR_INVALIDPRIORITY           MAKE_DPHRESULT( 390 )
114 #define DPERR_NOTHANDLED                MAKE_DPHRESULT( 400 )
115 #define DPERR_CANCELLED                 MAKE_DPHRESULT( 410 )
116 #define DPERR_ABORTED                   MAKE_DPHRESULT( 420 )
117 #define DPERR_BUFFERTOOLARGE            MAKE_DPHRESULT( 1000 )
118 #define DPERR_CANTCREATEPROCESS         MAKE_DPHRESULT( 1010 )
119 #define DPERR_APPNOTSTARTED             MAKE_DPHRESULT( 1020 )
120 #define DPERR_INVALIDINTERFACE          MAKE_DPHRESULT( 1030 )
121 #define DPERR_NOSERVICEPROVIDER         MAKE_DPHRESULT( 1040 )
122 #define DPERR_UNKNOWNAPPLICATION        MAKE_DPHRESULT( 1050 )
123 #define DPERR_NOTLOBBIED                MAKE_DPHRESULT( 1070 )
124 #define DPERR_SERVICEPROVIDERLOADED     MAKE_DPHRESULT( 1080 )
125 #define DPERR_ALREADYREGISTERED         MAKE_DPHRESULT( 1090 )
126 #define DPERR_NOTREGISTERED             MAKE_DPHRESULT( 1100 )
127 #define DPERR_AUTHENTICATIONFAILED      MAKE_DPHRESULT( 2000 )
128 #define DPERR_CANTLOADSSPI              MAKE_DPHRESULT( 2010 )
129 #define DPERR_ENCRYPTIONFAILED          MAKE_DPHRESULT( 2020 )
130 #define DPERR_SIGNFAILED                MAKE_DPHRESULT( 2030 )
131 #define DPERR_CANTLOADSECURITYPACKAGE   MAKE_DPHRESULT( 2040 )
132 #define DPERR_ENCRYPTIONNOTSUPPORTED    MAKE_DPHRESULT( 2050 )
133 #define DPERR_CANTLOADCAPI              MAKE_DPHRESULT( 2060 )
134 #define DPERR_NOTLOGGEDIN               MAKE_DPHRESULT( 2070 )
135 #define DPERR_LOGONDENIED               MAKE_DPHRESULT( 2080 )
136
137
138 /* DPID - DirectPlay player and group ID */
139 typedef DWORD DPID, *LPDPID;
140
141 /* DPID from whence originate messages - just an ID */
142 #define DPID_SYSMSG             0           /* DPID of system */
143 #define DPID_ALLPLAYERS         0           /* DPID of all players */
144 #define DPID_SERVERPLAYER       1           /* DPID of the server player */
145 #define DPID_UNKNOWN            0xFFFFFFFF  /* Player ID is unknown */
146
147 /*  DPCAPS -  Used to obtain the capabilities of a DirectPlay object */
148 typedef struct tagDPCAPS
149 {
150     DWORD dwSize;               /* Size of structure in bytes */
151     DWORD dwFlags;              
152     DWORD dwMaxBufferSize;      
153     DWORD dwMaxQueueSize;       /* Obsolete. */
154     DWORD dwMaxPlayers;         /* Maximum players/groups (local + remote) */
155     DWORD dwHundredBaud;        /* Bandwidth in 100 bits per second units;
156                                  * i.e. 24 is 2400, 96 is 9600, etc. 
157                                  */
158     DWORD dwLatency;            /* Estimated latency; 0 = unknown */
159     DWORD dwMaxLocalPlayers;    /* Maximum # of locally created players */
160     DWORD dwHeaderLength;       /* Maximum header length in bytes */
161     DWORD dwTimeout;            /* Service provider's suggested timeout value
162                                  * This is how long DirectPlay will wait for
163                                  * responses to system messages
164                                  */
165 } DPCAPS, *LPDPCAPS;
166
167 typedef struct tagDPNAME
168 {
169     DWORD   dwSize;             
170     DWORD   dwFlags;            /* Not used must be 0 */
171
172     union /*playerShortName */      /* Player's Handle? */
173     {                           
174         LPWSTR  lpszShortName;  
175         LPSTR   lpszShortNameA; 
176     }psn;
177
178     union /*playerLongName */       /* Player's formal/real name */
179     {                         
180         LPWSTR  lpszLongName;  
181         LPSTR   lpszLongNameA;  
182     }pln;
183
184 } DPNAME, *LPDPNAME;
185
186 #define DPLONGNAMELEN     52
187 #define DPSHORTNAMELEN    20
188 #define DPSESSIONNAMELEN  32
189 #define DPPASSWORDLEN     16
190 #define DPUSERRESERVED    16
191
192 typedef struct tagDPSESSIONDESC
193 {
194     DWORD   dwSize;
195     GUID    guidSession;
196     DWORD   dwSession;
197     DWORD   dwMaxPlayers;
198     DWORD   dwCurrentPlayers;
199     DWORD   dwFlags;
200     char    szSessionName[ DPSESSIONNAMELEN ];
201     char    szUserField[ DPUSERRESERVED ];
202     DWORD   dwReserved1;
203     char    szPassword[ DPPASSWORDLEN ];
204     DWORD   dwReserved2;
205     DWORD   dwUser1;
206     DWORD   dwUser2;
207     DWORD   dwUser3;
208     DWORD   dwUser4;
209 } DPSESSIONDESC, *LPDPSESSIONDESC;
210
211 typedef struct tagDPSESSIONDESC2
212 {
213     DWORD   dwSize;             
214     DWORD   dwFlags;           
215     GUID    guidInstance;      
216     GUID    guidApplication;   /* GUID of the DP application, GUID_NULL if
217                                 * all applications! */
218                                
219     DWORD   dwMaxPlayers;      
220     DWORD   dwCurrentPlayers;   /* (read only value) */
221
222     union  /* Session name */
223     {                             
224         LPWSTR  lpszSessionName;  
225         LPSTR   lpszSessionNameA; 
226     }sess;
227
228     union  /* Optional password */
229     {                           
230         LPWSTR  lpszPassword;   
231         LPSTR   lpszPasswordA;  
232     }pass;
233
234     DWORD   dwReserved1;       
235     DWORD   dwReserved2;
236
237     DWORD   dwUser1;        /* For use by the application */  
238     DWORD   dwUser2;
239     DWORD   dwUser3;
240     DWORD   dwUser4;
241 } DPSESSIONDESC2, *LPDPSESSIONDESC2;
242 typedef const DPSESSIONDESC2* LPCDPSESSIONDESC2;
243
244 #define DPOPEN_JOIN                     0x00000001
245 #define DPOPEN_CREATE                   0x00000002
246 #define DPOPEN_RETURNSTATUS             DPENUMSESSIONS_RETURNSTATUS
247
248 #define DPSESSION_NEWPLAYERSDISABLED    0x00000001
249 #define DPSESSION_MIGRATEHOST           0x00000004
250 #define DPSESSION_NOMESSAGEID           0x00000008
251 #define DPSESSION_JOINDISABLED          0x00000020
252 #define DPSESSION_KEEPALIVE             0x00000040
253 #define DPSESSION_NODATAMESSAGES        0x00000080
254 #define DPSESSION_SECURESERVER          0x00000100
255 #define DPSESSION_PRIVATE               0x00000200
256 #define DPSESSION_PASSWORDREQUIRED      0x00000400
257 #define DPSESSION_MULTICASTSERVER       0x00000800
258 #define DPSESSION_CLIENTSERVER          0x00001000
259
260 typedef struct tagDPLCONNECTION
261 {
262     DWORD               dwSize;          
263     DWORD               dwFlags;          
264     LPDPSESSIONDESC2    lpSessionDesc;  /* Ptr to session desc to use for connect */  
265     LPDPNAME            lpPlayerName;   /* Ptr to player name structure */
266     GUID                guidSP;         /* GUID of Service Provider to use */ 
267     LPVOID              lpAddress;      /* Ptr to Address of Service Provider to use */
268     DWORD               dwAddressSize;  /* Size of address data */
269 } DPLCONNECTION, *LPDPLCONNECTION;
270
271 /* DPLCONNECTION flags (for dwFlags) */
272 #define DPLCONNECTION_CREATESESSION DPOPEN_CREATE
273 #define DPLCONNECTION_JOINSESSION   DPOPEN_JOIN
274
275 typedef struct tagDPCHAT
276 {
277     DWORD               dwSize;
278     DWORD               dwFlags;
279     union
280     {                          /* Message string */
281         LPWSTR  lpszMessage;   /* Unicode */
282         LPSTR   lpszMessageA;  /* ANSI */
283     }msgstr;
284 } DPCHAT, *LPDPCHAT;
285
286 typedef struct tagDPSECURITYDESC
287 {
288     DWORD dwSize;                   /* Size of structure */
289     DWORD dwFlags;                  /* Not used. Must be zero. */
290     union
291     {                               /* SSPI provider name */
292         LPWSTR  lpszSSPIProvider;   /* Unicode */
293         LPSTR   lpszSSPIProviderA;  /* ANSI */
294     }sspi;
295     union
296     {                               /* CAPI provider name */
297         LPWSTR lpszCAPIProvider;    /* Unicode */
298         LPSTR  lpszCAPIProviderA;   /* ANSI */
299     }capi;
300     DWORD dwCAPIProviderType;       /* Crypto Service Provider type */
301     DWORD dwEncryptionAlgorithm;    /* Encryption Algorithm type */
302 } DPSECURITYDESC, *LPDPSECURITYDESC;
303
304 typedef const DPSECURITYDESC *LPCDPSECURITYDESC;
305
306 typedef struct tagDPCREDENTIALS
307 {
308     DWORD dwSize;               /* Size of structure */
309     DWORD dwFlags;              /* Not used. Must be zero. */
310     union
311     {                           /* User name of the account */
312         LPWSTR  lpszUsername;   /* Unicode */
313         LPSTR   lpszUsernameA;  /* ANSI */
314     }name;
315     union
316     {                           /* Password of the account */
317         LPWSTR  lpszPassword;   /* Unicode */
318         LPSTR   lpszPasswordA;  /* ANSI */
319     }pass;
320     union
321     {                           /* Domain name of the account */
322         LPWSTR  lpszDomain;     /* Unicode */
323         LPSTR   lpszDomainA;    /* ANSI */
324     }domain;
325 } DPCREDENTIALS, *LPDPCREDENTIALS;
326
327 typedef const DPCREDENTIALS *LPCDPCREDENTIALS;
328
329
330
331 typedef BOOL (CALLBACK* LPDPENUMDPCALLBACKW)(
332     LPGUID      lpguidSP,
333     LPWSTR      lpSPName,
334     DWORD       dwMajorVersion,
335     DWORD       dwMinorVersion,
336     LPVOID      lpContext);
337
338 typedef BOOL (CALLBACK* LPDPENUMDPCALLBACKA)(
339     LPGUID      lpguidSP,
340     LPSTR       lpSPName,       /* ptr to str w/ driver description */
341     DWORD       dwMajorVersion, /* Major # of driver spec in lpguidSP */
342     DWORD       dwMinorVersion, /* Minor # of driver spec in lpguidSP */ 
343     LPVOID      lpContext);     /* User given */
344
345 typedef const GUID   *LPCGUID;
346 typedef const DPNAME *LPCDPNAME;
347
348 typedef BOOL (CALLBACK* LPDPENUMCONNECTIONSCALLBACK)(
349     LPCGUID     lpguidSP,
350     LPVOID      lpConnection,
351     DWORD       dwConnectionSize,
352     LPCDPNAME   lpName,
353     DWORD       dwFlags,
354     LPVOID      lpContext);
355
356 typedef BOOL (CALLBACK* LPDPENUMSESSIONSCALLBACK)(
357     LPDPSESSIONDESC lpDPSessionDesc,
358     LPVOID      lpContext,
359     LPDWORD     lpdwTimeOut,
360     DWORD       dwFlags);
361
362
363 extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID );
364 extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACKW, LPVOID );
365 extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY2 *lplpDP, IUnknown *pUnk);
366
367 typedef BOOL (CALLBACK* LPDPENUMPLAYERSCALLBACK)(
368     DPID   dpId,
369     LPSTR  lpFriendlyName,
370     LPSTR  lpFormalName,
371     DWORD  dwFlags,
372     LPVOID          lpContext );
373
374 typedef BOOL (CALLBACK* LPDPENUMPLAYERSCALLBACK2)(
375     DPID            dpId,
376     DWORD           dwPlayerType,
377     LPCDPNAME       lpName,
378     DWORD           dwFlags,
379     LPVOID          lpContext );
380
381 typedef BOOL (CALLBACK* LPDPENUMSESSIONSCALLBACK2)(
382     LPCDPSESSIONDESC2   lpThisSD,
383     LPDWORD             lpdwTimeOut,
384     DWORD               dwFlags,
385     LPVOID              lpContext );
386
387 #include "poppack.h"
388
389 /*****************************************************************************
390  * IDirectPlay interface
391  */
392 #define ICOM_INTERFACE IDirectPlay
393 #define IDirectPlay_METHODS \
394     ICOM_METHOD2(HRESULT,AddPlayerToGroup,      DPID,idGroup, DPID,idPlayer) \
395     ICOM_METHOD (HRESULT,Close) \
396     ICOM_METHOD4(HRESULT,CreatePlayer,          LPDPID,lpidPlayer, LPSTR,lpPlayerName, LPSTR,, LPHANDLE,) \
397     ICOM_METHOD3(HRESULT,CreateGroup,           LPDPID,lpidGroup, LPSTR,lpGroupName, LPSTR,) \
398     ICOM_METHOD2(HRESULT,DeletePlayerFromGroup, DPID,idGroup, DPID,idPlayer) \
399     ICOM_METHOD1(HRESULT,DestroyPlayer,         DPID,idPlayer) \
400     ICOM_METHOD1(HRESULT,DestroyGroup,          DPID,idGroup) \
401     ICOM_METHOD1(HRESULT,EnableNewPlayers,      BOOL,) \
402     ICOM_METHOD4(HRESULT,EnumGroupPlayers,      DPID,idGroup, LPDPENUMPLAYERSCALLBACK,lpEnumPlayersCallback, LPVOID,lpContext, DWORD,dwFlags) \
403     ICOM_METHOD4(HRESULT,EnumGroups,            DWORD,, LPDPENUMPLAYERSCALLBACK,lpEnumPlayersCallback, LPVOID,lpContext, DWORD,dwFlags) \
404     ICOM_METHOD4(HRESULT,EnumPlayers,           DWORD,, LPDPENUMPLAYERSCALLBACK,lpEnumPlayersCallback, LPVOID,lpContext, DWORD,dwFlags) \
405     ICOM_METHOD5(HRESULT,EnumSessions,          LPDPSESSIONDESC,lpsd, DWORD,dwTimeout, LPDPENUMSESSIONSCALLBACK,lpEnumSessionsCallback, LPVOID,lpContext, DWORD,dwFlags) \
406     ICOM_METHOD1(HRESULT,GetCaps,               LPDPCAPS,lpDPCaps) \
407     ICOM_METHOD2(HRESULT,GetMessageCount,       DPID,idPlayer, LPDWORD,lpdwCount) \
408     ICOM_METHOD2(HRESULT,GetPlayerCaps,         DPID,idPlayer, LPDPCAPS,lpPlayerCaps) \
409     ICOM_METHOD5(HRESULT,GetPlayerName,         DPID,idPlayer, LPSTR,, LPDWORD,, LPSTR,, LPDWORD,) \
410     ICOM_METHOD1(HRESULT,Initialize,            LPGUID,lpGUID) \
411     ICOM_METHOD1(HRESULT,Open,                  LPDPSESSIONDESC,lpsd) \
412     ICOM_METHOD5(HRESULT,Receive,               LPDPID,lpidFrom, LPDPID,lpidTo, DWORD,dwFlags, LPVOID,lpData, LPDWORD,lpdwDataSize) \
413     ICOM_METHOD1(HRESULT,SaveSession,           LPSTR,) \
414     ICOM_METHOD5(HRESULT,Send,                  DPID,idFrom, DPID,idTo, DWORD,dwFlags, LPVOID,lpData, DWORD,dwDataSize) \
415     ICOM_METHOD3(HRESULT,SetPlayerName,         DPID,idPlayer, LPSTR,lpPlayerName, LPSTR,)
416 #define IDirectPlay_IMETHODS \
417     IUnknown_IMETHODS \
418     IDirectPlay_METHODS
419 ICOM_DEFINE(IDirectPlay,IUnknown)
420 #undef ICOM_INTERFACE
421
422     /*** IUnknown methods ***/
423 #define IDirectPlay_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
424 #define IDirectPlay_AddRef(p)             ICOM_CALL (AddRef,p)
425 #define IDirectPlay_Release(p)            ICOM_CALL (Release,p)
426 /*** IDirectPlay methods ***/
427 #define IDirectPlay_AddPlayerToGroup(p,a,b)      ICOM_CALL2(AddPlayerToGroup,p,a,b)
428 #define IDirectPlay_Close(p)                     ICOM_CALL (Close,p)
429 #define IDirectPlay_CreatePlayer(p,a,b,c,d)      ICOM_CALL4(CreatePlayer,p,a,b,c,d)
430 #define IDirectPlay_CreateGroup(p,a,b,c)         ICOM_CALL3(CreateGroup,p,a,b,c)
431 #define IDirectPlay_DeletePlayerFromGroup(p,a,b) ICOM_CALL2(DeletePlayerFromGroup,p,a,b)
432 #define IDirectPlay_DestroyPlayer(p,a)           ICOM_CALL1(DestroyPlayer,p,a)
433 #define IDirectPlay_DestroyGroup(p,a)            ICOM_CALL1(DestroyGroup,p,a)
434 #define IDirectPlay_EnableNewPlayers(p,a)        ICOM_CALL1(EnableNewPlayers,p,a)
435 #define IDirectPlay_EnumGroupPlayers(p,a,b,c,d)  ICOM_CALL4(EnumGroupPlayers,p,a,b,c,d)
436 #define IDirectPlay_EnumGroups(p,a,b,c,d)        ICOM_CALL4(EnumGroups,p,a,b,c,d)
437 #define IDirectPlay_EnumPlayers(p,a,b,c,d)       ICOM_CALL4(EnumPlayers,p,a,b,c,d)
438 #define IDirectPlay_EnumSessions(p,a,b,c,d,e)    ICOM_CALL5(EnumSessions,p,a,b,c,d,e)
439 #define IDirectPlay_GetCaps(p,a)                 ICOM_CALL1(GetCaps,p,a)
440 #define IDirectPlay_GetMessageCount(p,a,b)       ICOM_CALL2(GetMessageCount,p,a,b)
441 #define IDirectPlay_GetPlayerCaps(p,a,b)         ICOM_CALL2(GetPlayerCaps,p,a,b)
442 #define IDirectPlay_GetPlayerName(p,a,b,c,d,e)   ICOM_CALL5(GetPlayerName,p,a,b,c,d,e)
443 #define IDirectPlay_Initialize(p,a)              ICOM_CALL1(Initialize,p,a)
444 #define IDirectPlay_Open(p,a)                    ICOM_CALL1(Open,p,a)
445 #define IDirectPlay_Receive(p,a,b,c,d,e)         ICOM_CALL5(Receive,p,a,b,c,d,e)
446 #define IDirectPlay_SaveSession(p,a)             ICOM_CALL1(SaveSession,p,a)
447 #define IDirectPlay_Send(p,a,b,c,d,e)            ICOM_CALL5(Send,p,a,b,c,d,e)
448 #define IDirectPlay_SetPlayerName(p,a,b,c)       ICOM_CALL3(SetPlayerName,p,a,b,c)
449
450
451 /*****************************************************************************
452  * IDirectPlay2 interface
453  */
454 #define ICOM_INTERFACE IDirectPlay2
455 #define IDirectPlay2_METHODS \
456     ICOM_METHOD2(HRESULT,AddPlayerToGroup,      DPID,idGroup, DPID,idPlayer) \
457     ICOM_METHOD (HRESULT,Close) \
458     ICOM_METHOD5(HRESULT,CreateGroup,           LPDPID,lpidGroup, LPDPNAME,lpGroupName, LPVOID,lpData, DWORD,dwDataSize, DWORD,dwFlags) \
459     ICOM_METHOD6(HRESULT,CreatePlayer,          LPDPID,lpidPlayer, LPDPNAME,lpPlayerName, HANDLE,hEvent, LPVOID,lpData, DWORD,dwDataSize, DWORD,dwFlags) \
460     ICOM_METHOD2(HRESULT,DeletePlayerFromGroup, DPID,idGroup, DPID,idPlayer) \
461     ICOM_METHOD1(HRESULT,DestroyGroup,          DPID,idGroup) \
462     ICOM_METHOD1(HRESULT,DestroyPlayer,         DPID,idPlayer) \
463     ICOM_METHOD5(HRESULT,EnumGroupPlayers,      DPID,idGroup, LPGUID,lpguidInstance, LPDPENUMPLAYERSCALLBACK2,lpEnumPlayersCallback2, LPVOID,lpContext, DWORD,dwFlags) \
464     ICOM_METHOD4(HRESULT,EnumGroups,            LPGUID,lpguidInstance, LPDPENUMPLAYERSCALLBACK2,lpEnumPlayersCallback2, LPVOID,lpContext, DWORD,dwFlags) \
465     ICOM_METHOD4(HRESULT,EnumPlayers,           LPGUID,lpguidInstance, LPDPENUMPLAYERSCALLBACK2,lpEnumPlayersCallback2, LPVOID,lpContext, DWORD,dwFlags) \
466     ICOM_METHOD5(HRESULT,EnumSessions,          LPDPSESSIONDESC2,lpsd, DWORD,dwTimeout, LPDPENUMSESSIONSCALLBACK2,lpEnumSessionsCallback2, LPVOID,lpContext, DWORD,dwFlags) \
467     ICOM_METHOD2(HRESULT,GetCaps,               LPDPCAPS,lpDPCaps, DWORD,dwFlags) \
468     ICOM_METHOD4(HRESULT,GetGroupData,          DPID,idGroup, LPVOID,lpData, LPDWORD,lpdwDataSize, DWORD,dwFlags) \
469     ICOM_METHOD3(HRESULT,GetGroupName,          DPID,idGroup, LPVOID,lpData, LPDWORD,lpdwDataSize) \
470     ICOM_METHOD2(HRESULT,GetMessageCount,       DPID,idPlayer, LPDWORD,lpdwCount) \
471     ICOM_METHOD3(HRESULT,GetPlayerAddress,      DPID,idPlayer, LPVOID,lpData, LPDWORD,lpdwDataSize) \
472     ICOM_METHOD3(HRESULT,GetPlayerCaps,         DPID,idPlayer, LPDPCAPS,lpPlayerCaps, DWORD,dwFlags) \
473     ICOM_METHOD4(HRESULT,GetPlayerData,         DPID,idPlayer, LPVOID,lpData, LPDWORD,lpdwDataSize, DWORD,dwFlags) \
474     ICOM_METHOD3(HRESULT,GetPlayerName,         DPID,idPlayer, LPVOID,lpData, LPDWORD,lpdwDataSize) \
475     ICOM_METHOD2(HRESULT,GetSessionDesc,        LPVOID,lpData, LPDWORD,lpdwDataSize) \
476     ICOM_METHOD1(HRESULT,Initialize,            LPGUID,lpGUID) \
477     ICOM_METHOD2(HRESULT,Open,                  LPDPSESSIONDESC2,lpsd, DWORD,dwFlags) \
478     ICOM_METHOD5(HRESULT,Receive,               LPDPID,lpidFrom, LPDPID,lpidTo, DWORD,dwFlags, LPVOID,lpData, LPDWORD,lpdwDataSize) \
479     ICOM_METHOD5(HRESULT,Send,                  DPID,idFrom, DPID,idTo, DWORD,dwFlags, LPVOID,lpData, DWORD,dwDataSize) \
480     ICOM_METHOD4(HRESULT,SetGroupData,          DPID,idGroup, LPVOID,lpData, DWORD,dwDataSize, DWORD,dwFlags) \
481     ICOM_METHOD3(HRESULT,SetGroupName,          DPID,idGroup, LPDPNAME,lpGroupName, DWORD,dwFlags) \
482     ICOM_METHOD4(HRESULT,SetPlayerData,         DPID,idPlayer, LPVOID,lpData, DWORD,dwDataSize, DWORD,dwFlags) \
483     ICOM_METHOD3(HRESULT,SetPlayerName,         DPID,idPlayer, LPDPNAME,lpPlayerName, DWORD,dwFlags) \
484     ICOM_METHOD2(HRESULT,SetSessionDesc,        LPDPSESSIONDESC2,lpSessDesc, DWORD,dwFlags)
485 #define IDirectPlay2_IMETHODS \
486     IUnknown_IMETHODS \
487     IDirectPlay2_METHODS
488 ICOM_DEFINE(IDirectPlay2,IUnknown)
489 #undef ICOM_INTERFACE
490
491 /*** IUnknown methods ***/
492 #define IDirectPlay2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
493 #define IDirectPlay2_AddRef(p)             ICOM_CALL (AddRef,p)
494 #define IDirectPlay2_Release(p)            ICOM_CALL (Release,p)
495     /*** IDirectPlay2 methods ***/
496 #define IDirectPlay2_AddPlayerToGroup(p,a,b)       ICOM_CALL2(AddPlayerToGroup,p,a,b)
497 #define IDirectPlay2_Close(p)                      ICOM_CALL (Close,p)
498 #define IDirectPlay2_CreateGroup(p,a,b,c,d,e)      ICOM_CALL5(CreateGroup,p,a,b,c,d,e)
499 #define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f)   ICOM_CALL6(CreatePlayer,p,a,b,c,d,e,f)
500 #define IDirectPlay2_DeletePlayerFromGroup(p,a,b)  ICOM_CALL2(DeletePlayerFromGroup,p,a,b)
501 #define IDirectPlay2_DestroyGroup(p,a)             ICOM_CALL1(DestroyGroup,p,a)
502 #define IDirectPlay2_DestroyPlayer(p,a)            ICOM_CALL1(DestroyPlayer,p,a)
503 #define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) ICOM_CALL5(EnumGroupPlayers,p,a,b,c,d,e)
504 #define IDirectPlay2_EnumGroups(p,a,b,c,d)         ICOM_CALL4(EnumGroups,p,a,b,c,d)
505 #define IDirectPlay2_EnumPlayers(p,a,b,c,d)        ICOM_CALL4(EnumPlayers,p,a,b,c,d)
506 #define IDirectPlay2_EnumSessions(p,a,b,c,d,e)     ICOM_CALL5(EnumSessions,p,a,b,c,d,e)
507 #define IDirectPlay2_GetCaps(p,a,b)                ICOM_CALL2(GetCaps,p,a,b)
508 #define IDirectPlay2_GetGroupData(p,a,b,c,d)       ICOM_CALL4(GetGroupData,p,a,b,c,d)
509 #define IDirectPlay2_GetGroupName(p,a,b,c)         ICOM_CALL3(GetGroupName,p,a,b,c)
510 #define IDirectPlay2_GetMessageCount(p,a,b)        ICOM_CALL2(GetMessageCount,p,a,b)
511 #define IDirectPlay2_GetPlayerAddress(p,a,b,c)     ICOM_CALL3(GetPlayerAddress,p,a,b,c)
512 #define IDirectPlay2_GetPlayerCaps(p,a,b,c)        ICOM_CALL3(GetPlayerCaps,p,a,b,c)
513 #define IDirectPlay2_GetPlayerData(p,a,b,c,d)      ICOM_CALL4(GetPlayerData,p,a,b,c,d)
514 #define IDirectPlay2_GetPlayerName(p,a,b,c)        ICOM_CALL3(GetPlayerName,p,a,b,c)
515 #define IDirectPlay2_GetSessionDesc(p,a,b)         ICOM_CALL2(GetSessionDesc,p,a,b)
516 #define IDirectPlay2_Initialize(p,a)               ICOM_CALL1(Initialize,p,a)
517 #define IDirectPlay2_Open(p,a,b)                   ICOM_CALL2(Open,p,a,b)
518 #define IDirectPlay2_Receive(p,a,b,c,d,e)          ICOM_CALL5(Receive,p,a,b,c,d,e)
519 #define IDirectPlay2_Send(p,a,b,c,d,e)             ICOM_CALL5(Send,p,a,b,c,d,e)
520 #define IDirectPlay2_SetGroupData(p,a,b,c,d)       ICOM_CALL4(SetGroupData,p,a,b,c,d)
521 #define IDirectPlay2_SetGroupName(p,a,b,c)         ICOM_CALL3(SetGroupName,p,a,b,c)
522 #define IDirectPlay2_SetPlayerData(p,a,b,c,d)      ICOM_CALL4(SetPlayerData,p,a,b,c,d)
523 #define IDirectPlay2_SetPlayerName(p,a,b,c)        ICOM_CALL3(SetPlayerName,p,a,b,c)
524 #define IDirectPlay2_SetSessionDesc(p,a,b)         ICOM_CALL2(SetSessionDesc,p,a,b)
525
526
527 /*****************************************************************************
528  * IDirectPlay3 interface
529  */
530 #define ICOM_INTERFACE IDirectPlay3
531 #define IDirectPlay3_METHODS \
532     ICOM_METHOD2(HRESULT,AddGroupToGroup,            DPID,idParentGroup, DPID,idGroup) \
533     ICOM_METHOD6(HRESULT,CreateGroupInGroup,         DPID,idParentGroup, LPDPID,lpidGroup, LPDPNAME,lpGroupName, LPVOID,lpData, DWORD,dwDataSize, DWORD,dwFlags) \
534     ICOM_METHOD2(HRESULT,DeleteGroupFromGroup,       DPID,idParentGroup, DPID,idGroup) \
535     ICOM_METHOD4(HRESULT,EnumConnections,            LPCGUID,lpguidApplication, LPDPENUMCONNECTIONSCALLBACK,lpEnumCallback, LPVOID,lpContext, DWORD,dwFlags) \
536     ICOM_METHOD5(HRESULT,EnumGroupsInGroup,          DPID,idGroup, LPGUID,lpguidInstance, LPDPENUMPLAYERSCALLBACK2,lpEnumCallback, LPVOID,lpContext, DWORD,dwFlags) \
537     ICOM_METHOD4(HRESULT,GetGroupConnectionSettings, DWORD,dwFlags, DPID,idGroup, LPVOID,lpData, LPDWORD,lpdwDataSize) \
538     ICOM_METHOD2(HRESULT,InitializeConnection,       LPVOID,lpConnection, DWORD,dwFlags) \
539     ICOM_METHOD4(HRESULT,SecureOpen,                 LPCDPSESSIONDESC2,lpsd, DWORD,dwFlags, LPCDPSECURITYDESC,lpSecurity, LPCDPCREDENTIALS,lpCredentials) \
540     ICOM_METHOD4(HRESULT,SendChatMessage,            DPID,idFrom, DPID,idTo, DWORD,dwFlags, LPDPCHAT,lpChatMessage) \
541     ICOM_METHOD3(HRESULT,SetGroupConnectionSettings, DWORD,dwFlags, DPID,idGroup, LPDPLCONNECTION,lpConnection) \
542     ICOM_METHOD2(HRESULT,StartSession,               DWORD,dwFlags, DPID,idGroup) \
543     ICOM_METHOD2(HRESULT,GetGroupFlags,              DPID,idGroup, LPDWORD,lpdwFlags) \
544     ICOM_METHOD2(HRESULT,GetGroupParent,             DPID,idGroup, LPDPID,lpidParent) \
545     ICOM_METHOD4(HRESULT,GetPlayerAccount,           DPID,idPlayer, DWORD,dwFlags, LPVOID,lpData, LPDWORD,lpdwDataSize) \
546     ICOM_METHOD2(HRESULT,GetPlayerFlags,             DPID,idPlayer, LPDWORD,lpdwFlags)
547 #define IDirectPlay3_IMETHODS \
548     IDirectPlay2_IMETHODS \
549     IDirectPlay3_METHODS
550 ICOM_DEFINE(IDirectPlay3,IDirectPlay2)
551 #undef ICOM_INTERFACE
552
553 /*** IUnknown methods ***/
554 #define IDirectPlay3_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
555 #define IDirectPlay3_AddRef(p)             ICOM_CALL (AddRef,p)
556 #define IDirectPlay3_Release(p)            ICOM_CALL (Release,p)
557 /*** IDirectPlay2 methods ***/
558 #define IDirectPlay3_AddPlayerToGroup(p,a,b)       ICOM_CALL2(AddPlayerToGroup,p,a,b)
559 #define IDirectPlay3_Close(p)                      ICOM_CALL (Close,p)
560 #define IDirectPlay3_CreateGroup(p,a,b,c,d,e)      ICOM_CALL5(CreateGroup,p,a,b,c,d,e)
561 #define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f)   ICOM_CALL6(CreatePlayer,p,a,b,c,d,e,f)
562 #define IDirectPlay3_DeletePlayerFromGroup(p,a,b)  ICOM_CALL2(DeletePlayerFromGroup,p,a,b)
563 #define IDirectPlay3_DestroyGroup(p,a)             ICOM_CALL1(DestroyGroup,p,a)
564 #define IDirectPlay3_DestroyPlayer(p,a)            ICOM_CALL1(DestroyPlayer,p,a)
565 #define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) ICOM_CALL5(EnumGroupPlayers,p,a,b,c,d,e)
566 #define IDirectPlay3_EnumGroups(p,a,b,c,d)         ICOM_CALL4(EnumGroups,p,a,b,c,d)
567 #define IDirectPlay3_EnumPlayers(p,a,b,c,d)        ICOM_CALL4(EnumPlayers,p,a,b,c,d)
568 #define IDirectPlay3_EnumSessions(p,a,b,c,d,e)     ICOM_CALL5(EnumSessions,p,a,b,c,d,e)
569 #define IDirectPlay3_GetCaps(p,a,b)                ICOM_CALL2(GetCaps,p,a,b)
570 #define IDirectPlay3_GetGroupData(p,a,b,c,d)       ICOM_CALL4(GetGroupData,p,a,b,c,d)
571 #define IDirectPlay3_GetGroupName(p,a,b,c)         ICOM_CALL3(GetGroupName,p,a,b,c)
572 #define IDirectPlay3_GetMessageCount(p,a,b)        ICOM_CALL2(GetMessageCount,p,a,b)
573 #define IDirectPlay3_GetPlayerAddress(p,a,b,c)     ICOM_CALL3(GetPlayerAddress,p,a,b,c)
574 #define IDirectPlay3_GetPlayerCaps(p,a,b,c)        ICOM_CALL3(GetPlayerCaps,p,a,b,c)
575 #define IDirectPlay3_GetPlayerData(p,a,b,c,d)      ICOM_CALL4(GetPlayerData,p,a,b,c,d)
576 #define IDirectPlay3_GetPlayerName(p,a,b,c)        ICOM_CALL3(GetPlayerName,p,a,b,c)
577 #define IDirectPlay3_GetSessionDesc(p,a,b)         ICOM_CALL2(GetSessionDesc,p,a,b)
578 #define IDirectPlay3_Initialize(p,a)               ICOM_CALL1(Initialize,p,a)
579 #define IDirectPlay3_Open(p,a,b)                   ICOM_CALL2(Open,p,a,b)
580 #define IDirectPlay3_Receive(p,a,b,c,d,e)          ICOM_CALL5(Receive,p,a,b,c,d,e)
581 #define IDirectPlay3_Send(p,a,b,c,d,e)             ICOM_CALL5(Send,p,a,b,c,d,e)
582 #define IDirectPlay3_SetGroupData(p,a,b,c,d)       ICOM_CALL4(SetGroupData,p,a,b,c,d)
583 #define IDirectPlay3_SetGroupName(p,a,b,c)         ICOM_CALL3(SetGroupName,p,a,b,c)
584 #define IDirectPlay3_SetPlayerData(p,a,b,c,d)      ICOM_CALL4(SetPlayerData,p,a,b,c,d)
585 #define IDirectPlay3_SetPlayerName(p,a,b,c)        ICOM_CALL3(SetPlayerName,p,a,b,c)
586 #define IDirectPlay3_SetSessionDesc(p,a,b)         ICOM_CALL2(SetSessionDesc,p,a,b)
587 /*** IDirectPlay3 methods ***/
588 #define IDirectPlay3_AddGroupToGroup(p,a,b)                ICOM_CALL2(AddGroupToGroup,p,a,b)
589 #define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f)     ICOM_CALL6(CreateGroupInGroup,p,a,b,c,d,e,f)
590 #define IDirectPlay3_DeleteGroupFromGroup(p,a,b)           ICOM_CALL2(DeleteGroupFromGroup,p,a,b)
591 #define IDirectPlay3_EnumConnections(p,a,b,c,d)            ICOM_CALL4(EnumConnections,p,a,b,c,d)
592 #define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e)        ICOM_CALL5(EnumGroupsInGroup,p,a,b,c,d,e)
593 #define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) ICOM_CALL4(GetGroupConnectionSettings,p,a,b,c,d)
594 #define IDirectPlay3_InitializeConnection(p,a,b)           ICOM_CALL2(InitializeConnection,p,a,b)
595 #define IDirectPlay3_SecureOpen(p,a,b,c,d)                 ICOM_CALL4(SecureOpen,p,a,b,c,d)
596 #define IDirectPlay3_SendChatMessage(p,a,b,c,d)            ICOM_CALL4(SendChatMessage,p,a,b,c,d)
597 #define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c)   ICOM_CALL3(SetGroupConnectionSettings,p,a,b,c)
598 #define IDirectPlay3_StartSession(p,a,b)                   ICOM_CALL2(StartSession,p,a,b)
599 #define IDirectPlay3_GetGroupFlags(p,a,b)                  ICOM_CALL2(GetGroupFlags,p,a,b)
600 #define IDirectPlay3_GetGroupParent(p,a,b)                 ICOM_CALL2(GetGroupParent,p,a,b)
601 #define IDirectPlay3_GetPlayerAccount(p,a,b,c,d)           ICOM_CALL4(GetPlayerAccount,p,a,b,c,d)
602 #define IDirectPlay3_GetPlayerFlags(p,a,b)                 ICOM_CALL2(GetPlayerFlags,p,a,b)
603
604 /*****************************************************************************
605  * IDirectPlay4 interface - this is also known as IDirectPlayX. Apparently people
606  * are realizing that declaring all the darn interfaces as IDirectPlay{2,3,...} is
607  * just plain dumb. It's now going to be just IDirectPlayX since they're just macros
608  * anyways. That's good because I'm tired of typing these entries :)
609  * The compiler should catch any problems with invocation of invalid method :)
610  */
611 #define ICOM_INTERFACE IDirectPlay4
612 #define IDirectPlay4_METHODS \
613     ICOM_METHOD2( HRESULT, GetGroupOwner,        DPID,, LPDPID, ) \
614     ICOM_METHOD2( HRESULT, SetGroupOwner,        DPID,, DPID, ) \
615     ICOM_METHOD9( HRESULT, SendEx,               DPID,, DPID,, DWORD,, LPVOID,, DWORD,, DWORD,, DWORD,, LPVOID,, LPDWORD, ) \
616     ICOM_METHOD5( HRESULT, GetMessageQueue,      DPID,, DPID,, DWORD,, LPDWORD,, LPDWORD, ) \
617     ICOM_METHOD2( HRESULT, CancelMessage,        DWORD,, DWORD, ) \
618     ICOM_METHOD3( HRESULT, CancelPriority,       DWORD,, DWORD,, DWORD, )
619
620 #define IDirectPlay4_IMETHODS
621     IDirectPlay3_IMETHODS \
622     IDirectPlay4_METHODS 
623 ICOM_DEFINE(IDirectPlay4,IDirectPlay3)
624
625 #undef ICOM_INTERFACE
626
627 /*** IUnknown methods ***/
628 #define IDirectPlayX_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
629 #define IDirectPlayX_AddRef(p)             ICOM_CALL (AddRef,p)
630 #define IDirectPlayX_Release(p)            ICOM_CALL (Release,p)
631 /*** IDirectPlay2 methods ***/
632 #define IDirectPlayX_AddPlayerToGroup(p,a,b)       ICOM_CALL2(AddPlayerToGroup,p,a,b)
633 #define IDirectPlayX_Close(p)                      ICOM_CALL (Close,p)
634 #define IDirectPlayX_CreateGroup(p,a,b,c,d,e)      ICOM_CALL5(CreateGroup,p,a,b,c,d,e)
635 #define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f)   ICOM_CALL6(CreatePlayer,p,a,b,c,d,e,f)
636 #define IDirectPlayX_DeletePlayerFromGroup(p,a,b)  ICOM_CALL2(DeletePlayerFromGroup,p,a,b)
637 #define IDirectPlayX_DestroyGroup(p,a)             ICOM_CALL1(DestroyGroup,p,a)
638 #define IDirectPlayX_DestroyPlayer(p,a)            ICOM_CALL1(DestroyPlayer,p,a)
639 #define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) ICOM_CALL5(EnumGroupPlayers,p,a,b,c,d,e)
640 #define IDirectPlayX_EnumGroups(p,a,b,c,d)         ICOM_CALL4(EnumGroups,p,a,b,c,d)
641 #define IDirectPlayX_EnumPlayers(p,a,b,c,d)        ICOM_CALL4(EnumPlayers,p,a,b,c,d)
642 #define IDirectPlayX_EnumSessions(p,a,b,c,d,e)     ICOM_CALL5(EnumSessions,p,a,b,c,d,e)
643 #define IDirectPlayX_GetCaps(p,a,b)                ICOM_CALL2(GetCaps,p,a,b)
644 #define IDirectPlayX_GetGroupData(p,a,b,c,d)       ICOM_CALL4(GetGroupData,p,a,b,c,d)
645 #define IDirectPlayX_GetGroupName(p,a,b,c)         ICOM_CALL3(GetGroupName,p,a,b,c)
646 #define IDirectPlayX_GetMessageCount(p,a,b)        ICOM_CALL2(GetMessageCount,p,a,b)
647 #define IDirectPlayX_GetPlayerAddress(p,a,b,c)     ICOM_CALL3(GetPlayerAddress,p,a,b,c)
648 #define IDirectPlayX_GetPlayerCaps(p,a,b,c)        ICOM_CALL3(GetPlayerCaps,p,a,b,c)
649 #define IDirectPlayX_GetPlayerData(p,a,b,c,d)      ICOM_CALL4(GetPlayerData,p,a,b,c,d)
650 #define IDirectPlayX_GetPlayerName(p,a,b,c)        ICOM_CALL3(GetPlayerName,p,a,b,c)
651 #define IDirectPlayX_GetSessionDesc(p,a,b)         ICOM_CALL2(GetSessionDesc,p,a,b)
652 #define IDirectPlayX_Initialize(p,a)               ICOM_CALL1(Initialize,p,a)
653 #define IDirectPlayX_Open(p,a,b)                   ICOM_CALL2(Open,p,a,b)
654 #define IDirectPlayX_Receive(p,a,b,c,d,e)          ICOM_CALL5(Receive,p,a,b,c,d,e)
655 #define IDirectPlayX_Send(p,a,b,c,d,e)             ICOM_CALL5(Send,p,a,b,c,d,e)
656 #define IDirectPlayX_SetGroupData(p,a,b,c,d)       ICOM_CALL4(SetGroupData,p,a,b,c,d)
657 #define IDirectPlayX_SetGroupName(p,a,b,c)         ICOM_CALL3(SetGroupName,p,a,b,c)
658 #define IDirectPlayX_SetPlayerData(p,a,b,c,d)      ICOM_CALL4(SetPlayerData,p,a,b,c,d)
659 #define IDirectPlayX_SetPlayerName(p,a,b,c)        ICOM_CALL3(SetPlayerName,p,a,b,c)
660 #define IDirectPlayX_SetSessionDesc(p,a,b)         ICOM_CALL2(SetSessionDesc,p,a,b)
661 /*** IDirectPlay3 methods ***/
662 #define IDirectPlayX_AddGroupToGroup(p,a,b)                ICOM_CALL2(AddGroupToGroup,p,a,b)
663 #define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f)     ICOM_CALL6(CreateGroupInGroup,p,a,b,c,d,e,f)
664 #define IDirectPlayX_DeleteGroupFromGroup(p,a,b)           ICOM_CALL2(DeleteGroupFromGroup,p,a,b)
665 #define IDirectPlayX_EnumConnections(p,a,b,c,d)            ICOM_CALL4(EnumConnections,p,a,b,c,d)
666 #define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e)        ICOM_CALL5(EnumGroupsInGroup,p,a,b,c,d,e)
667 #define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) ICOM_CALL4(GetGroupConnectionSettings,p,a,b,c,d)
668 #define IDirectPlayX_InitializeConnection(p,a,b)           ICOM_CALL2(InitializeConnection,p,a,b)
669 #define IDirectPlayX_SecureOpen(p,a,b,c,d)                 ICOM_CALL4(SecureOpen,p,a,b,c,d)
670 #define IDirectPlayX_SendChatMessage(p,a,b,c,d)            ICOM_CALL4(SendChatMessage,p,a,b,c,d)
671 #define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c)   ICOM_CALL3(SetGroupConnectionSettings,p,a,b,c)
672 #define IDirectPlayX_StartSession(p,a,b)                   ICOM_CALL2(StartSession,p,a,b)
673 #define IDirectPlayX_GetGroupFlags(p,a,b)                  ICOM_CALL2(GetGroupFlags,p,a,b)
674 #define IDirectPlayX_GetGroupParent(p,a,b)                 ICOM_CALL2(GetGroupParent,p,a,b)
675 #define IDirectPlayX_GetPlayerAccount(p,a,b,c,d)           ICOM_CALL4(GetPlayerAccount,p,a,b,c,d)
676 #define IDirectPlayX_GetPlayerFlags(p,a,b)                 ICOM_CALL2(GetPlayerFlags,p,a,b)
677 /*** IDirectPlay4 methods ***/
678 #define IDirectPlayX_GetGroupOwner(p,a,b)                  ICOM_CALL2(GetGroupOwner,p,a,b)
679 #define IDirectPlayX_SetGroupOwner(p,a,b)                  ICOM_CALL2(SetGroupOwner,p,a,b)
680 #define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i)           ICOM_CALL9(SendEx,a,b,c,d,e,f,g,h,i)
681 #define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e)          ICOM_CALL5(GetMessageQueue,a,b,c,d,e)
682 #define IDirectPlayX_CancelMessage(p,a,b)                  ICOM_CALL2(CancelMessage,a,b)
683 #define IDirectPlayX_CancelPriority(p,a,b,c)               ICOM_CALL3(CancelPriority,a,b,c)
684
685 /* For DirectPlay::EnumConnections */
686 #define DPCONNECTION_DIRECTPLAY      0x00000001
687 #define DPCONNECTION_DIRECTPLAYLOBBY 0x00000002
688
689 /* For DirectPlay::EnumPlayers and DirectPlay::EnumGroups */
690 #define DPENUMPLAYERS_ALL           0x00000000
691 #define DPENUMPLAYERS_LOCAL         0x00000008
692 #define DPENUMPLAYERS_REMOTE        0x00000010
693 #define DPENUMPLAYERS_GROUP         0x00000020
694 #define DPENUMPLAYERS_SESSION       0x00000080
695 #define DPENUMPLAYERS_SERVERPLAYER  0x00000100
696 #define DPENUMPLAYERS_SPECTATOR     0x00000200
697 #define DPENUMPLAYERS_OWNER         0x00002000
698
699 #define DPENUMGROUPS_ALL            DPENUMPLAYERS_ALL
700 #define DPENUMGROUPS_LOCAL          DPENUMPLAYERS_LOCAL
701 #define DPENUMGROUPS_REMOTE         DPENUMPLAYERS_REMOTE
702 #define DPENUMGROUPS_SESSION        DPENUMPLAYERS_SESSION
703 #define DPENUMGROUPS_SHORTCUT       0x00000400
704 #define DPENUMGROUPS_STAGINGAREA    0x00000800
705 #define DPENUMGROUPS_HIDDEN         0x00001000
706
707
708 /* For DirectPlay::CreatePlayer */ 
709 #define DPPLAYER_SERVERPLAYER  DPENUMPLAYERS_SERVERPLAYER
710 #define DPPLAYER_SPECTATOR     DPENUMPLAYERS_SPECTATOR
711 #define DPPLAYER_LOCAL         DPENUMPLAYERS_LOCAL
712 #define DPPLAYER_OWNER         DPENUMPLAYERS_OWNER
713
714 /* For DirectPlay::CreateGroup */
715 #define DPGROUP_STAGINGAREA  DPENUMGROUPS_STAGINGAREA
716 #define DPGROUP_LOCAL        DPENUMGROUPS_LOCAL
717 #define DPGROUP_HIDDEN       DPENUMGROUPS_HIDDEN
718
719 /* For DirectPlay::EnumSessions */
720 #define DPENUMSESSIONS_AVAILABLE         0x00000001
721 #define DPENUMSESSIONS_ALL               0x00000002
722 #define DPENUMSESSIONS_ASYNC             0x00000010
723 #define DPENUMSESSIONS_STOPASYNC         0x00000020
724 #define DPENUMSESSIONS_PASSWORDREQUIRED  0x00000040
725 #define DPENUMSESSIONS_RETURNSTATUS      0x00000080
726
727 /* For DirectPlay::GetCaps and DirectPlay::GetPlayerCaps */
728 #define DPGETCAPS_GUARANTEED  0x00000001
729
730 /* For DirectPlay::GetGroupData and DirectPlay::GetPlayerData */
731 #define DPGET_REMOTE  0x00000000
732 #define DPGET_LOCAL   0x00000001
733
734 /* For DirectPlay::Receive */
735 #define DPRECEIVE_ALL         0x00000001
736 #define DPRECEIVE_TOPLAYER    0x00000002
737 #define DPRECEIVE_FROMPLAYER  0x00000004
738 #define DPRECEIVE_PEEK        0x00000008
739
740 /* For DirectPlay::Send */
741 #define DPSEND_NONGUARANTEED       0x00000000
742 #define DPSEND_GUARANTEED          0x00000001
743 #define DPSEND_HIGHPRIORITY        0x00000002
744 #define DPSEND_OPENSTREAM          0x00000008
745 #define DPSEND_CLOSESTREAM         0x00000010
746 #define DPSEND_SIGNED              0x00000020
747 #define DPSEND_ENCRYPTED           0x00000040
748 #define DPSEND_LOBBYSYSTEMMESSAGE  0x00000080
749 #define DPSEND_ASYNC               0x00000200
750 #define DPSEND_NOSENDCOMPLETEMSG   0x00000400
751
752 #define DPSEND_MAX_PRI       0x0000FFFF
753 #define DPSEND_MAX_PRIORITY  DPSEND_MAX_PRI
754
755
756 /* For  DirectPlay::SetGroupData, DirectPlay::SetGroupName, 
757  * DirectPlay::SetPlayerData, DirectPlay::SetPlayerName and 
758  * DirectPlay::SetSessionDesc.
759  */
760 #define DPSET_REMOTE      0x00000000
761 #define DPSET_LOCAL       0x00000001
762 #define DPSET_GUARANTEED  0x00000002
763
764 /* For DirectPlay::GetMessageQueue */
765 #define DPMESSAGEQUEUE_SEND    0x00000001
766 #define DPMESSAGEQUEUE_RECEIVE 0x00000002
767
768 /* DirectPlay::Connect */
769 #define DPCONNECT_RETURNSTATUS  (DPENUMSESSIONS_RETURNSTATUS)
770
771
772 /** DirectPlay system messages **/
773
774 /* A new player or group has been created in the session */
775 #define DPSYS_CREATEPLAYERORGROUP   0x0003
776
777 /* A player or group has been deleted from the session */
778 #define DPSYS_DESTROYPLAYERORGROUP  0x0005
779
780 /* A player has been added to a group */
781 #define DPSYS_ADDPLAYERTOGROUP      0x0007
782
783 /* A player has been deleted from a group */
784 #define DPSYS_DELETEPLAYERFROMGROUP 0x0021
785
786 /* Session lost for this object - ie lost contact with all players */
787 #define DPSYS_SESSIONLOST           0x0031
788
789 /* The current host has left the session */
790 #define DPSYS_HOST                  0x0101
791
792 /* Player or group data has changed */
793 #define DPSYS_SETPLAYERORGROUPDATA  0x0102
794
795 /* The name of a player or group has changed */
796 #define DPSYS_SETPLAYERORGROUPNAME  0x0103
797
798 /* The session description has changed */
799 #define DPSYS_SETSESSIONDESC        0x0104
800
801 /* A group has been added to a group */
802 #define DPSYS_ADDGROUPTOGROUP           0x0105
803
804 /* A group has been deleted from a group */
805 #define DPSYS_DELETEGROUPFROMGROUP      0x0106
806
807 /* A secure player to player message has arrived */
808 #define DPSYS_SECUREMESSAGE         0x0107
809
810 /* Start a new session */
811 #define DPSYS_STARTSESSION          0x0108
812
813 /* A chat message has arrived */
814 #define DPSYS_CHAT                  0x0109
815
816 /* The owner of a group has changed */
817 #define DPSYS_SETGROUPOWNER         0x010A
818
819 /* An async send is done (finished normally, failed or cancelled) */
820 #define DPSYS_SENDCOMPLETE          0x010d
821
822 /** DirectPlay System Messages **/ 
823
824 #define DPPLAYERTYPE_GROUP   0x00000000
825 #define DPPLAYERTYPE_PLAYER  0x00000001
826
827
828 /* NOTE: DPMSG_HOST and DPMSG_GENERIC share the same format */
829 typedef struct tagDPMSG_GENERIC
830 {
831    DWORD       dwType; /* Use message type as described above */
832 } DPMSG_GENERIC,     *LPDPMSG_GENERIC, 
833   DPMSG_HOST,        *LPDPMSG_HOST,
834   DPMSG_SESSIONLOST, *LPDPMSG_SESSIONLOST;
835
836 typedef struct tagDPMSG_CREATEPLAYERORGROUP
837 {
838    DWORD   dwType;           /* Use message type as described above */
839    DWORD   dwPlayerType;     /* Use DPPLAYERTYPE_GROUP or DPPLAYERTYPE_PLAYER */
840    DPID    dpId;             /* ID of the player/group */
841    DWORD   dwCurrentPlayers; /* Current number of players/groups in session */
842    LPVOID  lpData;           /* Pointer to data */
843    DWORD   dwDataSize;       /* Size of data */
844    DPNAME  dpnName;          /* Name info */
845
846    /* dpIdParent and dwFlags are only valid in DirectPlay3 and later. What
847     * does that mean about the message size before? -PH */ 
848    DPID   dpIdParent;  /* id of parent group */
849    DWORD  dwFlags;     /* Flags for the player/group */ 
850 } DPMSG_CREATEPLAYERORGROUP, *LPDPMSG_CREATEPLAYERORGROUP;
851
852 typedef struct tagDPMSG_DESTROYPLAYERORGROUP
853 {
854    DWORD   dwType;           /* Use message type as described above */
855    DWORD   dwPlayerType;     /* Use DPPLAYERTYPE_GROUP or DPPLAYERTYPE_PLAYER */
856    DPID    dpId;             /* ID of player/group to be deleted */
857    LPVOID  lpLocalData;      /* Pointer to local data */
858    DWORD   dwLocalDataSize;  /* Sizeof local data */
859    LPVOID  lpRemoteData;     /* Pointer to remote data */
860    DWORD   dwRemoteDataSize; /* Sizeof remote data */
861
862    /* dpnName, dpIdParent and dwFlags are only valid in DirectPlay3 and later. What
863     * does that mean about the message size before? -PH */
864    DPNAME  dpnName;     /* Name info */
865    DPID    dpIdParent;  /* id of parent group */
866    DWORD   dwFlags;     /* Flags for the player/group */
867 } DPMSG_DESTROYPLAYERORGROUP, *LPDPMSG_DESTROYPLAYERORGROUP;
868
869 /* NOTE: DPMSG_ADDPLAYERTOGROUP and DPMSG_DELETEPLAYERFROMGROUP are the same */
870 typedef struct tagDPMSG_ADDPLAYERTOGROUP
871 {
872    DWORD  dwType;      /* Use message type as described above */
873    DPID   dpIdGroup;   /* Group ID to add player into */
874    DPID   dpIdPlayer;  /* ID of player to add */
875 } DPMSG_ADDPLAYERTOGROUP,      *LPDPMSG_ADDPLAYERTOGROUP, 
876   DPMSG_DELETEPLAYERFROMGROUP, *LPDPMSG_DELETEPLAYERFROMGROUP; 
877
878 /* NOTE: DPMSG_ADDGROUPTOGROUP and DPMSG_DELETEGROUPFROMGROUP are the same */
879 typedef struct tagDPMSG_ADDGROUPTOGROUP
880 {
881    DWORD  dwType;          /* Use message type as described above */
882    DPID   dpIdParentGroup; /* Group ID to add group into */
883    DPID   dpIdGroup;       /* ID of group to add */
884 } DPMSG_ADDGROUPTOGROUP,      *LPDPMSG_ADDGROUPTOGROUP,
885   DPMSG_DELETEGROUPFROMGROUP, *LPDPMSG_DELETEGROUPFROMGROUP;
886
887 typedef struct tagDPMSG_SETPLAYERORGROUPDATA
888 {
889    DWORD   dwType;       /* Use message type as described above */
890    DWORD   dwPlayerType; /* Use DPPLAYERTYPE_GROUP or DPPLAYERTYPE_PLAYER */ 
891    DPID    dpId;         /* ID of player/group */
892    LPVOID  lpData;       /* Pointer to data */
893    DWORD   dwDataSize;   /* Size of data */
894 } DPMSG_SETPLAYERORGROUPDATA, *LPDPMSG_SETPLAYERORGROUPDATA;
895
896 typedef struct tagDPMSG_SETPLAYERORGROUPNAME
897 {
898    DWORD  dwType;       /* Use message type as described above */
899    DWORD  dwPlayerType; /* Use DPPLAYERTYPE_GROUP or DPPLAYERTYPE_PLAYER */
900    DPID   dpId;         /* ID of player/group */
901    DPNAME dpnName;      /* New name */
902 } DPMSG_SETPLAYERORGROUPNAME, *LPDPMSG_SETPLAYERORGROUPNAME;
903
904 typedef struct tagDPMSG_SETSESSIONDESC
905 {
906    DWORD           dwType; /* Use message type as described above */
907    DPSESSIONDESC2  dpDesc; /* New session desc */
908 } DPMSG_SETSESSIONDESC, *LPDPMSG_SETSESSIONDESC;
909
910 typedef struct tagDPMSG_SECUREMESSAGE
911 {
912    DWORD   dwType;     /* Use message type as described above */
913    DWORD   dwFlags;    /* Signed/Encrypted */
914    DPID    dpIdFrom;   /* ID of from player */
915    LPVOID  lpData;     /* Message sent */
916    DWORD   dwDataSize; /* Size of message */
917 } DPMSG_SECUREMESSAGE, *LPDPMSG_SECUREMESSAGE;
918
919 typedef struct tagDPMSG_STARTSESSION
920 {
921    DWORD            dwType; /* Use message type as described above */
922    LPDPLCONNECTION  lpConn; /* DPLCONNECTION structure */
923 } DPMSG_STARTSESSION, *LPDPMSG_STARTSESSION;
924
925 typedef struct tagDPMSG_CHAT
926 {
927    DWORD     dwType;       /* Use message type as described above */
928    DWORD     dwFlags;      /* Message flags */
929    DPID      idFromPlayer; /* ID of sender */
930    DPID      idToPlayer;   /* ID of who msg is for */
931    DPID      idToGroup;    /* ID of what group msg is for */
932    LPDPCHAT  lpChat;       /* Chat message */
933 } DPMSG_CHAT, *LPDPMSG_CHAT;
934
935 typedef struct tagDPMSG_SETGROUPOWNER
936 {
937    DWORD  dwType;     /* Use message type as described above */
938    DPID   idGroup;    /* Group ID */
939    DPID   idNewOwner; /* ID of player who now owns group */
940    DPID   idOldOwner; /* ID of player who used to own group */
941 } DPMSG_SETGROUPOWNER, *LPDPMSG_SETGROUPOWNER;
942
943 typedef struct
944 {
945    DWORD    dwType;      /* Use message type as described above */
946    DPID     idFrom;      /* ID from */
947    DPID     idTo;        /* ID to */ 
948    DWORD    dwFlags;    
949    DWORD    dwPriority;
950    DWORD    dwTimeout;
951    LPVOID   lpvContext;
952    DWORD    dwMsgID;
953    HRESULT  hr;
954    DWORD    dwSendTime;  /* When sent ? */ 
955 } DPMSG_SENDCOMPLETE, *LPDPMSG_SENDCOMPLETE;
956
957
958
959 #ifdef __cplusplus
960 } /* extern "C" */
961 #endif /* defined(__cplusplus) */
962
963 #endif /* __WINE_DPLAY_H */