1 /*
2 * Copyright 2000 Peter Hunnisett
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #ifndef __WINE_DIRECT_PLAY_SP_H
20 #define __WINE_DIRECT_PLAY_SP_H
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "dplay.h"
28 #include "dplobby.h"
29
30 /* GUID for IDirectPlaySP {0C9F6360-CC61-11cf-ACEC-00AA006886E3} */
31 DEFINE_GUID(IID_IDirectPlaySP, 0xc9f6360, 0xcc61, 0x11cf, 0xac, 0xec, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
32 typedef struct IDirectPlaySP *LPDIRECTPLAYSP;
33
34
35 typedef BOOL (CALLBACK *LPENUMMRUCALLBACK)( LPCVOID lpData,
36 DWORD dwDataSize,
37 LPVOID lpContext );
38
39 /* For SP. Top 16 bits is dplay, bottom 16 is SP */
40 #define DPSP_MAJORVERSION 0x00060000
41
42 #define DPSP_DX3VERSION 0x00040000
43 #define DPSP_DX5VERSION 0x00050000
44 #define DPSP_DX6VERSION 0x00090000
45 #define DPSP_DX61VERSION 0x000a0000
46 #define DPSP_DX61AVERSION 0x000b0000
47 #define DPSP_DX71VERSION 0x000c0000
48 #define DPSP_DX8VERSION 0x000d0000
49 #define DPSP_DX9VERSION 0x000e0000
50
51 #define DPSP_MAJORVERSIONMASK 0xFFFF0000
52 #define DPSP_MINORVERSIONMASK 0x0000FFFF
53
54
55 /* Some flags */
56 #define DPLAYI_PLAYER_SYSPLAYER 0x00000001
57 #define DPLAYI_PLAYER_NAMESRVR 0x00000002
58 #define DPLAYI_PLAYER_PLAYERINGROUP 0x00000004
59 #define DPLAYI_PLAYER_PLAYERLOCAL 0x00000008
60 #define DPLAYI_GROUP_SYSGROUP 0x00000020
61 #define DPLAYI_GROUP_DPLAYOWNS 0x00000040
62 #define DPLAYI_PLAYER_APPSERVER 0x00000080
63 #define DPLAYI_GROUP_HIDDEN 0x00000400
64
65 /* Define the COM interface */
66 #define INTERFACE IDirectPlaySP
DECLARE_INTERFACE_(IDirectPlaySP,IUnknown)67 DECLARE_INTERFACE_(IDirectPlaySP,IUnknown)
68 {
69 /*** IUnknown methods ***/
70 STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
71 STDMETHOD_(ULONG,AddRef)(THIS) PURE;
72 STDMETHOD_(ULONG,Release)(THIS) PURE;
73 /*** IDirectPlaySP methods ***/
74 STDMETHOD(AddMRUEntry)(THIS_ LPCWSTR lpSection, LPCWSTR lpKey, LPCVOID lpData, DWORD dwDataSize, DWORD dwMaxEntries ) PURE;
75 STDMETHOD(CreateAddress)(THIS_ REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize, LPVOID lpAddress,LPDWORD lpdwAddressSize) PURE;
76 STDMETHOD(EnumAddress)(THIS_ LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress, DWORD dwAddressSize, LPVOID lpContext ) PURE;
77 STDMETHOD(EnumMRUEntries)(THIS_ LPCWSTR lpSection, LPCWSTR lpKey, LPENUMMRUCALLBACK lpEnumMRUCallback, LPVOID lpContext ) PURE;
78 STDMETHOD(GetPlayerFlags)(THIS_ DPID idPlayer, LPDWORD lpdwPlayerFlags ) PURE;
79 STDMETHOD(GetSPPlayerData)(THIS_ DPID idPlayer, LPVOID *lplpData, LPDWORD lpdwDataSize, DWORD dwFlags ) PURE;
80 STDMETHOD(HandleMessage)(THIS_ LPVOID lpMessageBody, DWORD dwMessageBodySize, LPVOID lpMessageHeader ) PURE;
81 STDMETHOD(SetSPPlayerData)(THIS_ DPID idPlayer, LPVOID lpData, DWORD dwDataSize, DWORD dwFlags ) PURE;
82 STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount, LPVOID lpAddress, LPDWORD lpdwAddressSize ) PURE;
83 STDMETHOD(GetSPData)(THIS_ LPVOID *lplpData, LPDWORD dwDataSize, DWORD dwFlags ) PURE;
84 STDMETHOD(SetSPData)(THIS_ LPVOID lpData, DWORD dwDataSize, DWORD dwFlags ) PURE;
85 STDMETHOD_(VOID,SendComplete)(THIS_ LPVOID , DWORD ) PURE;
86 };
87 #undef INTERFACE
88
89
90 /* NOTE: The microsoft provided header file doesn't have these access
91 * functions
92 */
93 #if !defined (__cplusplus) || defined(CINTERFACE)
94 /*** IUnknown methods ***/
95 #define IDirectPlaySP_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
96 #define IDirectPlaySP_AddRef(p) (p)->lpVtbl->AddRef(p)
97 #define IDirectPlaySP_Release(p) (p)->lpVtbl->Release(p)
98 /*** IDirectPlaySP methods ***/
99 #define IDirectPlaySP_AddMRUEntry(p,a,b,c,d,e) (p)->lpVtbl->AddMRUEntry(p,a,b,c,d,e)
100 #define IDirectPlaySP_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f)
101 #define IDirectPlaySP_EnumAddress(p,a,b,c,d) (p)->lpVtbl->EnumAddress(p,a,b,c,d)
102 #define IDirectPlaySP_EnumMRUEntries(p,a,b,c,d) (p)->lpVtbl->EnumMRUEntries(p,a,b,c,d)
103 #define IDirectPlaySP_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b)
104 #define IDirectPlaySP_GetSPPlayerData(p,a,b,c,d) (p)->lpVtbl->GetSPPlayerData(p,a,b,c,d)
105 #define IDirectPlaySP_HandleMessage(p,a,b,c) (p)->lpVtbl->HandleMessage(p,a,b,c)
106 #define IDirectPlaySP_SetSPPlayerData(p,a,b,c,d) (p)->lpVtbl->SetSPPlayerData(p,a,b,c,d)
107 #define IDirectPlaySP_CreateCompoundAddress(p,a,b,c,d) (p)->lpVtbl->CreateCompoundAddress(p,a,b,c,d)
108 #define IDirectPlaySP_GetSPData(p,a,b,c) (p)->lpVtbl->GetSPData(p,a,b,c)
109 #define IDirectPlaySP_SetSPData(p,a,b,c) (p)->lpVtbl->SetSPData(p,a,b,c)
110 #define IDirectPlaySP_SendComplete(p,a,b) (p)->lpVtbl->SendComplete(p,a,b)
111 #endif
112
113 /* SP Callback stuff */
114
115 typedef struct tagDPSP_ADDPLAYERTOGROUPDATA
116 {
117 DPID idPlayer;
118 DPID idGroup;
119 IDirectPlaySP* lpISP;
120 } DPSP_ADDPLAYERTOGROUPDATA, *LPDPSP_ADDPLAYERTOGROUPDATA;
121
122 typedef struct tagDPSP_CLOSEDATA
123 {
124 IDirectPlaySP* lpISP;
125 } DPSP_CLOSEDATA, *LPDPSP_CLOSEDATA;
126
127 typedef struct tagDPSP_CREATEGROUPDATA
128 {
129 DPID idGroup;
130 DWORD dwFlags;
131 LPVOID lpSPMessageHeader;
132 IDirectPlaySP* lpISP;
133 } DPSP_CREATEGROUPDATA, *LPDPSP_CREATEGROUPDATA;
134
135 typedef struct tagDPSP_CREATEPLAYERDATA
136 {
137 DPID idPlayer;
138 DWORD dwFlags;
139 LPVOID lpSPMessageHeader;
140 IDirectPlaySP* lpISP;
141 } DPSP_CREATEPLAYERDATA, *LPDPSP_CREATEPLAYERDATA;
142
143 typedef struct tagDPSP_DELETEGROUPDATA
144 {
145 DPID idGroup;
146 DWORD dwFlags;
147 IDirectPlaySP* lpISP;
148 } DPSP_DELETEGROUPDATA, *LPDPSP_DELETEGROUPDATA;
149
150 typedef struct tagDPSP_DELETEPLAYERDATA
151 {
152 DPID idPlayer;
153 DWORD dwFlags;
154 IDirectPlaySP* lpISP;
155 } DPSP_DELETEPLAYERDATA, *LPDPSP_DELETEPLAYERDATA;
156
157 typedef struct tagDPSP_ENUMSESSIONSDATA
158 {
159 LPVOID lpMessage;
160 DWORD dwMessageSize;
161 IDirectPlaySP* lpISP;
162 BOOL bReturnStatus;
163 } DPSP_ENUMSESSIONSDATA, *LPDPSP_ENUMSESSIONSDATA;
164
165 typedef struct _DPSP_GETADDRESSDATA
166 {
167 DPID idPlayer;
168 DWORD dwFlags;
169 LPDPADDRESS lpAddress;
170 LPDWORD lpdwAddressSize;
171 IDirectPlaySP* lpISP;
172 } DPSP_GETADDRESSDATA, *LPDPSP_GETADDRESSDATA;
173
174 typedef struct tagDPSP_GETADDRESSCHOICESDATA
175 {
176 LPDPADDRESS lpAddress;
177 LPDWORD lpdwAddressSize;
178 IDirectPlaySP* lpISP;
179 } DPSP_GETADDRESSCHOICESDATA, *LPDPSP_GETADDRESSCHOICESDATA;
180
181 typedef struct tagDPSP_GETCAPSDATA
182 {
183 DPID idPlayer;
184 LPDPCAPS lpCaps;
185 DWORD dwFlags;
186 IDirectPlaySP* lpISP;
187 } DPSP_GETCAPSDATA, *LPDPSP_GETCAPSDATA;
188
189 typedef struct tagDPSP_OPENDATA
190 {
191 BOOL bCreate;
192 LPVOID lpSPMessageHeader;
193 IDirectPlaySP* lpISP;
194 BOOL bReturnStatus;
195 DWORD dwOpenFlags;
196 DWORD dwSessionFlags;
197 } DPSP_OPENDATA, *LPDPSP_OPENDATA;
198
199 typedef struct tagDPSP_REMOVEPLAYERFROMGROUPDATA
200 {
201 DPID idPlayer;
202 DPID idGroup;
203 IDirectPlaySP* lpISP;
204 } DPSP_REMOVEPLAYERFROMGROUPDATA, *LPDPSP_REMOVEPLAYERFROMGROUPDATA;
205
206 typedef struct tagDPSP_REPLYDATA
207 {
208 LPVOID lpSPMessageHeader;
209 LPVOID lpMessage;
210 DWORD dwMessageSize;
211 DPID idNameServer;
212 IDirectPlaySP* lpISP;
213 } DPSP_REPLYDATA, *LPDPSP_REPLYDATA;
214
215 typedef struct tagDPSP_SENDDATA
216 {
217 DWORD dwFlags;
218 DPID idPlayerTo;
219 DPID idPlayerFrom;
220 LPVOID lpMessage;
221 DWORD dwMessageSize;
222 BOOL bSystemMessage;
223 IDirectPlaySP* lpISP;
224 } DPSP_SENDDATA, *LPDPSP_SENDDATA;
225
226 typedef struct tagDPSP_SENDTOGROUPDATA
227 {
228 DWORD dwFlags;
229 DPID idGroupTo;
230 DPID idPlayerFrom;
231 LPVOID lpMessage;
232 DWORD dwMessageSize;
233 IDirectPlaySP* lpISP;
234 } DPSP_SENDTOGROUPDATA, *LPDPSP_SENDTOGROUPDATA;
235
236 typedef struct tagDPSP_SENDEXDATA
237 {
238 IDirectPlaySP* lpISP;
239 DWORD dwFlags;
240 DPID idPlayerTo;
241 DPID idPlayerFrom;
242 LPSGBUFFER lpSendBuffers;
243 DWORD cBuffers;
244 DWORD dwMessageSize;
245 DWORD dwPriority;
246 DWORD dwTimeout;
247 LPVOID lpDPContext;
248 LPDWORD lpdwSPMsgID;
249 BOOL bSystemMessage;
250 } DPSP_SENDEXDATA, *LPDPSP_SENDEXDATA;
251
252 typedef struct tagDPSP_SENDTOGROUPEXDATA
253 {
254 IDirectPlaySP* lpISP;
255 DWORD dwFlags;
256 DPID idGroupTo;
257 DPID idPlayerFrom;
258 LPSGBUFFER lpSendBuffers;
259 DWORD cBuffers;
260 DWORD dwMessageSize;
261 DWORD dwPriority;
262 DWORD dwTimeout;
263 LPVOID lpDPContext;
264 LPDWORD lpdwSPMsgID;
265 } DPSP_SENDTOGROUPEXDATA, *LPDPSP_SENDTOGROUPEXDATA;
266
267 typedef struct tagDPSP_GETMESSAGEQUEUEDATA
268 {
269 IDirectPlaySP* lpISP;
270 DWORD dwFlags;
271 DPID idFrom;
272 DPID idTo;
273 LPDWORD lpdwNumMsgs;
274 LPDWORD lpdwNumBytes;
275 } DPSP_GETMESSAGEQUEUEDATA, *LPDPSP_GETMESSAGEQUEUEDATA;
276
277 #define DPCANCELSEND_PRIORITY 0x00000001
278 #define DPCANCELSEND_ALL 0x00000002
279
280 typedef struct tagDPSP_CANCELDATA
281 {
282 IDirectPlaySP* lpISP;
283 DWORD dwFlags;
284 LPRGLPVOID lprglpvSPMsgID;
285 DWORD cSPMsgID;
286 DWORD dwMinPriority;
287 DWORD dwMaxPriority;
288 } DPSP_CANCELDATA, *LPDPSP_CANCELDATA;
289
290 typedef struct tagDPSP_SHUTDOWNDATA
291 {
292 IDirectPlaySP* lpISP;
293 } DPSP_SHUTDOWNDATA, *LPDPSP_SHUTDOWNDATA;
294
295
296 /* Prototypes returned by SPInit */
297 typedef HRESULT (WINAPI *LPDPSP_CREATEPLAYER)(LPDPSP_CREATEPLAYERDATA);
298 typedef HRESULT (WINAPI *LPDPSP_DELETEPLAYER)(LPDPSP_DELETEPLAYERDATA);
299 typedef HRESULT (WINAPI *LPDPSP_SEND)(LPDPSP_SENDDATA);
300 typedef HRESULT (WINAPI *LPDPSP_ENUMSESSIONS)(LPDPSP_ENUMSESSIONSDATA);
301 typedef HRESULT (WINAPI *LPDPSP_REPLY)(LPDPSP_REPLYDATA);
302 typedef HRESULT (WINAPI *LPDPSP_SHUTDOWN)(void);
303 typedef HRESULT (WINAPI *LPDPSP_CREATEGROUP)(LPDPSP_CREATEGROUPDATA);
304 typedef HRESULT (WINAPI *LPDPSP_DELETEGROUP)(LPDPSP_DELETEGROUPDATA);
305 typedef HRESULT (WINAPI *LPDPSP_ADDPLAYERTOGROUP)(LPDPSP_ADDPLAYERTOGROUPDATA);
306 typedef HRESULT (WINAPI *LPDPSP_REMOVEPLAYERFROMGROUP)(LPDPSP_REMOVEPLAYERFROMGROUPDATA);
307 typedef HRESULT (WINAPI *LPDPSP_GETCAPS)(LPDPSP_GETCAPSDATA);
308 typedef HRESULT (WINAPI *LPDPSP_GETADDRESS)(LPDPSP_GETADDRESSDATA);
309 typedef HRESULT (WINAPI *LPDPSP_GETADDRESSCHOICES)(LPDPSP_GETADDRESSCHOICESDATA);
310 typedef HRESULT (WINAPI *LPDPSP_OPEN)(LPDPSP_OPENDATA);
311 typedef HRESULT (WINAPI *LPDPSP_CLOSE)(void);
312 typedef HRESULT (WINAPI *LPDPSP_SENDTOGROUP)(LPDPSP_SENDTOGROUPDATA);
313 typedef HRESULT (WINAPI *LPDPSP_SHUTDOWNEX)(LPDPSP_SHUTDOWNDATA);
314 typedef HRESULT (WINAPI *LPDPSP_CLOSEEX)(LPDPSP_CLOSEDATA);
315 typedef HRESULT (WINAPI *LPDPSP_SENDEX)(LPDPSP_SENDEXDATA);
316 typedef HRESULT (WINAPI *LPDPSP_SENDTOGROUPEX)(LPDPSP_SENDTOGROUPEXDATA);
317 typedef HRESULT (WINAPI *LPDPSP_CANCEL)(LPDPSP_CANCELDATA);
318 typedef HRESULT (WINAPI *LPDPSP_GETMESSAGEQUEUE)(LPDPSP_GETMESSAGEQUEUEDATA);
319
320
321 typedef struct tagDPSP_SPCALLBACKS
322 {
323 DWORD dwSize;
324 DWORD dwVersion;
325
326 LPDPSP_ENUMSESSIONS EnumSessions; /* Must be provided */
327 LPDPSP_REPLY Reply; /* Must be provided */
328 LPDPSP_SEND Send; /* Must be provided */
329 LPDPSP_ADDPLAYERTOGROUP AddPlayerToGroup; /* Optional */
330 LPDPSP_CLOSE Close; /* Optional */
331 LPDPSP_CREATEGROUP CreateGroup; /* Optional */
332 LPDPSP_CREATEPLAYER CreatePlayer; /* Optional */
333 LPDPSP_DELETEGROUP DeleteGroup; /* Optional */
334 LPDPSP_DELETEPLAYER DeletePlayer; /* Optional */
335 LPDPSP_GETADDRESS GetAddress; /* Optional */
336 LPDPSP_GETCAPS GetCaps; /* Optional */
337 LPDPSP_OPEN Open; /* Optional */
338 LPDPSP_REMOVEPLAYERFROMGROUP RemovePlayerFromGroup; /* Optional */
339 LPDPSP_SENDTOGROUP SendToGroup; /* Optional */
340 LPDPSP_SHUTDOWN Shutdown; /* Optional */
341
342 LPDPSP_CLOSEEX CloseEx; /* Optional */
343 LPDPSP_SHUTDOWNEX ShutdownEx; /* Optional */
344 LPDPSP_GETADDRESSCHOICES GetAddressChoices; /* Optional */
345
346 LPDPSP_SENDEX SendEx; /* Optional */
347 LPDPSP_SENDTOGROUPEX SendToGroupEx; /* Optional */
348 LPDPSP_CANCEL Cancel; /* Optional */
349 LPDPSP_GETMESSAGEQUEUE GetMessageQueue; /* Optional */
350 } DPSP_SPCALLBACKS, *LPDPSP_SPCALLBACKS;
351
352 typedef struct tagSPINITDATA
353 {
354 LPDPSP_SPCALLBACKS lpCB;
355 IDirectPlaySP* lpISP;
356 LPWSTR lpszName;
357 LPGUID lpGuid;
358 DWORD dwReserved1;
359 DWORD dwReserved2;
360 DWORD dwSPHeaderSize;
361 LPDPADDRESS lpAddress;
362 DWORD dwAddressSize;
363 DWORD dwSPVersion;
364 } SPINITDATA, *LPSPINITDATA;
365
366 typedef HRESULT (WINAPI *LPDPSP_SPINIT)(LPSPINITDATA);
367
368 /* This variable is exported from the DLL at ordinal 6 to be accessed by the
369 * SP directly
370 */
371 extern DWORD gdwDPlaySPRefCount;
372
373 #endif
374