Moved HDROP to shellapi.h.
[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
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
28
29 /* Message types etc. */
30 #include "pshpack1.h"
31
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 */
36
37 #define DPMSGCMD_REQUESTNEWPLAYERID   5
38
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
45
46 #define DPMSGCMD_ENUMGROUPS           17
47
48 #define DPMSGCMD_FORWARDADDPLAYER     19
49
50 #define DPMSGCMD_FORWARDADDPLAYERNACK 36
51
52 /* This is what DP 6 defines it as. Don't know what it means. All messages
53  * defined below are DPMSGVER_DP6.
54  */
55 #define DPMSGVER_DP6 11
56
57 /* MAGIC number at the start of all dplay packets ("play" in ASCII) */
58 #define DPMSGMAGIC_DPLAYMSG  0x79616c70
59
60 /* All messages sent from the system are sent with this at the beginning of
61  * the message.
62  * Size is 8 bytes
63  */
64 typedef struct tagDPMSG_SENDENVELOPE
65 {
66   DWORD dwMagic;
67   WORD  wCommandId;
68   WORD  wVersion;
69 } DPMSG_SENDENVELOPE, *LPDPMSG_SENDENVELOPE;
70 typedef const DPMSG_SENDENVELOPE* LPCDPMSG_SENDENVELOPE;
71
72 /* System messages exchanged between players seems to have this
73  * payload envelope on top of the basic envelope 
74  */
75 typedef struct tagDPMSG_SYSMSGENVELOPE
76 {
77   DWORD dwPlayerFrom;
78   DWORD dwPlayerTo;
79 } DPMSG_SYSMSGENVELOPE, *LPDPMSG_SYSMSGENVELOPE;
80 typedef const DPMSG_SYSMSGENVELOPE* LPCDPMSG_SYSMSGENVELOPE;
81
82 /* Reply sent in response to an enumsession request */
83 typedef struct tagDPMSG_ENUMSESSIONSREPLY
84 {
85   DPMSG_SENDENVELOPE envelope;
86
87 #if 0
88   DWORD dwSize;  /* Size of DPSESSIONDESC2 struct */
89   DWORD dwFlags; /* Sessions flags */
90
91   GUID guidInstance; /* Not 100% sure this is what it is... */
92
93   GUID guidApplication;
94
95   DWORD dwMaxPlayers;
96   DWORD dwCurrentPlayers;
97
98   BYTE unknown[36];
99 #else
100   DPSESSIONDESC2 sd;
101 #endif
102
103   DWORD dwUnknown;  /* Seems to be equal to 0x5c which is a "\\" */
104                     /* Encryption package string? */
105
106   /* At the end we have ... */
107   /* WCHAR wszSessionName[1];  Var length with NULL terminal */
108
109 } DPMSG_ENUMSESSIONSREPLY, *LPDPMSG_ENUMSESSIONSREPLY;
110 typedef const DPMSG_ENUMSESSIONSREPLY* LPCDPMSG_ENUMSESSIONSREPLY;
111
112 /* Msg sent to find out what sessions are available */
113 typedef struct tagDPMSG_ENUMSESSIONSREQUEST
114 {
115   DPMSG_SENDENVELOPE envelope;
116
117   GUID  guidApplication;
118
119   DWORD dwPasswordSize; /* A Guess. This is 0x00000000. */
120                         /* This might be the name server DPID which
121                            is needed for the reply */
122
123   DWORD dwFlags; /* dwFlags from EnumSessions */
124
125 } DPMSG_ENUMSESSIONSREQUEST, *LPDPMSG_ENUMSESSIONSREQUEST;
126 typedef const DPMSG_ENUMSESSIONSREQUEST* LPCDPMSG_ENUMSESSIONSREQUEST;
127
128 /* Size is 146 received - with 18 or 20 bytes header = ~128 bytes */
129 typedef struct tagDPMSG_CREATESESSION
130 {
131   DPMSG_SENDENVELOPE envelope;
132 } DPMSG_CREATESESSION, *LPDPMSG_CREATESESSION;
133 typedef const DPMSG_CREATESESSION* LPCDPMSG_CREATESESSION;
134
135 /* 12 bytes msg */
136 typedef struct tagDPMSG_REQUESTNEWPLAYERID
137 {
138   DPMSG_SENDENVELOPE envelope;
139
140   DWORD dwFlags;  /* dwFlags used for CreatePlayer */
141
142 } DPMSG_REQUESTNEWPLAYERID, *LPDPMSG_REQUESTNEWPLAYERID;
143 typedef const DPMSG_REQUESTNEWPLAYERID* LPCDPMSG_REQUESTNEWPLAYERID;
144
145 /* 48 bytes msg */
146 typedef struct tagDPMSG_NEWPLAYERIDREPLY
147 {
148   DPMSG_SENDENVELOPE envelope;
149
150   DPID dpidNewPlayerId;
151
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.
154    */
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;
158
159 typedef struct tagDPMSG_FORWARDADDPLAYER
160 {
161   DPMSG_SENDENVELOPE envelope;
162
163   DWORD unknown; /* 0 */
164
165   DPID  dpidAppServer; /* Remote application server id */
166   DWORD unknown2[5]; /* ??? */
167 #define FORWARDADDPLAYER_UNKNOWN2_INIT { 0x0, 0x1c, 0x6c, 0x50, 0x9 }
168
169   DPID  dpidAppServer2; /* Remote application server id again !? */
170   DWORD unknown3[5]; /* ??? */
171 #define FORWARDADDPLAYER_UNKNOWN3_INIT { 0x0, 0x0, 0x20, 0x0, 0x0 }
172
173   DPID  dpidAppServer3; /* Remote application server id again !? */
174
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 }
178
179   BYTE unknown5[2]; /* 2 bytes at the end. This may be a part of something! */
180 #define FORWARDADDPLAYER_UNKNOWN5_INIT { 0x0 }
181
182 } DPMSG_FORWARDADDPLAYER, *LPDPMSG_FORWARDADDPLAYER;
183 typedef const DPMSG_FORWARDADDPLAYER* LPCDPMSG_FORWARDADDPLAYER;
184
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
187  */
188 typedef struct tagDPMSG_FORWARDADDPLAYERNACK
189 {
190   DPMSG_SENDENVELOPE envelope;
191   HRESULT errorCode;
192 } DPMSG_FORWARDADDPLAYERNACK, *LPDPMSG_FORWARDADDPLAYERNACK;
193 typedef const DPMSG_FORWARDADDPLAYERNACK* LPCDPMSG_FORWARDADDPLAYERNACK;
194
195 #include "poppack.h"
196
197 #endif