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