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