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