Release 20030408.
[wine/gsoc-2012-control.git] / dlls / dplayx / dplayx_messages.h
blob015f1c002813cbd5b7e4bcfac599c390a7562d06
1 /*
2 * Copyright 2000 Peter Hunnisett
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.
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.
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
19 #ifndef __WINE_DPLAYX_MESSAGES__
20 #define __WINE_DPLAYX_MESSAGES__
22 #include "windef.h"
23 #include "dplay.h"
24 #include "rpc.h" /* For GUID */
26 #include "dplay_global.h"
28 DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
29 HANDLE hDeath, HANDLE hConnRead );
31 HRESULT DP_MSG_SendRequestPlayerId( IDirectPlay2AImpl* This, DWORD dwFlags,
32 LPDPID lpdipidAllocatedId );
33 HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer );
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 );
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
47 /* Message types etc. */
48 #include "pshpack1.h"
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 */
55 #define DPMSGCMD_REQUESTNEWPLAYERID 5
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
64 #define DPMSGCMD_ENUMGROUPS 17
66 #define DPMSGCMD_FORWARDADDPLAYER 19
68 #define DPMSGCMD_PLAYERCHAT 22
70 #define DPMSGCMD_FORWARDADDPLAYERNACK 36
72 #define DPMSGCMD_JUSTENVELOPE 1000
73 #define DPMSGCMD_JUSTENVELOPEREPLY 1001
75 /* This is what DP 6 defines it as. Don't know what it means. All messages
76 * defined below are DPMSGVER_DP6.
78 #define DPMSGVER_DP6 11
80 /* MAGIC number at the start of all dplay packets ("play" in ASCII) */
81 #define DPMSGMAGIC_DPLAYMSG 0x79616c70
83 /* All messages sent from the system are sent with this at the beginning of
84 * the message.
85 * Size is 8 bytes
87 typedef struct tagDPMSG_SENDENVELOPE
89 DWORD dwMagic;
90 WORD wCommandId;
91 WORD wVersion;
92 } DPMSG_SENDENVELOPE, *LPDPMSG_SENDENVELOPE;
93 typedef const DPMSG_SENDENVELOPE* LPCDPMSG_SENDENVELOPE;
95 /* System messages exchanged between players seems to have this
96 * payload envelope on top of the basic envelope
98 typedef struct tagDPMSG_SYSMSGENVELOPE
100 DWORD dwPlayerFrom;
101 DWORD dwPlayerTo;
102 } DPMSG_SYSMSGENVELOPE, *LPDPMSG_SYSMSGENVELOPE;
103 typedef const DPMSG_SYSMSGENVELOPE* LPCDPMSG_SYSMSGENVELOPE;
105 /* Reply sent in response to an enumsession request */
106 typedef struct tagDPMSG_ENUMSESSIONSREPLY
108 DPMSG_SENDENVELOPE envelope;
110 #if 0
111 DWORD dwSize; /* Size of DPSESSIONDESC2 struct */
112 DWORD dwFlags; /* Sessions flags */
114 GUID guidInstance; /* Not 100% sure this is what it is... */
116 GUID guidApplication;
118 DWORD dwMaxPlayers;
119 DWORD dwCurrentPlayers;
121 BYTE unknown[36];
122 #else
123 DPSESSIONDESC2 sd;
124 #endif
126 DWORD dwUnknown; /* Seems to be equal to 0x5c which is a "\\" */
127 /* Encryption package string? */
129 /* At the end we have ... */
130 /* WCHAR wszSessionName[1]; Var length with NULL terminal */
132 } DPMSG_ENUMSESSIONSREPLY, *LPDPMSG_ENUMSESSIONSREPLY;
133 typedef const DPMSG_ENUMSESSIONSREPLY* LPCDPMSG_ENUMSESSIONSREPLY;
135 /* Msg sent to find out what sessions are available */
136 typedef struct tagDPMSG_ENUMSESSIONSREQUEST
138 DPMSG_SENDENVELOPE envelope;
140 GUID guidApplication;
142 DWORD dwPasswordSize; /* A Guess. This is 0x00000000. */
143 /* This might be the name server DPID which
144 is needed for the reply */
146 DWORD dwFlags; /* dwFlags from EnumSessions */
148 } DPMSG_ENUMSESSIONSREQUEST, *LPDPMSG_ENUMSESSIONSREQUEST;
149 typedef const DPMSG_ENUMSESSIONSREQUEST* LPCDPMSG_ENUMSESSIONSREQUEST;
151 /* Size is 146 received - with 18 or 20 bytes header = ~128 bytes */
152 typedef struct tagDPMSG_CREATESESSION
154 DPMSG_SENDENVELOPE envelope;
155 } DPMSG_CREATESESSION, *LPDPMSG_CREATESESSION;
156 typedef const DPMSG_CREATESESSION* LPCDPMSG_CREATESESSION;
158 /* 12 bytes msg */
159 typedef struct tagDPMSG_REQUESTNEWPLAYERID
161 DPMSG_SENDENVELOPE envelope;
163 DWORD dwFlags; /* dwFlags used for CreatePlayer */
165 } DPMSG_REQUESTNEWPLAYERID, *LPDPMSG_REQUESTNEWPLAYERID;
166 typedef const DPMSG_REQUESTNEWPLAYERID* LPCDPMSG_REQUESTNEWPLAYERID;
168 /* 48 bytes msg */
169 typedef struct tagDPMSG_NEWPLAYERIDREPLY
171 DPMSG_SENDENVELOPE envelope;
173 DPID dpidNewPlayerId;
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.
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;
182 typedef struct tagDPMSG_FORWARDADDPLAYER
184 DPMSG_SENDENVELOPE envelope;
186 DWORD unknown; /* 0 */
188 DPID dpidAppServer; /* Remote application server id */
189 DWORD unknown2[5]; /* 0x0, 0x1c, 0x6c, 0x50, 0x9 */
191 DPID dpidAppServer2; /* Remote application server id again !? */
192 DWORD unknown3[5]; /* 0x0, 0x0, 0x20, 0x0, 0x0 */
194 DPID dpidAppServer3; /* Remote application server id again !? */
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...
201 #define FORWARDADDPLAYER_UNKNOWN4_INIT { 0x30, 0xb, 0x0, 0x1e090002, 0x0, 0x0, 0x0, 0x32090002, 0x0, 0x0, 0x0, 0x0 }
203 BYTE unknown5[2]; /* 2 bytes at the end. This may be a part of something! ( 0x0, 0x0) */
205 } DPMSG_FORWARDADDPLAYER, *LPDPMSG_FORWARDADDPLAYER;
206 typedef const DPMSG_FORWARDADDPLAYER* LPCDPMSG_FORWARDADDPLAYER;
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
211 typedef struct tagDPMSG_FORWARDADDPLAYERNACK
213 DPMSG_SENDENVELOPE envelope;
214 HRESULT errorCode;
215 } DPMSG_FORWARDADDPLAYERNACK, *LPDPMSG_FORWARDADDPLAYERNACK;
216 typedef const DPMSG_FORWARDADDPLAYERNACK* LPCDPMSG_FORWARDADDPLAYERNACK;
218 #include "poppack.h"
220 #endif