]> icculus.org git repositories - taylor/freespace2.git/blob - include/vdplay.h
Initial revision
[taylor/freespace2.git] / include / vdplay.h
1 /*==========================================================================;
2  *
3  *  Copyright (C) 1994-1997 Microsoft Corporation.  All Rights Reserved.
4  *
5  *  File:       dplay.h
6  *  Content:    DirectPlay include file
7  *
8  ***************************************************************************/
9
10 #ifndef __DPLAY_INCLUDED__
11 #define __DPLAY_INCLUDED__
12
13 #include <ole2.h>       // for DECLARE_INTERFACE and HRESULT
14
15 #define _FACDP  0x877
16 #define MAKE_DPHRESULT( code )    MAKE_HRESULT( 1, _FACDP, code )
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /*
23  * GUIDS used by DirectPlay objects
24  */
25 DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
26 DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82);
27
28 DEFINE_GUID(IID_IDirectPlay3, 0x133efe40, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
29 DEFINE_GUID(IID_IDirectPlay3A,0x133efe41, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
30
31 // {D1EB6D20-8923-11d0-9D97-00A0C90A43CB}
32 DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20, 0x8923, 0x11d0, 0x9d, 0x97, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb);
33
34 /*
35  * GUIDS used by Service Providers shipped with DirectPlay
36  * Use these to identify Service Provider returned by EnumConnections
37  */
38
39 // GUID for IPX service provider
40 // {685BC400-9D2C-11cf-A9CD-00AA006886E3}
41 DEFINE_GUID(DPSPGUID_IPX, 
42 0x685bc400, 0x9d2c, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
43
44 // GUID for TCP/IP service provider
45 // 36E95EE0-8577-11cf-960C-0080C7534E82
46 DEFINE_GUID(DPSPGUID_TCPIP,
47 0x36E95EE0, 0x8577, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82);
48
49 // GUID for Serial service provider
50 // {0F1D6860-88D9-11cf-9C4E-00A0C905425E}
51 DEFINE_GUID(DPSPGUID_SERIAL,                                            
52 0xf1d6860, 0x88d9, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
53
54 // GUID for Modem service provider
55 // {44EAA760-CB68-11cf-9C4E-00A0C905425E}
56 DEFINE_GUID(DPSPGUID_MODEM,
57 0x44eaa760, 0xcb68, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
58
59 /****************************************************************************
60  *
61  * DirectPlay Structures
62  *
63  * Various structures used to invoke DirectPlay.
64  *
65  ****************************************************************************/
66
67 #ifndef IDIRECTPLAY2_OR_GREATER
68 typedef struct IDirectPlay        FAR *LPDIRECTPLAY;
69 #else
70 typedef struct IUnknown           FAR *LPDIRECTPLAY;
71 #endif
72
73 typedef struct IDirectPlay2       FAR *LPDIRECTPLAY2;
74 typedef struct IDirectPlay2       FAR *LPDIRECTPLAY2A;
75 typedef struct IDirectPlay2       IDirectPlay2A;
76
77 typedef struct IDirectPlay3       FAR *LPDIRECTPLAY3;
78 typedef struct IDirectPlay3       FAR *LPDIRECTPLAY3A;
79 typedef struct IDirectPlay3       IDirectPlay3A;
80
81 /*
82  * DPID
83  * DirectPlay player and group ID
84  */
85 typedef DWORD DPID, FAR *LPDPID;
86
87 /*
88  * DPID that system messages come from
89  */
90 #define DPID_SYSMSG         0
91
92 /*
93  * DPID representing all players in the session
94  */
95 #define DPID_ALLPLAYERS     0
96
97 /*
98  * DPID representing the server player
99  */
100 #define DPID_SERVERPLAYER       1
101
102 /*
103  * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID)
104  */
105 #define DPID_UNKNOWN            0xFFFFFFFF
106
107 /*
108  * DPCAPS
109  * Used to obtain the capabilities of a DirectPlay object
110  */
111 typedef struct
112 {
113     DWORD dwSize;               // Size of structure, in bytes
114     DWORD dwFlags;              // DPCAPS_xxx flags
115     DWORD dwMaxBufferSize;      // Maximum message size, in bytes,  for this service provider
116     DWORD dwMaxQueueSize;       // Obsolete. 
117     DWORD dwMaxPlayers;         // Maximum players/groups (local + remote)
118     DWORD dwHundredBaud;        // Bandwidth in 100 bits per second units; 
119                                 // i.e. 24 is 2400, 96 is 9600, etc.
120     DWORD dwLatency;            // Estimated latency; 0 = unknown
121     DWORD dwMaxLocalPlayers;    // Maximum # of locally created players allowed
122     DWORD dwHeaderLength;       // Maximum header length, in bytes, on messages
123                                 // added by the service provider
124     DWORD dwTimeout;            // Service provider's suggested timeout value
125                                 // This is how long DirectPlay will wait for 
126                                 // responses to system messages
127 } DPCAPS, FAR *LPDPCAPS;
128
129 /*
130  * This DirectPlay object is the session host.  If the host exits the
131  * session, another application will become the host and receive a
132  * DPSYS_HOST system message.
133  */
134 #define DPCAPS_ISHOST               0x00000002
135
136 /*
137  * The service provider bound to this DirectPlay object can optimize
138  * group messaging.
139  */
140 #define DPCAPS_GROUPOPTIMIZED       0x00000008
141
142 /*
143  * The service provider bound to this DirectPlay object can optimize
144  * keep alives (see DPSESSION_KEEPALIVE)
145  */
146 #define DPCAPS_KEEPALIVEOPTIMIZED   0x00000010
147
148 /*
149  * The service provider bound to this DirectPlay object can optimize
150  * guaranteed message delivery.
151  */
152 #define DPCAPS_GUARANTEEDOPTIMIZED  0x00000020
153
154 /*
155  * This DirectPlay object supports guaranteed message delivery.
156  */
157 #define DPCAPS_GUARANTEEDSUPPORTED  0x00000040
158
159 /*
160  * This DirectPlay object supports digital signing of messages.
161  */
162 #define DPCAPS_SIGNINGSUPPORTED     0x00000080
163
164 /*
165  * This DirectPlay object supports encryption of messages.
166  */
167 #define DPCAPS_ENCRYPTIONSUPPORTED  0x00000100
168
169
170 /*
171  * DPSESSIONDESC2
172  * Used to describe the properties of a DirectPlay
173  * session instance
174  */
175 typedef struct
176 {
177     DWORD   dwSize;             // Size of structure
178     DWORD   dwFlags;            // DPSESSION_xxx flags
179     GUID    guidInstance;       // ID for the session instance
180     GUID    guidApplication;    // GUID of the DirectPlay application.
181                                 // GUID_NULL for all applications.
182     DWORD   dwMaxPlayers;       // Maximum # players allowed in session
183     DWORD   dwCurrentPlayers;   // Current # players in session (read only)
184     union
185     {                           // Name of the session
186         LPWSTR  lpszSessionName;    // Unicode
187         LPSTR   lpszSessionNameA;   // ANSI
188     };
189     union
190     {                           // Password of the session (optional)
191         LPWSTR  lpszPassword;       // Unicode
192         LPSTR   lpszPasswordA;      // ANSI
193     };
194     DWORD   dwReserved1;        // Reserved for future MS use.
195     DWORD   dwReserved2;
196     DWORD   dwUser1;            // For use by the application
197     DWORD   dwUser2;
198     DWORD   dwUser3;
199     DWORD   dwUser4;
200 } DPSESSIONDESC2, FAR *LPDPSESSIONDESC2;
201
202 /*
203  * LPCDPSESSIONDESC2
204  * A constant pointer to DPSESSIONDESC2
205  */
206 typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2;
207  
208 /*
209  * Applications cannot create new players in this session.
210  */
211 #define DPSESSION_NEWPLAYERSDISABLED    0x00000001 
212
213 /*
214  * If the DirectPlay object that created the session, the host,
215  * quits, then the host will attempt to migrate to another
216  * DirectPlay object so that new players can continue to be created
217  * and new applications can join the session.
218  */
219 #define DPSESSION_MIGRATEHOST           0x00000004
220
221 /*
222  * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom 
223  * fields in player messages.  This cuts two DWORD's off the message 
224  * overhead.
225  */
226 #define DPSESSION_NOMESSAGEID           0x00000008
227
228
229 /*
230  * This flag tells DirectPlay to not allow any new applications to
231  * join the session.  Applications already in the session can still
232  * create new players.
233  */
234 #define DPSESSION_JOINDISABLED          0x00000020
235
236 /*
237  * This flag tells DirectPlay to detect when remote players 
238  * exit abnormally (e.g. their computer or modem gets unplugged)
239  */
240 #define DPSESSION_KEEPALIVE             0x00000040
241
242 /*
243  * This flag tells DirectPlay not to send a message to all players
244  * when a players remote data changes
245  */
246 #define DPSESSION_NODATAMESSAGES        0x00000080
247
248 /*
249  * This flag indicates that the session belongs to a secure server
250  * and needs user authentication
251  */
252 #define DPSESSION_SECURESERVER          0x00000100
253
254 /*
255  * This flag indicates that the session is private and requirs a password
256  * for EnumSessions as well as Open.
257  */
258 #define DPSESSION_PRIVATE               0x00000200
259
260 /*
261  * This flag indicates that the session requires a password for joining.
262  */
263 #define DPSESSION_PASSWORDREQUIRED      0x00000400
264
265 /*
266  * This flag tells DirectPlay to route all messages through the server
267  */
268 #define DPSESSION_MULTICASTSERVER               0x00000800
269
270 /*
271  * This flag tells DirectPlay to only download information about the
272  * DPPLAYER_SERVERPLAYER.  
273  */
274 #define DPSESSION_CLIENTSERVER                  0x00001000
275
276 /*
277  * DPNAME
278  * Used to hold the name of a DirectPlay entity
279  * like a player or a group
280  */
281 typedef struct 
282 {
283     DWORD   dwSize;             // Size of structure
284     DWORD   dwFlags;            // Not used. Must be zero.
285     union
286     {                           // The short or friendly name
287         LPWSTR  lpszShortName;  // Unicode
288         LPSTR   lpszShortNameA; // ANSI
289     };
290     union
291     {                           // The long or formal name
292         LPWSTR  lpszLongName;   // Unicode
293         LPSTR   lpszLongNameA;  // ANSI
294     };
295
296 } DPNAME, FAR *LPDPNAME;
297
298 /*
299  * LPCDPNAME
300  * A constant pointer to DPNAME
301  */
302 typedef const DPNAME FAR *LPCDPNAME;
303
304 /*
305  * DPCREDENTIALS
306  * Used to hold the user name and password of a DirectPlay user
307  */
308 typedef struct 
309 {
310     DWORD dwSize;               // Size of structure
311     DWORD dwFlags;              // Not used. Must be zero.
312     union
313     {                           // User name of the account
314         LPWSTR  lpszUsername;   // Unicode
315         LPSTR   lpszUsernameA;  // ANSI
316     };    
317     union
318     {                           // Password of the account
319         LPWSTR  lpszPassword;   // Unicode
320         LPSTR   lpszPasswordA;  // ANSI
321     };    
322     union
323     {                           // Domain name of the account
324         LPWSTR  lpszDomain;     // Unicode
325         LPSTR   lpszDomainA;    // ANSI
326     };    
327 } DPCREDENTIALS, FAR *LPDPCREDENTIALS;
328
329 typedef const DPCREDENTIALS FAR *LPCDPCREDENTIALS;
330
331 /*
332  * DPSECURITYDESC
333  * Used to describe the security properties of a DirectPlay
334  * session instance
335  */
336 typedef struct 
337 {
338     DWORD dwSize;                   // Size of structure
339     DWORD dwFlags;                  // Not used. Must be zero.
340     union
341     {                               // SSPI provider name
342         LPWSTR  lpszSSPIProvider;   // Unicode
343         LPSTR   lpszSSPIProviderA;  // ANSI
344     };
345     union
346     {                               // CAPI provider name
347         LPWSTR lpszCAPIProvider;    // Unicode
348         LPSTR  lpszCAPIProviderA;   // ANSI
349     };
350     DWORD dwCAPIProviderType;       // Crypto Service Provider type
351     DWORD dwEncryptionAlgorithm;    // Encryption Algorithm type
352 } DPSECURITYDESC, FAR *LPDPSECURITYDESC;
353
354 typedef const DPSECURITYDESC FAR *LPCDPSECURITYDESC;
355
356 /*
357  * DPACCOUNTDESC
358  * Used to describe a user membership account
359  */
360 typedef struct 
361 {
362     DWORD dwSize;                   // Size of structure
363     DWORD dwFlags;                  // Not used. Must be zero.
364     union
365     {                               // Account identifier
366         LPWSTR  lpszAccountID;      // Unicode
367         LPSTR   lpszAccountIDA;     // ANSI
368     };
369 } DPACCOUNTDESC, FAR *LPDPACCOUNTDESC;
370
371 typedef const DPACCOUNTDESC FAR *LPCDPACCOUNTDESC;
372
373 /*
374  * LPCGUID
375  * A constant pointer to a guid
376  */
377 typedef const GUID FAR *LPCGUID;
378
379 /*
380  * DPLCONNECTION
381  * Used to hold all in the informaion needed to connect
382  * an application to a session or create a session
383  */
384 typedef struct
385 {
386     DWORD               dwSize;             // Size of this structure
387     DWORD               dwFlags;            // Flags specific to this structure
388     LPDPSESSIONDESC2    lpSessionDesc;      // Pointer to session desc to use on connect
389     LPDPNAME            lpPlayerName;       // Pointer to Player name structure
390     GUID                guidSP;             // GUID of the DPlay SP to use
391     LPVOID              lpAddress;          // Address for service provider
392     DWORD               dwAddressSize;      // Size of address data
393 } DPLCONNECTION, FAR *LPDPLCONNECTION;
394
395 /*
396  * LPCDPLCONNECTION
397  * A constant pointer to DPLCONNECTION
398  */
399 typedef const DPLCONNECTION FAR *LPCDPLCONNECTION;
400
401 /*
402  * DPCHAT
403  * Used to hold the a DirectPlay chat message
404  */
405 typedef struct
406 {
407     DWORD               dwSize;
408     DWORD               dwFlags;
409     union
410     {                          // Message string
411         LPWSTR  lpszMessage;   // Unicode
412         LPSTR   lpszMessageA;  // ANSI
413     };    
414 } DPCHAT, FAR * LPDPCHAT;
415
416 /****************************************************************************
417  *
418  * Prototypes for DirectPlay callback functions
419  *
420  ****************************************************************************/
421
422 /*
423  * Callback for IDirectPlay2::EnumSessions
424  */
425 typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)(
426     LPCDPSESSIONDESC2   lpThisSD,
427     LPDWORD             lpdwTimeOut,
428     DWORD               dwFlags,
429     LPVOID              lpContext );
430
431 /*
432  * This flag is set on the EnumSessions callback dwFlags parameter when
433  * the time out has occurred. There will be no session data for this 
434  * callback. If *lpdwTimeOut is set to a non-zero value and the 
435  * EnumSessionsCallback function returns TRUE then EnumSessions will 
436  * continue waiting until the next timeout occurs. Timeouts are in 
437  * milliseconds.
438  */
439 #define DPESC_TIMEDOUT          0x00000001
440
441
442 /*
443  * Callback for IDirectPlay2::EnumPlayers
444  *              IDirectPlay2::EnumGroups
445  *              IDirectPlay2::EnumGroupPlayers
446  */
447 typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)(
448     DPID            dpId,
449     DWORD           dwPlayerType,
450     LPCDPNAME       lpName,
451     DWORD           dwFlags,
452     LPVOID          lpContext );
453
454
455 /*
456  * Unicode callback for DirectPlayEnumerate
457  * This callback prototype will be used if compiling
458  * for Unicode strings
459  */
460 typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)(
461     LPGUID      lpguidSP,
462     LPWSTR      lpSPName,
463     DWORD       dwMajorVersion,
464     DWORD       dwMinorVersion,
465     LPVOID      lpContext);
466
467 /*
468  * ANSI callback for DirectPlayEnumerate
469  * This callback prototype will be used if compiling
470  * for ANSI strings
471  */
472 typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)(
473     LPGUID      lpguidSP,
474     LPSTR       lpSPName,
475     DWORD       dwMajorVersion,     
476     DWORD       dwMinorVersion,
477     LPVOID      lpContext);
478
479 /*
480  * Callback for IDirectPlay3(A)::EnumConnections
481  */
482 typedef BOOL (FAR PASCAL * LPDPENUMCONNECTIONSCALLBACK)(
483     LPCGUID     lpguidSP,
484         LPVOID          lpConnection,
485         DWORD           dwConnectionSize,
486     LPCDPNAME   lpName,
487         DWORD           dwFlags,
488         LPVOID          lpContext);
489
490
491 /*
492  * API's
493  */
494
495 #ifdef UNICODE
496 #define DirectPlayEnumerate     DirectPlayEnumerateW
497 #else
498 #define DirectPlayEnumerate     DirectPlayEnumerateA
499 #endif // UNICODE
500
501 extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID );
502 extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID );
503 extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk);
504
505 /****************************************************************************
506  *
507  * IDirectPlay2 (and IDirectPlay2A) Interface
508  *
509  ****************************************************************************/
510
511 #undef INTERFACE
512 #define INTERFACE IDirectPlay2
513 DECLARE_INTERFACE_( IDirectPlay2, IUnknown )
514 {
515     /*** IUnknown methods ***/
516     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
517     STDMETHOD_(ULONG,AddRef)        (THIS)  PURE;
518     STDMETHOD_(ULONG,Release)       (THIS) PURE;
519     /*** IDirectPlay2 methods ***/
520     STDMETHOD(AddPlayerToGroup)     (THIS_ DPID, DPID) PURE;
521     STDMETHOD(Close)                (THIS) PURE;
522     STDMETHOD(CreateGroup)          (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE;
523     STDMETHOD(CreatePlayer)         (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE;
524     STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE;
525     STDMETHOD(DestroyGroup)         (THIS_ DPID) PURE;
526     STDMETHOD(DestroyPlayer)        (THIS_ DPID) PURE;
527     STDMETHOD(EnumGroupPlayers)     (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
528     STDMETHOD(EnumGroups)           (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
529     STDMETHOD(EnumPlayers)          (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
530     STDMETHOD(EnumSessions)         (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE;
531     STDMETHOD(GetCaps)              (THIS_ LPDPCAPS,DWORD) PURE;
532     STDMETHOD(GetGroupData)         (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
533     STDMETHOD(GetGroupName)         (THIS_ DPID,LPVOID,LPDWORD) PURE;
534     STDMETHOD(GetMessageCount)      (THIS_ DPID, LPDWORD) PURE;
535     STDMETHOD(GetPlayerAddress)     (THIS_ DPID,LPVOID,LPDWORD) PURE;
536     STDMETHOD(GetPlayerCaps)        (THIS_ DPID,LPDPCAPS,DWORD) PURE;
537     STDMETHOD(GetPlayerData)        (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
538     STDMETHOD(GetPlayerName)        (THIS_ DPID,LPVOID,LPDWORD) PURE;
539     STDMETHOD(GetSessionDesc)       (THIS_ LPVOID,LPDWORD) PURE;
540     STDMETHOD(Initialize)           (THIS_ LPGUID) PURE;
541     STDMETHOD(Open)                 (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
542     STDMETHOD(Receive)              (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE;
543     STDMETHOD(Send)                 (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE;
544     STDMETHOD(SetGroupData)         (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
545     STDMETHOD(SetGroupName)         (THIS_ DPID,LPDPNAME,DWORD) PURE;
546     STDMETHOD(SetPlayerData)        (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
547     STDMETHOD(SetPlayerName)        (THIS_ DPID,LPDPNAME,DWORD) PURE;
548     STDMETHOD(SetSessionDesc)       (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
549 };
550
551 /****************************************************************************
552  *
553  * IDirectPlay2 interface macros
554  *
555  ****************************************************************************/
556
557 #if !defined(__cplusplus) || defined(CINTERFACE)
558
559 #define IDirectPlay2_QueryInterface(p,a,b)          (p)->lpVtbl->QueryInterface(p,a,b)
560 #define IDirectPlay2_AddRef(p)                      (p)->lpVtbl->AddRef(p)
561 #define IDirectPlay2_Release(p)                     (p)->lpVtbl->Release(p)
562 #define IDirectPlay2_AddPlayerToGroup(p,a,b)        (p)->lpVtbl->AddPlayerToGroup(p,a,b)
563 #define IDirectPlay2_Close(p)                       (p)->lpVtbl->Close(p)
564 #define IDirectPlay2_CreateGroup(p,a,b,c,d,e)       (p)->lpVtbl->CreateGroup(p,a,b,c,d,e)
565 #define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f)    (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f)
566 #define IDirectPlay2_DeletePlayerFromGroup(p,a,b)   (p)->lpVtbl->DeletePlayerFromGroup(p,a,b)
567 #define IDirectPlay2_DestroyGroup(p,a)              (p)->lpVtbl->DestroyGroup(p,a)
568 #define IDirectPlay2_DestroyPlayer(p,a)             (p)->lpVtbl->DestroyPlayer(p,a)
569 #define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e)  (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e)
570 #define IDirectPlay2_EnumGroups(p,a,b,c,d)          (p)->lpVtbl->EnumGroups(p,a,b,c,d)
571 #define IDirectPlay2_EnumPlayers(p,a,b,c,d)         (p)->lpVtbl->EnumPlayers(p,a,b,c,d)
572 #define IDirectPlay2_EnumSessions(p,a,b,c,d,e)      (p)->lpVtbl->EnumSessions(p,a,b,c,d,e)
573 #define IDirectPlay2_GetCaps(p,a,b)                 (p)->lpVtbl->GetCaps(p,a,b)
574 #define IDirectPlay2_GetMessageCount(p,a,b)         (p)->lpVtbl->GetMessageCount(p,a,b)
575 #define IDirectPlay2_GetGroupData(p,a,b,c,d)        (p)->lpVtbl->GetGroupData(p,a,b,c,d)
576 #define IDirectPlay2_GetGroupName(p,a,b,c)          (p)->lpVtbl->GetGroupName(p,a,b,c)
577 #define IDirectPlay2_GetPlayerAddress(p,a,b,c)      (p)->lpVtbl->GetPlayerAddress(p,a,b,c)
578 #define IDirectPlay2_GetPlayerCaps(p,a,b,c)         (p)->lpVtbl->GetPlayerCaps(p,a,b,c)
579 #define IDirectPlay2_GetPlayerData(p,a,b,c,d)       (p)->lpVtbl->GetPlayerData(p,a,b,c,d)
580 #define IDirectPlay2_GetPlayerName(p,a,b,c)         (p)->lpVtbl->GetPlayerName(p,a,b,c)
581 #define IDirectPlay2_GetSessionDesc(p,a,b)          (p)->lpVtbl->GetSessionDesc(p,a,b)
582 #define IDirectPlay2_Initialize(p,a)                (p)->lpVtbl->Initialize(p,a)
583 #define IDirectPlay2_Open(p,a,b)                    (p)->lpVtbl->Open(p,a,b)
584 #define IDirectPlay2_Receive(p,a,b,c,d,e)           (p)->lpVtbl->Receive(p,a,b,c,d,e)
585 #define IDirectPlay2_Send(p,a,b,c,d,e)              (p)->lpVtbl->Send(p,a,b,c,d,e)
586 #define IDirectPlay2_SetGroupData(p,a,b,c,d)        (p)->lpVtbl->SetGroupData(p,a,b,c,d)
587 #define IDirectPlay2_SetGroupName(p,a,b,c)          (p)->lpVtbl->SetGroupName(p,a,b,c)
588 #define IDirectPlay2_SetPlayerData(p,a,b,c,d)       (p)->lpVtbl->SetPlayerData(p,a,b,c,d)
589 #define IDirectPlay2_SetPlayerName(p,a,b,c)         (p)->lpVtbl->SetPlayerName(p,a,b,c)
590 #define IDirectPlay2_SetSessionDesc(p,a,b)          (p)->lpVtbl->SetSessionDesc(p,a,b)
591
592 #else /* C++ */
593
594 #define IDirectPlay2_QueryInterface(p,a,b)          (p)->QueryInterface(a,b)
595 #define IDirectPlay2_AddRef(p)                      (p)->AddRef()
596 #define IDirectPlay2_Release(p)                     (p)->Release()
597 #define IDirectPlay2_AddPlayerToGroup(p,a,b)        (p)->AddPlayerToGroup(a,b)
598 #define IDirectPlay2_Close(p)                       (p)->Close()
599 #define IDirectPlay2_CreateGroup(p,a,b,c,d,e)       (p)->CreateGroup(a,b,c,d,e)
600 #define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f)    (p)->CreatePlayer(a,b,c,d,e,f)
601 #define IDirectPlay2_DeletePlayerFromGroup(p,a,b)   (p)->DeletePlayerFromGroup(a,b)
602 #define IDirectPlay2_DestroyGroup(p,a)              (p)->DestroyGroup(a)
603 #define IDirectPlay2_DestroyPlayer(p,a)             (p)->DestroyPlayer(a)
604 #define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e)  (p)->EnumGroupPlayers(a,b,c,d,e)
605 #define IDirectPlay2_EnumGroups(p,a,b,c,d)          (p)->EnumGroups(a,b,c,d)
606 #define IDirectPlay2_EnumPlayers(p,a,b,c,d)         (p)->EnumPlayers(a,b,c,d)
607 #define IDirectPlay2_EnumSessions(p,a,b,c,d,e)      (p)->EnumSessions(a,b,c,d,e)
608 #define IDirectPlay2_GetCaps(p,a,b)                 (p)->GetCaps(a,b)
609 #define IDirectPlay2_GetMessageCount(p,a,b)         (p)->GetMessageCount(a,b)
610 #define IDirectPlay2_GetGroupData(p,a,b,c,d)        (p)->GetGroupData(a,b,c,d)
611 #define IDirectPlay2_GetGroupName(p,a,b,c)          (p)->GetGroupName(a,b,c)
612 #define IDirectPlay2_GetPlayerAddress(p,a,b,c)      (p)->GetPlayerAddress(a,b,c)
613 #define IDirectPlay2_GetPlayerCaps(p,a,b,c)         (p)->GetPlayerCaps(a,b,c)
614 #define IDirectPlay2_GetPlayerData(p,a,b,c,d)       (p)->GetPlayerData(a,b,c,d)
615 #define IDirectPlay2_GetPlayerName(p,a,b,c)         (p)->GetPlayerName(a,b,c)
616 #define IDirectPlay2_GetSessionDesc(p,a,b)          (p)->GetSessionDesc(a,b)
617 #define IDirectPlay2_Initialize(p,a)                (p)->Initialize(a)
618 #define IDirectPlay2_Open(p,a,b)                    (p)->Open(a,b)
619 #define IDirectPlay2_Receive(p,a,b,c,d,e)           (p)->Receive(a,b,c,d,e)
620 #define IDirectPlay2_Send(p,a,b,c,d,e)              (p)->Send(a,b,c,d,e)
621 #define IDirectPlay2_SetGroupData(p,a,b,c,d)        (p)->SetGroupData(a,b,c,d)
622 #define IDirectPlay2_SetGroupName(p,a,b,c)          (p)->SetGroupName(a,b,c)
623 #define IDirectPlay2_SetPlayerData(p,a,b,c,d)       (p)->SetPlayerData(a,b,c,d)
624 #define IDirectPlay2_SetPlayerName(p,a,b,c)         (p)->SetPlayerName(a,b,c)
625 #define IDirectPlay2_SetSessionDesc(p,a,b)          (p)->SetSessionDesc(a,b)
626
627 #endif
628
629 /****************************************************************************
630  *
631  * IDirectPlay3 (and IDirectPlay3A) Interface
632  *
633  ****************************************************************************/
634
635 #undef INTERFACE
636 #define INTERFACE IDirectPlay3
637 DECLARE_INTERFACE_( IDirectPlay3, IDirectPlay2 )
638 {
639     /*** IUnknown methods ***/
640     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
641     STDMETHOD_(ULONG,AddRef)        (THIS)  PURE;
642     STDMETHOD_(ULONG,Release)       (THIS) PURE;
643     /*** IDirectPlay2 methods ***/
644     STDMETHOD(AddPlayerToGroup)     (THIS_ DPID, DPID) PURE;
645     STDMETHOD(Close)                (THIS) PURE;
646     STDMETHOD(CreateGroup)          (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE;
647     STDMETHOD(CreatePlayer)         (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE;
648     STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE;
649     STDMETHOD(DestroyGroup)         (THIS_ DPID) PURE;
650     STDMETHOD(DestroyPlayer)        (THIS_ DPID) PURE;
651     STDMETHOD(EnumGroupPlayers)     (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
652     STDMETHOD(EnumGroups)           (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
653     STDMETHOD(EnumPlayers)          (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
654     STDMETHOD(EnumSessions)         (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE;
655     STDMETHOD(GetCaps)              (THIS_ LPDPCAPS,DWORD) PURE;
656     STDMETHOD(GetGroupData)         (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
657     STDMETHOD(GetGroupName)         (THIS_ DPID,LPVOID,LPDWORD) PURE;
658     STDMETHOD(GetMessageCount)      (THIS_ DPID, LPDWORD) PURE;
659     STDMETHOD(GetPlayerAddress)     (THIS_ DPID,LPVOID,LPDWORD) PURE;
660     STDMETHOD(GetPlayerCaps)        (THIS_ DPID,LPDPCAPS,DWORD) PURE;
661     STDMETHOD(GetPlayerData)        (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
662     STDMETHOD(GetPlayerName)        (THIS_ DPID,LPVOID,LPDWORD) PURE;
663     STDMETHOD(GetSessionDesc)       (THIS_ LPVOID,LPDWORD) PURE;
664     STDMETHOD(Initialize)           (THIS_ LPGUID) PURE;
665     STDMETHOD(Open)                 (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
666     STDMETHOD(Receive)              (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE;
667     STDMETHOD(Send)                 (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE;
668     STDMETHOD(SetGroupData)         (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
669     STDMETHOD(SetGroupName)         (THIS_ DPID,LPDPNAME,DWORD) PURE;
670     STDMETHOD(SetPlayerData)        (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
671     STDMETHOD(SetPlayerName)        (THIS_ DPID,LPDPNAME,DWORD) PURE;
672     STDMETHOD(SetSessionDesc)       (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
673     /*** IDirectPlay3 methods ***/
674     STDMETHOD(AddGroupToGroup)      (THIS_ DPID, DPID) PURE;
675     STDMETHOD(CreateGroupInGroup)   (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE;
676     STDMETHOD(DeleteGroupFromGroup)     (THIS_ DPID,DPID) PURE; 
677     STDMETHOD(EnumConnections)          (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE;
678     STDMETHOD(EnumGroupsInGroup)        (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
679         STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE;
680         STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE;
681     STDMETHOD(SecureOpen)           (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE;
682         STDMETHOD(SendChatMessage)      (THIS_ DPID,DPID,DWORD,LPDPCHAT);
683         STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE;
684         STDMETHOD(StartSession)         (THIS_ DWORD,DPID);
685         STDMETHOD(GetGroupFlags)        (THIS_ DPID,LPDWORD);
686         STDMETHOD(GetGroupParent)       (THIS_ DPID,LPDPID);
687         STDMETHOD(GetPlayerAccount)     (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE;
688         STDMETHOD(GetPlayerFlags)       (THIS_ DPID,LPDWORD);
689 };
690
691 /****************************************************************************
692  *
693  * IDirectPlay3 interface macros
694  *
695  ****************************************************************************/
696
697 #if !defined(__cplusplus) || defined(CINTERFACE)
698
699 #define IDirectPlay3_QueryInterface(p,a,b)          (p)->lpVtbl->QueryInterface(p,a,b)
700 #define IDirectPlay3_AddRef(p)                      (p)->lpVtbl->AddRef(p)
701 #define IDirectPlay3_Release(p)                     (p)->lpVtbl->Release(p)
702 #define IDirectPlay3_AddPlayerToGroup(p,a,b)        (p)->lpVtbl->AddPlayerToGroup(p,a,b)
703 #define IDirectPlay3_Close(p)                       (p)->lpVtbl->Close(p)
704 #define IDirectPlay3_CreateGroup(p,a,b,c,d,e)       (p)->lpVtbl->CreateGroup(p,a,b,c,d,e)
705 #define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f)    (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f)
706 #define IDirectPlay3_DeletePlayerFromGroup(p,a,b)   (p)->lpVtbl->DeletePlayerFromGroup(p,a,b)
707 #define IDirectPlay3_DestroyGroup(p,a)              (p)->lpVtbl->DestroyGroup(p,a)
708 #define IDirectPlay3_DestroyPlayer(p,a)             (p)->lpVtbl->DestroyPlayer(p,a)
709 #define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e)  (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e)
710 #define IDirectPlay3_EnumGroups(p,a,b,c,d)          (p)->lpVtbl->EnumGroups(p,a,b,c,d)
711 #define IDirectPlay3_EnumPlayers(p,a,b,c,d)         (p)->lpVtbl->EnumPlayers(p,a,b,c,d)
712 #define IDirectPlay3_EnumSessions(p,a,b,c,d,e)      (p)->lpVtbl->EnumSessions(p,a,b,c,d,e)
713 #define IDirectPlay3_GetCaps(p,a,b)                 (p)->lpVtbl->GetCaps(p,a,b)
714 #define IDirectPlay3_GetMessageCount(p,a,b)         (p)->lpVtbl->GetMessageCount(p,a,b)
715 #define IDirectPlay3_GetGroupData(p,a,b,c,d)        (p)->lpVtbl->GetGroupData(p,a,b,c,d)
716 #define IDirectPlay3_GetGroupName(p,a,b,c)          (p)->lpVtbl->GetGroupName(p,a,b,c)
717 #define IDirectPlay3_GetPlayerAddress(p,a,b,c)      (p)->lpVtbl->GetPlayerAddress(p,a,b,c)
718 #define IDirectPlay3_GetPlayerCaps(p,a,b,c)         (p)->lpVtbl->GetPlayerCaps(p,a,b,c)
719 #define IDirectPlay3_GetPlayerData(p,a,b,c,d)       (p)->lpVtbl->GetPlayerData(p,a,b,c,d)
720 #define IDirectPlay3_GetPlayerName(p,a,b,c)         (p)->lpVtbl->GetPlayerName(p,a,b,c)
721 #define IDirectPlay3_GetSessionDesc(p,a,b)          (p)->lpVtbl->GetSessionDesc(p,a,b)
722 #define IDirectPlay3_Initialize(p,a)                (p)->lpVtbl->Initialize(p,a)
723 #define IDirectPlay3_Open(p,a,b)                    (p)->lpVtbl->Open(p,a,b)
724 #define IDirectPlay3_Receive(p,a,b,c,d,e)           (p)->lpVtbl->Receive(p,a,b,c,d,e)
725 #define IDirectPlay3_Send(p,a,b,c,d,e)              (p)->lpVtbl->Send(p,a,b,c,d,e)
726 #define IDirectPlay3_SetGroupData(p,a,b,c,d)        (p)->lpVtbl->SetGroupData(p,a,b,c,d)
727 #define IDirectPlay3_SetGroupName(p,a,b,c)          (p)->lpVtbl->SetGroupName(p,a,b,c)
728 #define IDirectPlay3_SetPlayerData(p,a,b,c,d)       (p)->lpVtbl->SetPlayerData(p,a,b,c,d)
729 #define IDirectPlay3_SetPlayerName(p,a,b,c)         (p)->lpVtbl->SetPlayerName(p,a,b,c)
730 #define IDirectPlay3_SetSessionDesc(p,a,b)          (p)->lpVtbl->SetSessionDesc(p,a,b)
731 #define IDirectPlay3_AddGroupToGroup(p,a,b)             (p)->lpVtbl->AddGroupToGroup(p,a,b)
732 #define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f)
733 #define IDirectPlay3_DeleteGroupFromGroup(p,a,b)        (p)->lpVtbl->DeleteGroupFromGroup(p,a,b)
734 #define IDirectPlay3_EnumConnections(p,a,b,c,d)         (p)->lpVtbl->EnumConnections(p,a,b,c,d)
735 #define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e)
736 #define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d)
737 #define IDirectPlay3_InitializeConnection(p,a,b)        (p)->lpVtbl->InitializeConnection(p,a,b)
738 #define IDirectPlay3_SecureOpen(p,a,b,c,d)          (p)->lpVtbl->SecureOpen(p,a,b,c,d)
739 #define IDirectPlay3_SendChatMessage(p,a,b,c,d)     (p)->lpVtbl->SendChatMessage(p,a,b,c,d)
740 #define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c)
741 #define IDirectPlay3_StartSession(p,a,b)            (p)->lpVtbl->StartSession(p,a,b)
742 #define IDirectPlay3_GetGroupFlags(p,a,b)           (p)->lpVtbl->GetGroupFlags(p,a,b)
743 #define IDirectPlay3_GetGroupParent(p,a,b)          (p)->lpVtbl->GetGroupParent(p,a,b)
744 #define IDirectPlay3_GetPlayerAccount(p,a,b,c,d)    (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d)
745 #define IDirectPlay3_GetPlayerFlags(p,a,b)          (p)->lpVtbl->GetPlayerFlags(p,a,b)
746
747 #else /* C++ */
748
749 #define IDirectPlay3_QueryInterface(p,a,b)          (p)->QueryInterface(a,b)
750 #define IDirectPlay3_AddRef(p)                      (p)->AddRef()
751 #define IDirectPlay3_Release(p)                     (p)->Release()
752 #define IDirectPlay3_AddPlayerToGroup(p,a,b)        (p)->AddPlayerToGroup(a,b)
753 #define IDirectPlay3_Close(p)                       (p)->Close()
754 #define IDirectPlay3_CreateGroup(p,a,b,c,d,e)       (p)->CreateGroup(a,b,c,d,e)
755 #define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f)    (p)->CreatePlayer(a,b,c,d,e,f)
756 #define IDirectPlay3_DeletePlayerFromGroup(p,a,b)   (p)->DeletePlayerFromGroup(a,b)
757 #define IDirectPlay3_DestroyGroup(p,a)              (p)->DestroyGroup(a)
758 #define IDirectPlay3_DestroyPlayer(p,a)             (p)->DestroyPlayer(a)
759 #define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e)  (p)->EnumGroupPlayers(a,b,c,d,e)
760 #define IDirectPlay3_EnumGroups(p,a,b,c,d)          (p)->EnumGroups(a,b,c,d)
761 #define IDirectPlay3_EnumPlayers(p,a,b,c,d)         (p)->EnumPlayers(a,b,c,d)
762 #define IDirectPlay3_EnumSessions(p,a,b,c,d,e)      (p)->EnumSessions(a,b,c,d,e)
763 #define IDirectPlay3_GetCaps(p,a,b)                 (p)->GetCaps(a,b)
764 #define IDirectPlay3_GetMessageCount(p,a,b)         (p)->GetMessageCount(a,b)
765 #define IDirectPlay3_GetGroupData(p,a,b,c,d)        (p)->GetGroupData(a,b,c,d)
766 #define IDirectPlay3_GetGroupName(p,a,b,c)          (p)->GetGroupName(a,b,c)
767 #define IDirectPlay3_GetPlayerAddress(p,a,b,c)      (p)->GetPlayerAddress(a,b,c)
768 #define IDirectPlay3_GetPlayerCaps(p,a,b,c)         (p)->GetPlayerCaps(a,b,c)
769 #define IDirectPlay3_GetPlayerData(p,a,b,c,d)       (p)->GetPlayerData(a,b,c,d)
770 #define IDirectPlay3_GetPlayerName(p,a,b,c)         (p)->GetPlayerName(a,b,c)
771 #define IDirectPlay3_GetSessionDesc(p,a,b)          (p)->GetSessionDesc(a,b)
772 #define IDirectPlay3_Initialize(p,a)                (p)->Initialize(a)
773 #define IDirectPlay3_Open(p,a,b)                    (p)->Open(a,b)
774 #define IDirectPlay3_Receive(p,a,b,c,d,e)           (p)->Receive(a,b,c,d,e)
775 #define IDirectPlay3_Send(p,a,b,c,d,e)              (p)->Send(a,b,c,d,e)
776 #define IDirectPlay3_SetGroupData(p,a,b,c,d)        (p)->SetGroupData(a,b,c,d)
777 #define IDirectPlay3_SetGroupName(p,a,b,c)          (p)->SetGroupName(a,b,c)
778 #define IDirectPlay3_SetPlayerData(p,a,b,c,d)       (p)->SetPlayerData(a,b,c,d)
779 #define IDirectPlay3_SetPlayerName(p,a,b,c)         (p)->SetPlayerName(a,b,c)
780 #define IDirectPlay3_SetSessionDesc(p,a,b)          (p)->SetSessionDesc(a,b)
781 #define IDirectPlay3_AddGroupToGroup(p,a,b)             (p)->AddGroupToGroup(a,b)
782 #define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f)
783 #define IDirectPlay3_DeleteGroupFromGroup(p,a,b)        (p)->DeleteGroupFromGroup(a,b)
784 #define IDirectPlay3_EnumConnections(p,a,b,c,d)     (p)->EnumConnections(a,b,c,d)
785 #define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e)
786 #define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d)
787 #define IDirectPlay3_InitializeConnection(p,a,b)    (p)->InitializeConnection(a,b)
788 #define IDirectPlay3_SecureOpen(p,a,b,c,d)          (p)->SecureOpen(a,b,c,d)
789 #define IDirectPlay3_SendChatMessage(p,a,b,c,d)     (p)->SendChatMessage(a,b,c,d)
790 #define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c)
791 #define IDirectPlay3_StartSession(p,a,b)            (p)->StartSession(a,b)
792 #define IDirectPlay3_GetGroupFlags(p,a,b)           (p)->GetGroupFlags(a,b)
793 #define IDirectPlay3_GetGroupParent(p,a,b)          (p)->GetGroupParent(a,b)
794 #define IDirectPlay3_GetPlayerAccount(p,a,b,c,d)    (p)->GetPlayerAccount(a,b,c,d)
795 #define IDirectPlay3_GetPlayerFlags(p,a,b)          (p)->GetPlayerFlags(a,b)
796
797 #endif
798
799 /****************************************************************************
800  *
801  * EnumConnections API flags
802  *
803  ****************************************************************************/
804
805 /*
806  * Enumerate Service Providers
807  */
808 #define DPCONNECTION_DIRECTPLAY      0x00000001
809
810 /*
811  * Enumerate Lobby Providers
812  */
813 #define DPCONNECTION_DIRECTPLAYLOBBY 0x00000002
814
815
816 /****************************************************************************
817  *
818  * EnumPlayers API flags
819  *
820  ****************************************************************************/
821
822 /*
823  * Enumerate all players in the current session
824  */
825 #define DPENUMPLAYERS_ALL           0x00000000
826 #define DPENUMGROUPS_ALL            DPENUMPLAYERS_ALL
827
828
829 /*
830  * Enumerate only local (created by this application) players
831  * or groups
832  */
833 #define DPENUMPLAYERS_LOCAL         0x00000008
834 #define DPENUMGROUPS_LOCAL                      DPENUMPLAYERS_LOCAL
835
836 /*
837  * Enumerate only remote (non-local) players
838  * or groups
839  */
840 #define DPENUMPLAYERS_REMOTE        0x00000010
841 #define DPENUMGROUPS_REMOTE                     DPENUMPLAYERS_REMOTE
842
843 /*
844  * Enumerate groups along with the players
845  */
846 #define DPENUMPLAYERS_GROUP         0x00000020
847
848 /*
849  * Enumerate players or groups in another session 
850  * (must supply lpguidInstance)
851  */
852 #define DPENUMPLAYERS_SESSION       0x00000080
853 #define DPENUMGROUPS_SESSION            DPENUMPLAYERS_SESSION
854
855 /*
856  * Enumerate server players
857  */
858 #define DPENUMPLAYERS_SERVERPLAYER  0x00000100
859
860 /*
861  * Enumerate spectator players
862  */
863 #define DPENUMPLAYERS_SPECTATOR     0x00000200
864
865 /*
866  * Enumerate shortcut groups
867  */
868 #define DPENUMGROUPS_SHORTCUT       0x00000400
869
870 /*
871  * Enumerate staging area groups
872  */
873 #define DPENUMGROUPS_STAGINGAREA    0x00000800
874
875 /****************************************************************************
876  *
877  * CreatePlayer API flags
878  *
879  ****************************************************************************/
880
881 /*
882  * This flag indicates that this player should be designated
883  * the server player. The app should specify this at CreatePlayer.
884  */
885 #define DPPLAYER_SERVERPLAYER           DPENUMPLAYERS_SERVERPLAYER
886
887 /*
888  * This flag indicates that this player should be designated
889  * a spectator. The app should specify this at CreatePlayer.
890  */
891 #define DPPLAYER_SPECTATOR              DPENUMPLAYERS_SPECTATOR
892
893 /*
894  * This flag indicates that this player was created locally.
895  * (returned from GetPlayerFlags)
896  */
897 #define DPPLAYER_LOCAL                  DPENUMPLAYERS_LOCAL
898
899 /****************************************************************************
900  *
901  * CreateGroup API flags
902  *
903  ****************************************************************************/
904
905
906 /*
907  * This flag indicates that the StartSession can be called on the group.
908  * The app should specify this at CreateGroup, or CreateGroupInGroup.
909  */
910 #define DPGROUP_STAGINGAREA             DPENUMGROUPS_STAGINGAREA
911
912 /*
913  * This flag indicates that this group was created locally.
914  * (returned from GetGroupFlags)
915  */
916 #define DPGROUP_LOCAL                   DPENUMGROUPS_LOCAL
917
918 /****************************************************************************
919  *
920  * EnumSessions API flags
921  *
922  ****************************************************************************/
923
924 /*
925  * Enumerate sessions which can be joined
926  */
927 #define DPENUMSESSIONS_AVAILABLE    0x00000001 
928
929 /*
930  * Enumerate all sessions even if they can't be joined.
931  */
932 #define DPENUMSESSIONS_ALL          0x00000002
933
934
935
936
937 /*
938  * Start an asynchronous enum sessions
939  */
940  #define DPENUMSESSIONS_ASYNC           0x00000010
941
942 /*
943  * Stop an asynchronous enum sessions
944  */
945  #define DPENUMSESSIONS_STOPASYNC       0x00000020
946  
947 /*
948  * Enumerate sessions even if they require a password
949  */
950  #define DPENUMSESSIONS_PASSWORDREQUIRED        0x00000040
951
952 /*
953  * Return status about progress of enumeration instead of
954  * showing any status dialogs.
955  */
956  #define DPENUMSESSIONS_RETURNSTATUS 0x00000080
957
958 /****************************************************************************
959  *
960  * GetCaps and GetPlayerCaps API flags
961  *
962  ****************************************************************************/
963
964 /*
965  * The latency returned should be for guaranteed message sending.
966  * Default is non-guaranteed messaging.
967  */
968 #define DPGETCAPS_GUARANTEED        0x00000001 
969
970  
971 /****************************************************************************
972  *
973  * GetGroupData, GetPlayerData API flags
974  * Remote and local Group/Player data is maintained separately. 
975  * Default is DPGET_REMOTE.
976  *
977  ****************************************************************************/
978
979 /*
980  * Get the remote data (set by any DirectPlay object in
981  * the session using DPSET_REMOTE)
982  */
983 #define DPGET_REMOTE                0x00000000
984
985 /*
986  * Get the local data (set by this DirectPlay object 
987  * using DPSET_LOCAL)
988  */
989 #define DPGET_LOCAL                 0x00000001
990
991
992 /****************************************************************************
993  *
994  * Open API flags
995  *
996  ****************************************************************************/
997
998 /*
999  * Join the session that is described by the DPSESSIONDESC2 structure
1000  */
1001 #define DPOPEN_JOIN                 0x00000001
1002
1003 /*
1004  * Create a new session as described by the DPSESSIONDESC2 structure
1005  */
1006 #define DPOPEN_CREATE               0x00000002
1007
1008 /*
1009  * Return status about progress of open instead of showing
1010  * any status dialogs.
1011  */
1012  #define DPOPEN_RETURNSTATUS            DPENUMSESSIONS_RETURNSTATUS
1013
1014 /****************************************************************************
1015  *
1016  * DPLCONNECTION flags
1017  *
1018  ****************************************************************************/
1019
1020 /*
1021  * This application should create a new session as
1022  * described by the DPSESIONDESC structure
1023  */
1024 #define DPLCONNECTION_CREATESESSION                                     DPOPEN_CREATE
1025
1026 /*
1027  * This application should join the session described by 
1028  * the DPSESIONDESC structure with the lpAddress data
1029  */
1030 #define DPLCONNECTION_JOINSESSION                                       DPOPEN_JOIN
1031
1032 /****************************************************************************
1033  *
1034  * Receive API flags
1035  * Default is DPRECEIVE_ALL
1036  *
1037  ****************************************************************************/
1038
1039 /*
1040  * Get the first message in the queue
1041  */
1042 #define DPRECEIVE_ALL               0x00000001
1043
1044 /*
1045  * Get the first message in the queue directed to a specific player 
1046  */
1047 #define DPRECEIVE_TOPLAYER          0x00000002
1048
1049 /*
1050  * Get the first message in the queue from a specific player
1051  */
1052 #define DPRECEIVE_FROMPLAYER        0x00000004
1053
1054 /*
1055  * Get the message but don't remove it from the queue
1056  */
1057 #define DPRECEIVE_PEEK              0x00000008
1058
1059
1060 /****************************************************************************
1061  *
1062  * Send API flags
1063  *
1064  ****************************************************************************/
1065
1066 /*
1067  * Send the message using a guaranteed send method.
1068  * Default is non-guaranteed.
1069  */
1070 #define DPSEND_GUARANTEED           0x00000001
1071
1072
1073 /*
1074  * This flag is obsolete. It is ignored by DirectPlay
1075  */
1076 #define DPSEND_HIGHPRIORITY         0x00000002
1077
1078 /*
1079  * This flag is obsolete. It is ignored by DirectPlay
1080  */
1081 #define DPSEND_OPENSTREAM           0x00000008
1082
1083 /*
1084  * This flag is obsolete. It is ignored by DirectPlay
1085  */
1086 #define DPSEND_CLOSESTREAM          0x00000010
1087
1088 /*
1089  * Send the message digitally signed to ensure authenticity.
1090  */
1091 #define DPSEND_SIGNED               0x00000020
1092
1093 /*
1094  * Send the message with encryption to ensure privacy.
1095  */
1096 #define DPSEND_ENCRYPTED            0x00000040
1097
1098
1099 /****************************************************************************
1100  *
1101  * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
1102  * SetSessionDesc API flags.
1103  * Default is DPSET_REMOTE.
1104  *
1105  ****************************************************************************/
1106
1107 /* 
1108  * Propagate the data to all players in the session
1109  */
1110 #define DPSET_REMOTE                0x00000000
1111
1112 /*
1113  * Do not propagate the data to other players
1114  */
1115 #define DPSET_LOCAL                 0x00000001
1116
1117 /*
1118  * Used with DPSET_REMOTE, use guaranteed message send to
1119  * propagate the data
1120  */
1121 #define DPSET_GUARANTEED            0x00000002
1122
1123
1124 /****************************************************************************
1125  *
1126  * DirectPlay system messages and message data structures
1127  *
1128  * All system message come 'From' player DPID_SYSMSG.  To determine what type 
1129  * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check
1130  * the dwType member against one of the following DPSYS_xxx constants. Once
1131  * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
1132  * structures to access the data of the message.
1133  *
1134  ****************************************************************************/
1135
1136 /*
1137  * A new player or group has been created in the session
1138  * Use DPMSG_CREATEPLAYERORGROUP.  Check dwPlayerType to see if it
1139  * is a player or a group.
1140  */
1141 #define DPSYS_CREATEPLAYERORGROUP   0x0003  
1142
1143 /*
1144  * A player has been deleted from the session
1145  * Use DPMSG_DESTROYPLAYERORGROUP
1146  */
1147 #define DPSYS_DESTROYPLAYERORGROUP  0x0005  
1148
1149 /*
1150  * A player has been added to a group
1151  * Use DPMSG_ADDPLAYERTOGROUP
1152  */
1153 #define DPSYS_ADDPLAYERTOGROUP      0x0007  
1154
1155 /*
1156  * A player has been removed from a group
1157  * Use DPMSG_DELETEPLAYERFROMGROUP
1158  */
1159 #define DPSYS_DELETEPLAYERFROMGROUP 0x0021  
1160
1161 /*
1162  * This DirectPlay object lost its connection with all the
1163  * other players in the session.
1164  * Use DPMSG_SESSIONLOST.
1165  */
1166 #define DPSYS_SESSIONLOST           0x0031
1167
1168 /*
1169  * The current host has left the session.
1170  * This DirectPlay object is now the host.
1171  * Use DPMSG_HOST.
1172  */
1173 #define DPSYS_HOST                  0x0101
1174
1175 /*
1176  * The remote data associated with a player or
1177  * group has changed. Check dwPlayerType to see
1178  * if it is a player or a group
1179  * Use DPMSG_SETPLAYERORGROUPDATA
1180  */
1181 #define DPSYS_SETPLAYERORGROUPDATA  0x0102
1182
1183 /*
1184  * The name of a player or group has changed.
1185  * Check dwPlayerType to see if it is a player
1186  * or a group.
1187  * Use DPMSG_SETPLAYERORGROUPNAME
1188  */
1189 #define DPSYS_SETPLAYERORGROUPNAME  0x0103
1190
1191 /*
1192  * The session description has changed.
1193  * Use DPMSG_SETSESSIONDESC
1194  */
1195 #define DPSYS_SETSESSIONDESC        0x0104
1196
1197 /*
1198  * A group has been added to a group
1199  * Use DPMSG_ADDGROUPTOGROUP
1200  */
1201 #define DPSYS_ADDGROUPTOGROUP           0x0105  
1202
1203 /*
1204  * A group has been removed from a group
1205  * Use DPMSG_DELETEGROUPFROMGROUP
1206  */
1207 #define DPSYS_DELETEGROUPFROMGROUP      0x0106
1208
1209 /*
1210  * A secure player-player message has arrived.
1211  * Use DPMSG_SECUREMESSAGE
1212  */
1213 #define DPSYS_SECUREMESSAGE         0x0107
1214
1215 /*
1216  * Start a new session.
1217  * Use DPMSG_STARTSESSION
1218  */
1219 #define DPSYS_STARTSESSION          0x0108
1220
1221 /*
1222  * A chat message has arrived
1223  * Use DPMSG_CHAT
1224  */
1225 #define DPSYS_CHAT                  0x0109
1226
1227 /*
1228  * Used in the dwPlayerType field to indicate if it applies to a group
1229  * or a player
1230  */
1231 #define DPPLAYERTYPE_GROUP          0x00000000
1232 #define DPPLAYERTYPE_PLAYER         0x00000001
1233
1234
1235 /*
1236  * DPMSG_GENERIC
1237  * Generic message structure used to identify the message type.
1238  */
1239 typedef struct
1240 {
1241     DWORD       dwType;         // Message type
1242 } DPMSG_GENERIC, FAR *LPDPMSG_GENERIC;
1243
1244 /*
1245  * DPMSG_CREATEPLAYERORGROUP
1246  * System message generated when a new player or group
1247  * created in the session with information about it.
1248  */
1249 typedef struct
1250 {
1251     DWORD       dwType;         // Message type
1252     DWORD       dwPlayerType;   // Is it a player or group
1253     DPID        dpId;           // ID of the player or group
1254     DWORD       dwCurrentPlayers;   // current # players & groups in session
1255     LPVOID      lpData;         // pointer to remote data
1256     DWORD       dwDataSize;     // size of remote data
1257     DPNAME      dpnName;        // structure with name info
1258         // the following fields are only available when using
1259         // the IDirectPlay3 interface or greater
1260     DPID            dpIdParent;     // id of parent group
1261         DWORD           dwFlags;                // player or group flags
1262 } DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP;
1263
1264 /*
1265  * DPMSG_DESTROYPLAYERORGROUP
1266  * System message generated when a player or group is being
1267  * destroyed in the session with information about it.
1268  */
1269 typedef struct
1270 {
1271     DWORD       dwType;         // Message type
1272     DWORD       dwPlayerType;   // Is it a player or group
1273     DPID        dpId;           // player ID being deleted
1274     LPVOID      lpLocalData;    // copy of players local data
1275     DWORD       dwLocalDataSize; // sizeof local data
1276     LPVOID      lpRemoteData;   // copy of players remote data
1277     DWORD       dwRemoteDataSize; // sizeof remote data
1278         // the following fields are only available when using
1279         // the IDirectPlay3 interface or greater
1280     DPNAME      dpnName;        // structure with name info
1281     DPID            dpIdParent;     // id of parent group       
1282         DWORD           dwFlags;                // player or group flags
1283 } DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP;
1284
1285 /*
1286  * DPMSG_ADDPLAYERTOGROUP
1287  * System message generated when a player is being added
1288  * to a group.
1289  */
1290 typedef struct
1291 {
1292     DWORD       dwType;         // Message type
1293     DPID        dpIdGroup;      // group ID being added to
1294     DPID        dpIdPlayer;     // player ID being added
1295 } DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP;
1296
1297 /*
1298  * DPMSG_DELETEPLAYERFROMGROUP
1299  * System message generated when a player is being
1300  * removed from a group
1301  */
1302 typedef DPMSG_ADDPLAYERTOGROUP          DPMSG_DELETEPLAYERFROMGROUP;
1303 typedef DPMSG_DELETEPLAYERFROMGROUP     FAR *LPDPMSG_DELETEPLAYERFROMGROUP;
1304
1305 /*
1306  * DPMSG_ADDGROUPTOGROUP
1307  * System message generated when a group is being added
1308  * to a group.
1309  */
1310 typedef struct
1311 {
1312     DWORD       dwType;         // Message type
1313     DPID        dpIdParentGroup; // group ID being added to
1314     DPID        dpIdGroup;     // group ID being added
1315 } DPMSG_ADDGROUPTOGROUP, FAR *LPDPMSG_ADDGROUPTOGROUP;
1316
1317 /*
1318  * DPMSG_DELETEGROUPFROMGROUP
1319  * System message generated when a GROUP is being
1320  * removed from a group
1321  */
1322 typedef DPMSG_ADDGROUPTOGROUP          DPMSG_DELETEGROUPFROMGROUP;
1323 typedef DPMSG_DELETEGROUPFROMGROUP     FAR *LPDPMSG_DELETEGROUPFROMGROUP;
1324
1325 /*
1326  * DPMSG_SETPLAYERORGROUPDATA
1327  * System message generated when remote data for a player or
1328  * group has changed.
1329  */
1330 typedef struct
1331 {
1332     DWORD       dwType;         // Message type
1333     DWORD       dwPlayerType;   // Is it a player or group
1334     DPID        dpId;           // ID of player or group
1335     LPVOID      lpData;         // pointer to remote data
1336     DWORD       dwDataSize;     // size of remote data
1337 } DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA;
1338
1339 /*
1340  * DPMSG_SETPLAYERORGROUPNAME
1341  * System message generated when the name of a player or
1342  * group has changed.
1343  */
1344 typedef struct
1345 {
1346     DWORD       dwType;         // Message type
1347     DWORD       dwPlayerType;   // Is it a player or group
1348     DPID        dpId;           // ID of player or group
1349     DPNAME      dpnName;        // structure with new name info
1350 } DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME;
1351
1352 /*
1353  * DPMSG_SETSESSIONDESC
1354  * System message generated when session desc has changed
1355  */
1356 typedef struct
1357 {
1358     DWORD           dwType;     // Message type
1359     DPSESSIONDESC2  dpDesc;     // Session desc
1360 } DPMSG_SETSESSIONDESC, FAR *LPDPMSG_SETSESSIONDESC;
1361
1362 /*
1363  * DPMSG_HOST
1364  * System message generated when the host has migrated to this
1365  * DirectPlay object.
1366  *
1367  */
1368 typedef DPMSG_GENERIC       DPMSG_HOST;
1369 typedef DPMSG_HOST          FAR *LPDPMSG_HOST;
1370
1371 /*
1372  * DPMSG_SESSIONLOST
1373  * System message generated when the connection to the session is lost.
1374  *
1375  */
1376 typedef DPMSG_GENERIC       DPMSG_SESSIONLOST;
1377 typedef DPMSG_SESSIONLOST   FAR *LPDPMSG_SESSIONLOST;
1378
1379 /*
1380  * DPMSG_SECUREMESSAGE
1381  * System message generated when a player requests a secure send
1382  */
1383 typedef struct 
1384 {
1385     DWORD               dwType;         // Message Type
1386     DWORD               dwFlags;        // Signed/Encrypted
1387     DPID        dpIdFrom;       // ID of Sending Player
1388     LPVOID              lpData;         // Player message
1389     DWORD               dwDataSize;     // Size of player message
1390 } DPMSG_SECUREMESSAGE, FAR *LPDPMSG_SECUREMESSAGE;
1391
1392 /*
1393  * DPMSG_STARTSESSION
1394  * System message containing all information required to 
1395  * start a new session
1396  */
1397 typedef struct
1398 {
1399     DWORD              dwType;     // Message type
1400     LPDPLCONNECTION    lpConn;     // DPLCONNECTION structure
1401 } DPMSG_STARTSESSION, FAR *LPDPMSG_STARTSESSION;
1402
1403 /*
1404  * DPMSG_CHAT
1405  * System message containing a chat message
1406  */
1407 typedef struct
1408 {
1409     DWORD              dwType;        // Message type
1410     DWORD              dwFlags;       // Message flags
1411     DPID               idFromPlayer;  // ID of the Sending Player
1412     DPID               idToPlayer;    // ID of the To Player
1413     DPID               idToGroup;     // ID of the To Group
1414     LPDPCHAT           lpChat;        // Pointer to a structure containing the chat message
1415 } DPMSG_CHAT, FAR *LPDPMSG_CHAT;
1416
1417 /****************************************************************************
1418  *
1419  * DIRECTPLAY ERRORS
1420  *
1421  * Errors are represented by negative values and cannot be combined.
1422  *
1423  ****************************************************************************/
1424 #define DP_OK                           S_OK
1425 #define DPERR_ALREADYINITIALIZED        MAKE_DPHRESULT(   5 )
1426 #define DPERR_ACCESSDENIED              MAKE_DPHRESULT(  10 )
1427 #define DPERR_ACTIVEPLAYERS             MAKE_DPHRESULT(  20 )
1428 #define DPERR_BUFFERTOOSMALL            MAKE_DPHRESULT(  30 )
1429 #define DPERR_CANTADDPLAYER             MAKE_DPHRESULT(  40 )
1430 #define DPERR_CANTCREATEGROUP           MAKE_DPHRESULT(  50 )
1431 #define DPERR_CANTCREATEPLAYER          MAKE_DPHRESULT(  60 )
1432 #define DPERR_CANTCREATESESSION         MAKE_DPHRESULT(  70 )
1433 #define DPERR_CAPSNOTAVAILABLEYET       MAKE_DPHRESULT(  80 )
1434 #define DPERR_EXCEPTION                 MAKE_DPHRESULT(  90 )
1435 #define DPERR_GENERIC                   E_FAIL
1436 #define DPERR_INVALIDFLAGS              MAKE_DPHRESULT( 120 )
1437 #define DPERR_INVALIDOBJECT             MAKE_DPHRESULT( 130 )
1438 #define DPERR_INVALIDPARAM              E_INVALIDARG
1439 #define DPERR_INVALIDPARAMS             DPERR_INVALIDPARAM
1440 #define DPERR_INVALIDPLAYER             MAKE_DPHRESULT( 150 )
1441 #define DPERR_INVALIDGROUP              MAKE_DPHRESULT( 155 )
1442 #define DPERR_NOCAPS                    MAKE_DPHRESULT( 160 )
1443 #define DPERR_NOCONNECTION              MAKE_DPHRESULT( 170 )
1444 #define DPERR_NOMEMORY                  E_OUTOFMEMORY
1445 #define DPERR_OUTOFMEMORY               DPERR_NOMEMORY
1446 #define DPERR_NOMESSAGES                MAKE_DPHRESULT( 190 )
1447 #define DPERR_NONAMESERVERFOUND         MAKE_DPHRESULT( 200 )
1448 #define DPERR_NOPLAYERS                 MAKE_DPHRESULT( 210 )
1449 #define DPERR_NOSESSIONS                MAKE_DPHRESULT( 220 )
1450 #define DPERR_PENDING                                   E_PENDING
1451 #define DPERR_SENDTOOBIG                                MAKE_DPHRESULT( 230 )
1452 #define DPERR_TIMEOUT                   MAKE_DPHRESULT( 240 )
1453 #define DPERR_UNAVAILABLE               MAKE_DPHRESULT( 250 )
1454 #define DPERR_UNSUPPORTED               E_NOTIMPL
1455 #define DPERR_BUSY                      MAKE_DPHRESULT( 270 )
1456 #define DPERR_USERCANCEL                MAKE_DPHRESULT( 280 ) 
1457 #define DPERR_NOINTERFACE               E_NOINTERFACE
1458 #define DPERR_CANNOTCREATESERVER        MAKE_DPHRESULT( 290 )
1459 #define DPERR_PLAYERLOST                MAKE_DPHRESULT( 300 )
1460 #define DPERR_SESSIONLOST               MAKE_DPHRESULT( 310 )
1461 #define DPERR_UNINITIALIZED             MAKE_DPHRESULT( 320 )
1462 #define DPERR_NONEWPLAYERS              MAKE_DPHRESULT( 330 )
1463 #define DPERR_INVALIDPASSWORD           MAKE_DPHRESULT( 340 )
1464 #define DPERR_CONNECTING                MAKE_DPHRESULT( 350 )
1465
1466
1467 #define DPERR_BUFFERTOOLARGE            MAKE_DPHRESULT( 1000 )
1468 #define DPERR_CANTCREATEPROCESS         MAKE_DPHRESULT( 1010 )
1469 #define DPERR_APPNOTSTARTED             MAKE_DPHRESULT( 1020 )
1470 #define DPERR_INVALIDINTERFACE          MAKE_DPHRESULT( 1030 )
1471 #define DPERR_NOSERVICEPROVIDER         MAKE_DPHRESULT( 1040 )
1472 #define DPERR_UNKNOWNAPPLICATION        MAKE_DPHRESULT( 1050 )
1473 #define DPERR_NOTLOBBIED                MAKE_DPHRESULT( 1070 )
1474 #define DPERR_SERVICEPROVIDERLOADED             MAKE_DPHRESULT( 1080 )
1475 #define DPERR_ALREADYREGISTERED                 MAKE_DPHRESULT( 1090 )
1476 #define DPERR_NOTREGISTERED                             MAKE_DPHRESULT( 1100 )
1477
1478 //
1479 // Security related errors
1480 //
1481 #define DPERR_AUTHENTICATIONFAILED      MAKE_DPHRESULT(  2000 )
1482 #define DPERR_CANTLOADSSPI              MAKE_DPHRESULT(  2010 )
1483 #define DPERR_ENCRYPTIONFAILED          MAKE_DPHRESULT(  2020 )
1484 #define DPERR_SIGNFAILED                MAKE_DPHRESULT(  2030 )
1485 #define DPERR_CANTLOADSECURITYPACKAGE   MAKE_DPHRESULT(  2040 )
1486 #define DPERR_ENCRYPTIONNOTSUPPORTED    MAKE_DPHRESULT(  2050 )
1487 #define DPERR_CANTLOADCAPI              MAKE_DPHRESULT(  2060 )
1488 #define DPERR_NOTLOGGEDIN               MAKE_DPHRESULT(  2070 )
1489 #define DPERR_LOGONDENIED               MAKE_DPHRESULT(  2080 )
1490
1491
1492 /****************************************************************************
1493  *
1494  *      dplay 1.0 obsolete structures + interfaces
1495  *      Included for compatibility only. New apps should
1496  *      use IDirectPlay2
1497  *
1498  ****************************************************************************/
1499
1500 // define this to ignore obsolete interfaces and constants
1501 #ifndef IDIRECTPLAY2_OR_GREATER
1502
1503 #define DPOPEN_OPENSESSION          DPOPEN_JOIN
1504 #define DPOPEN_CREATESESSION        DPOPEN_CREATE
1505
1506 #define DPENUMSESSIONS_PREVIOUS     0x00000004
1507
1508 #define DPENUMPLAYERS_PREVIOUS      0x00000004
1509
1510 #define DPSEND_GUARANTEE            DPSEND_GUARANTEED
1511 #define DPSEND_TRYONCE              0x00000004
1512
1513 #define DPCAPS_NAMESERVICE          0x00000001
1514 #define DPCAPS_NAMESERVER           DPCAPS_ISHOST
1515 #define DPCAPS_GUARANTEED           0x00000004
1516
1517 #define DPLONGNAMELEN               52
1518 #define DPSHORTNAMELEN              20
1519 #define DPSESSIONNAMELEN            32
1520 #define DPPASSWORDLEN               16
1521 #define DPUSERRESERVED              16
1522
1523 #define DPSYS_ADDPLAYER             0x0003
1524 #define DPSYS_DELETEPLAYER          0x0005
1525
1526 #define DPSYS_DELETEGROUP           0x0020
1527 #define DPSYS_DELETEPLAYERFROMGRP   0x0021
1528 #define DPSYS_CONNECT               0x484b
1529
1530 typedef struct
1531 {
1532     DWORD       dwType;
1533     DWORD       dwPlayerType;
1534     DPID        dpId;
1535     char        szLongName[DPLONGNAMELEN];
1536     char        szShortName[DPSHORTNAMELEN];
1537     DWORD       dwCurrentPlayers;
1538 }   DPMSG_ADDPLAYER;
1539
1540 typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP;
1541
1542 typedef struct
1543 {
1544     DWORD       dwType;
1545     DPID        dpIdGroup;
1546     DPID        dpIdPlayer;
1547 } DPMSG_GROUPADD;
1548
1549 typedef DPMSG_GROUPADD DPMSG_GROUPDELETE;
1550 typedef struct
1551 {
1552     DWORD       dwType;
1553     DPID        dpId;
1554 } DPMSG_DELETEPLAYER;
1555
1556 typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)(
1557     DPID    dpId,
1558     LPSTR   lpFriendlyName,
1559     LPSTR   lpFormalName,
1560     DWORD   dwFlags,
1561     LPVOID  lpContext );
1562
1563 typedef struct
1564 {
1565     DWORD   dwSize;
1566     GUID    guidSession;                  
1567     DWORD   dwSession;                    
1568     DWORD   dwMaxPlayers;                 
1569     DWORD   dwCurrentPlayers;             
1570     DWORD   dwFlags;                      
1571     char    szSessionName[DPSESSIONNAMELEN];
1572     char    szUserField[DPUSERRESERVED];
1573     DWORD   dwReserved1;                  
1574     char    szPassword[DPPASSWORDLEN];    
1575     DWORD   dwReserved2;                  
1576     DWORD   dwUser1;
1577     DWORD   dwUser2;
1578     DWORD   dwUser3;
1579     DWORD   dwUser4;
1580 } DPSESSIONDESC,*LPDPSESSIONDESC;
1581
1582 typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)(
1583     LPDPSESSIONDESC lpDPSessionDesc,
1584     LPVOID      lpContext,
1585     LPDWORD     lpdwTimeOut,
1586     DWORD       dwFlags);
1587
1588 /*
1589  * IDirectPlay
1590  */
1591 #undef INTERFACE
1592 #define INTERFACE IDirectPlay
1593 DECLARE_INTERFACE_( IDirectPlay, IUnknown )
1594 {
1595     /*** IUnknown methods ***/
1596     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
1597     STDMETHOD_(ULONG,AddRef)        (THIS)  PURE;
1598     STDMETHOD_(ULONG,Release)       (THIS) PURE;
1599     /*** IDirectPlay methods ***/
1600     STDMETHOD(AddPlayerToGroup)     (THIS_ DPID, DPID) PURE;
1601     STDMETHOD(Close)                (THIS) PURE;
1602     STDMETHOD(CreatePlayer)         (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE;
1603     STDMETHOD(CreateGroup)          (THIS_ LPDPID,LPSTR,LPSTR) PURE;
1604     STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE;
1605     STDMETHOD(DestroyPlayer)        (THIS_ DPID) PURE;
1606     STDMETHOD(DestroyGroup)         (THIS_ DPID) PURE;
1607     STDMETHOD(EnableNewPlayers)     (THIS_ BOOL) PURE;
1608     STDMETHOD(EnumGroupPlayers)     (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
1609     STDMETHOD(EnumGroups)           (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
1610     STDMETHOD(EnumPlayers)          (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
1611     STDMETHOD(EnumSessions)         (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE;
1612     STDMETHOD(GetCaps)              (THIS_ LPDPCAPS) PURE;
1613     STDMETHOD(GetMessageCount)      (THIS_ DPID, LPDWORD) PURE;
1614     STDMETHOD(GetPlayerCaps)        (THIS_ DPID, LPDPCAPS) PURE;
1615     STDMETHOD(GetPlayerName)        (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE;
1616     STDMETHOD(Initialize)           (THIS_ LPGUID) PURE;
1617     STDMETHOD(Open)                 (THIS_ LPDPSESSIONDESC) PURE;
1618     STDMETHOD(Receive)              (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE;
1619     STDMETHOD(SaveSession)          (THIS_ LPSTR) PURE;
1620     STDMETHOD(Send)                 (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE;
1621     STDMETHOD(SetPlayerName)        (THIS_ DPID,LPSTR,LPSTR) PURE;
1622 };
1623
1624 /****************************************************************************
1625  *
1626  * IDirectPlay interface macros
1627  *
1628  ****************************************************************************/
1629
1630 #if !defined(__cplusplus) || defined(CINTERFACE)
1631
1632 #define IDirectPlay_AddPlayerToGroup(p,a,b)         (p)->lpVtbl->AddPlayerToGroup(p,a,b)
1633 #define IDirectPlay_Close(p)                        (p)->lpVtbl->Close(p)
1634 #define IDirectPlay_CreateGroup(p,a,b,c)            (p)->lpVtbl->CreateGroup(p,a,b,c)
1635 #define IDirectPlay_CreatePlayer(p,a,b,c,d)         (p)->lpVtbl->CreatePlayer(p,a,b,c,d)
1636 #define IDirectPlay_DeletePlayerFromGroup(p,a,b)    (p)->lpVtbl->DeletePlayerFromGroup(p,a,b)
1637 #define IDirectPlay_DestroyGroup(p,a)               (p)->lpVtbl->DestroyGroup(p,a)
1638 #define IDirectPlay_DestroyPlayer(p,a)              (p)->lpVtbl->DestroyPlayer(p,a)
1639 #define IDirectPlay_EnableNewPlayers(p,a)           (p)->lpVtbl->EnableNewPlayers(p,a)
1640 #define IDirectPlay_EnumGroupPlayers(p,a,b,c,d)     (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d)
1641 #define IDirectPlay_EnumGroups(p,a,b,c,d)           (p)->lpVtbl->EnumGroups(p,a,b,c,d)
1642 #define IDirectPlay_EnumPlayers(p,a,b,c,d)          (p)->lpVtbl->EnumPlayers(p,a,b,c,d)
1643 #define IDirectPlay_EnumSessions(p,a,b,c,d,e)       (p)->lpVtbl->EnumSessions(p,a,b,c,d,e)
1644 #define IDirectPlay_GetCaps(p,a)                    (p)->lpVtbl->GetCaps(p,a)
1645 #define IDirectPlay_GetMessageCount(p,a,b)          (p)->lpVtbl->GetMessageCount(p,a,b)
1646 #define IDirectPlay_GetPlayerCaps(p,a,b)            (p)->lpVtbl->GetPlayerCaps(p,a,b)
1647 #define IDirectPlay_GetPlayerName(p,a,b,c,d,e)      (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e)
1648 #define IDirectPlay_Initialize(p,a)                 (p)->lpVtbl->Initialize(p,a)
1649 #define IDirectPlay_Open(p,a)                       (p)->lpVtbl->Open(p,a)
1650 #define IDirectPlay_Receive(p,a,b,c,d,e)            (p)->lpVtbl->Receive(p,a,b,c,d,e)
1651 #define IDirectPlay_SaveSession(p,a)                (p)->lpVtbl->SaveSession(p,a)
1652 #define IDirectPlay_Send(p,a,b,c,d,e)               (p)->lpVtbl->Send(p,a,b,c,d,e)
1653 #define IDirectPlay_SetPlayerName(p,a,b,c)          (p)->lpVtbl->SetPlayerName(p,a,b,c)
1654
1655 #else /* C++ */
1656
1657 #define IDirectPlay_AddPlayerToGroup(p,a,b)         (p)->AddPlayerToGroup(a,b)
1658 #define IDirectPlay_Close(p)                        (p)->Close()
1659 #define IDirectPlay_CreateGroup(p,a,b,c)            (p)->CreateGroup(a,b,c)
1660 #define IDirectPlay_CreatePlayer(p,a,b,c,d)         (p)->CreatePlayer(a,b,c,d)
1661 #define IDirectPlay_DeletePlayerFromGroup(p,a,b)    (p)->DeletePlayerFromGroup(a,b)
1662 #define IDirectPlay_DestroyGroup(p,a)               (p)->DestroyGroup(a)
1663 #define IDirectPlay_DestroyPlayer(p,a)              (p)->DestroyPlayer(a)
1664 #define IDirectPlay_EnableNewPlayers(p,a)           (p)->EnableNewPlayers(a)
1665 #define IDirectPlay_EnumGroupPlayers(p,a,b,c,d)     (p)->EnumGroupPlayers(a,b,c,d)
1666 #define IDirectPlay_EnumGroups(p,a,b,c,d)           (p)->EnumGroups(a,b,c,d)
1667 #define IDirectPlay_EnumPlayers(p,a,b,c,d)          (p)->EnumPlayers(a,b,c,d)
1668 #define IDirectPlay_EnumSessions(p,a,b,c,d,e)       (p)->EnumSessions(a,b,c,d,e)
1669 #define IDirectPlay_GetCaps(p,a)                    (p)->GetCaps(a)
1670 #define IDirectPlay_GetMessageCount(p,a,b)          (p)->GetMessageCount(a,b)
1671 #define IDirectPlay_GetPlayerCaps(p,a,b)            (p)->GetPlayerCaps(a,b)
1672 #define IDirectPlay_GetPlayerName(p,a,b,c,d,e)      (p)->GetPlayerName(a,b,c,d,e)
1673 #define IDirectPlay_Initialize(p,a)                 (p)->Initialize(a)
1674 #define IDirectPlay_Open(p,a)                       (p)->Open(a)
1675 #define IDirectPlay_Receive(p,a,b,c,d,e)            (p)->Receive(a,b,c,d,e)
1676 #define IDirectPlay_SaveSession(p,a)                (p)->SaveSession(a)
1677 #define IDirectPlay_Send(p,a,b,c,d,e)               (p)->Send(a,b,c,d,e)
1678 #define IDirectPlay_SetPlayerName(p,a,b,c)          (p)->SetPlayerName(a,b,c)
1679
1680 #endif
1681
1682 DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72);
1683
1684 #endif // IDIRECTPLAY2_OR_GREATER
1685
1686 /****************************************************************************
1687  *
1688  * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag)
1689  *
1690  ****************************************************************************/
1691
1692 #if !defined(__cplusplus) || defined(CINTERFACE)
1693
1694 #define IDirectPlay_QueryInterface(p,a,b)           (p)->lpVtbl->QueryInterface(p,a,b)
1695 #define IDirectPlay_AddRef(p)                       (p)->lpVtbl->AddRef(p)
1696 #define IDirectPlay_Release(p)                      (p)->lpVtbl->Release(p)
1697
1698 #else
1699
1700 #define IDirectPlay_QueryInterface(p,a,b)           (p)->QueryInterface(a,b)
1701 #define IDirectPlay_AddRef(p)                       (p)->AddRef()
1702 #define IDirectPlay_Release(p)                      (p)->Release()
1703
1704 #endif // IDirectPlay interface macros 
1705
1706 #ifdef __cplusplus
1707 };
1708 #endif
1709
1710 #endif
1711