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