[AMSTREAM] We don't need to define WIDL_C_INLINE_WRAPPERS here anymore.
[reactos.git] / dll / directx / wine / dplayx / dplayx_messages.h
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_DPLAYX_MESSAGES__
20 #define __WINE_DPLAYX_MESSAGES__
21
22 DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
23 HANDLE hDeath, HANDLE hConnRead ) DECLSPEC_HIDDEN;
24
25 HRESULT DP_MSG_SendRequestPlayerId( IDirectPlayImpl *This, DWORD dwFlags,
26 LPDPID lpdipidAllocatedId ) DECLSPEC_HIDDEN;
27 HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer ) DECLSPEC_HIDDEN;
28
29 void DP_MSG_ReplyReceived( IDirectPlayImpl *This, WORD wCommandId,
30 LPCVOID lpMsgBody, DWORD dwMsgBodySize ) DECLSPEC_HIDDEN;
31 void DP_MSG_ErrorReceived( IDirectPlayImpl *This, WORD wCommandId,
32 LPCVOID lpMsgBody, DWORD dwMsgBodySize ) DECLSPEC_HIDDEN;
33 void DP_MSG_ToSelf( IDirectPlayImpl *This, DPID dpidSelf ) DECLSPEC_HIDDEN;
34
35 /* Timings -> 1000 ticks/sec */
36 #define DPMSG_WAIT_5_SECS 5000
37 #define DPMSG_WAIT_30_SECS 30000
38 #define DPMSG_WAIT_60_SECS 60000
39 #define DPMSG_DEFAULT_WAIT_TIME DPMSG_WAIT_30_SECS
40
41 /* Message types etc. */
42 #include <pshpack1.h>
43
44 /* Non provided messages for DPLAY - guess work which may be wrong :( */
45 #define DPMSGCMD_ENUMSESSIONSREPLY 1
46 #define DPMSGCMD_ENUMSESSIONSREQUEST 2
47 #define DPMSGCMD_GETNAMETABLEREPLY 3 /* Contains all existing players in session */
48
49 #define DPMSGCMD_REQUESTNEWPLAYERID 5
50
51 #define DPMSGCMD_NEWPLAYERIDREPLY 7
52 #define DPMSGCMD_CREATESESSION 8 /* Might be a create nameserver or new player msg */
53 #define DPMSGCMD_CREATENEWPLAYER 9
54 #define DPMSGCMD_SYSTEMMESSAGE 10
55 #define DPMSGCMD_DELETEPLAYER 11
56 #define DPMSGCMD_DELETEGROUP 12
57
58 #define DPMSGCMD_ENUMGROUPS 17
59
60 #define DPMSGCMD_FORWARDADDPLAYER 19
61
62 #define DPMSGCMD_PLAYERCHAT 22
63
64 #define DPMSGCMD_FORWARDADDPLAYERNACK 36
65
66 #define DPMSGCMD_JUSTENVELOPE 1000
67 #define DPMSGCMD_JUSTENVELOPEREPLY 1001
68
69 /* This is what DP 6 defines it as. Don't know what it means. All messages
70 * defined below are DPMSGVER_DP6.
71 */
72 #define DPMSGVER_DP6 11
73
74 /* MAGIC number at the start of all dplay packets ("play" in ASCII) */
75 #define DPMSGMAGIC_DPLAYMSG 0x79616c70
76
77 /* All messages sent from the system are sent with this at the beginning of
78 * the message.
79 * Size is 8 bytes
80 */
81 typedef struct tagDPMSG_SENDENVELOPE
82 {
83 DWORD dwMagic;
84 WORD wCommandId;
85 WORD wVersion;
86 } DPMSG_SENDENVELOPE, *LPDPMSG_SENDENVELOPE;
87 typedef const DPMSG_SENDENVELOPE* LPCDPMSG_SENDENVELOPE;
88
89 /* System messages exchanged between players seems to have this
90 * payload envelope on top of the basic envelope
91 */
92 typedef struct tagDPMSG_SYSMSGENVELOPE
93 {
94 DWORD dwPlayerFrom;
95 DWORD dwPlayerTo;
96 } DPMSG_SYSMSGENVELOPE, *LPDPMSG_SYSMSGENVELOPE;
97 typedef const DPMSG_SYSMSGENVELOPE* LPCDPMSG_SYSMSGENVELOPE;
98
99 /* Reply sent in response to an enumsession request */
100 typedef struct tagDPMSG_ENUMSESSIONSREPLY
101 {
102 DPMSG_SENDENVELOPE envelope;
103
104 #if 0
105 DWORD dwSize; /* Size of DPSESSIONDESC2 struct */
106 DWORD dwFlags; /* Sessions flags */
107
108 GUID guidInstance; /* Not 100% sure this is what it is... */
109
110 GUID guidApplication;
111
112 DWORD dwMaxPlayers;
113 DWORD dwCurrentPlayers;
114
115 BYTE unknown[36];
116 #else
117 DPSESSIONDESC2 sd;
118 #endif
119
120 DWORD dwUnknown; /* Seems to be equal to 0x5c which is a "\\" */
121 /* Encryption package string? */
122
123 /* At the end we have ... */
124 /* WCHAR wszSessionName[1]; Var length with NULL terminal */
125
126 } DPMSG_ENUMSESSIONSREPLY, *LPDPMSG_ENUMSESSIONSREPLY;
127 typedef const DPMSG_ENUMSESSIONSREPLY* LPCDPMSG_ENUMSESSIONSREPLY;
128
129 /* Msg sent to find out what sessions are available */
130 typedef struct tagDPMSG_ENUMSESSIONSREQUEST
131 {
132 DPMSG_SENDENVELOPE envelope;
133
134 GUID guidApplication;
135
136 DWORD dwPasswordSize; /* A Guess. This is 0x00000000. */
137 /* This might be the name server DPID which
138 is needed for the reply */
139
140 DWORD dwFlags; /* dwFlags from EnumSessions */
141
142 } DPMSG_ENUMSESSIONSREQUEST, *LPDPMSG_ENUMSESSIONSREQUEST;
143 typedef const DPMSG_ENUMSESSIONSREQUEST* LPCDPMSG_ENUMSESSIONSREQUEST;
144
145 /* Size is 146 received - with 18 or 20 bytes header = ~128 bytes */
146 typedef struct tagDPMSG_CREATESESSION
147 {
148 DPMSG_SENDENVELOPE envelope;
149 } DPMSG_CREATESESSION, *LPDPMSG_CREATESESSION;
150 typedef const DPMSG_CREATESESSION* LPCDPMSG_CREATESESSION;
151
152 /* 12 bytes msg */
153 typedef struct tagDPMSG_REQUESTNEWPLAYERID
154 {
155 DPMSG_SENDENVELOPE envelope;
156
157 DWORD dwFlags; /* dwFlags used for CreatePlayer */
158
159 } DPMSG_REQUESTNEWPLAYERID, *LPDPMSG_REQUESTNEWPLAYERID;
160 typedef const DPMSG_REQUESTNEWPLAYERID* LPCDPMSG_REQUESTNEWPLAYERID;
161
162 /* 48 bytes msg */
163 typedef struct tagDPMSG_NEWPLAYERIDREPLY
164 {
165 DPMSG_SENDENVELOPE envelope;
166
167 DPID dpidNewPlayerId;
168
169 /* Assume that this is data that is tacked on to the end of the message
170 * that comes from the SP remote data stored that needs to be propagated.
171 */
172 BYTE unknown[36]; /* This appears to always be 0 - not sure though */
173 } DPMSG_NEWPLAYERIDREPLY, *LPDPMSG_NEWPLAYERIDREPLY;
174 typedef const DPMSG_NEWPLAYERIDREPLY* LPCDPMSG_NEWPLAYERIDREPLY;
175
176 typedef struct tagDPMSG_FORWARDADDPLAYER
177 {
178 DPMSG_SENDENVELOPE envelope;
179
180 DWORD unknown; /* 0 */
181
182 DPID dpidAppServer; /* Remote application server id */
183 DWORD unknown2[5]; /* 0x0, 0x1c, 0x6c, 0x50, 0x9 */
184
185 DPID dpidAppServer2; /* Remote application server id again !? */
186 DWORD unknown3[5]; /* 0x0, 0x0, 0x20, 0x0, 0x0 */
187
188 DPID dpidAppServer3; /* Remote application server id again !? */
189
190 DWORD unknown4[12]; /* ??? - Is this a clump of 5 and then 8? */
191 /* NOTE: 1 byte in front of the two 0x??090002 entries changes!
192 * Is it a timestamp of some sort? 1st always smaller than
193 * other...
194 */
195 #define FORWARDADDPLAYER_UNKNOWN4_INIT { 0x30, 0xb, 0x0, 0x1e090002, 0x0, 0x0, 0x0, 0x32090002, 0x0, 0x0, 0x0, 0x0 }
196
197 BYTE unknown5[2]; /* 2 bytes at the end. This may be a part of something! ( 0x0, 0x0) */
198
199 } DPMSG_FORWARDADDPLAYER, *LPDPMSG_FORWARDADDPLAYER;
200 typedef const DPMSG_FORWARDADDPLAYER* LPCDPMSG_FORWARDADDPLAYER;
201
202 /* This is an error message that can be received. Not sure if this is
203 * specifically for a forward add player or for all errors
204 */
205 typedef struct tagDPMSG_FORWARDADDPLAYERNACK
206 {
207 DPMSG_SENDENVELOPE envelope;
208 HRESULT errorCode;
209 } DPMSG_FORWARDADDPLAYERNACK, *LPDPMSG_FORWARDADDPLAYERNACK;
210 typedef const DPMSG_FORWARDADDPLAYERNACK* LPCDPMSG_FORWARDADDPLAYERNACK;
211
212 #include <poppack.h>
213
214 #endif /* __WINE_DPLAYX_MESSAGES__ */