Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3188 lines
119 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: SessionParser.cpp
  6. * Content: DirectPlay Service Provider Parser
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 08/08/00 micmil Created
  12. * 08/11/00 rodtoll Bug #42171 -- Build break
  13. * 01/26/01 minara Removed unused structures
  14. *@@END_MSINTERNAL
  15. *
  16. ***************************************************************************/
  17. //==================//
  18. // Standard headers //
  19. //==================//
  20. #pragma warning(push)
  21. #pragma warning(disable : 4786) // The identifier string exceeded the maximum allowable length and was truncated
  22. #include <queue>
  23. #pragma warning(pop)
  24. #include <string>
  25. #include <winsock2.h>
  26. #include <wsipx.h>
  27. //=====================//
  28. // Proprietary headers //
  29. //=====================//
  30. // Prototypes
  31. #include "SessionParser.hpp"
  32. // Session protocol headers
  33. #include "DPlay8.h"
  34. #include "Message.h" // DN_INTERNAL_MESSAGE_XXX definitions
  35. //#include "AppDesc.h" // DPN_APPLICATION_DESC_INFO definition
  36. ////////////////////////////////////////////////////////////////////////////////////
  37. // TODO: SHOULD BE MOVED TO DPLAY CORE'S HEADER FILE
  38. ////////////////////////////////////////////////////////////////////////////////////
  39. #define NAMETABLE_ENTRY_FLAG_LOCAL 0x0001
  40. #define NAMETABLE_ENTRY_FLAG_HOST 0x0002
  41. #define NAMETABLE_ENTRY_FLAG_ALL_PLAYERS_GROUP 0x0004
  42. #define NAMETABLE_ENTRY_FLAG_GROUP 0x0010
  43. #define NAMETABLE_ENTRY_FLAG_GROUP_MULTICAST 0x0020
  44. #define NAMETABLE_ENTRY_FLAG_GROUP_AUTODESTRUCT 0x0040
  45. #define NAMETABLE_ENTRY_FLAG_PEER 0x0100
  46. #define NAMETABLE_ENTRY_FLAG_CLIENT 0x0200
  47. #define NAMETABLE_ENTRY_FLAG_SERVER 0x0400
  48. #define NAMETABLE_ENTRY_FLAG_AVAILABLE 0x1000
  49. #define NAMETABLE_ENTRY_FLAG_CONNECTING 0x2000
  50. #define NAMETABLE_ENTRY_FLAG_DISCONNECTING 0x4000
  51. enum
  52. {
  53. NAMETABLE_ENTRY_FLAG_ANY_GROUP = NAMETABLE_ENTRY_FLAG_ALL_PLAYERS_GROUP | NAMETABLE_ENTRY_FLAG_GROUP |
  54. NAMETABLE_ENTRY_FLAG_GROUP_MULTICAST | NAMETABLE_ENTRY_FLAG_GROUP_AUTODESTRUCT
  55. };
  56. typedef struct _DN_NAMETABLE_INFO
  57. {
  58. DPNID dpnid;
  59. DWORD dwVersion;
  60. DWORD dwVersionNotUsed;
  61. DWORD dwEntryCount;
  62. DWORD dwMembershipCount;
  63. } DN_NAMETABLE_INFO;
  64. typedef struct _DN_NAMETABLE_ENTRY_INFO
  65. {
  66. DPNID dpnid;
  67. DPNID dpnidOwner;
  68. DWORD dwFlags;
  69. DWORD dwVersion;
  70. DWORD dwVersionNotUsed;
  71. DWORD dwDNETVersion;
  72. DWORD dwNameOffset;
  73. DWORD dwNameSize;
  74. DWORD dwDataOffset;
  75. DWORD dwDataSize;
  76. DWORD dwURLOffset;
  77. DWORD dwURLSize;
  78. } DN_NAMETABLE_ENTRY_INFO;
  79. typedef struct _DN_NAMETABLE_MEMBERSHIP_INFO
  80. {
  81. DPNID dpnidPlayer;
  82. DPNID dpnidGroup;
  83. DWORD dwVersion;
  84. DWORD dwVersionNotUsed;
  85. } DN_NAMETABLE_MEMBERSHIP_INFO, *PDN_NAMETABLE_MEMBERSHIP_INFO;
  86. struct DN_INTERNAL_MESSAGE_ALL
  87. {
  88. union
  89. {
  90. DN_INTERNAL_MESSAGE_CONNECT_INFO dnConnectInfo;
  91. DN_INTERNAL_MESSAGE_CONNECT_FAILED dnConnectFailed;
  92. DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO dnPlayerConnectInfo;
  93. DN_INTERNAL_MESSAGE_REQUEST_FAILED dnRequestFailed;
  94. DN_INTERNAL_MESSAGE_SEND_PLAYER_DPNID dnSendPlayerID;
  95. DN_INTERNAL_MESSAGE_INSTRUCT_CONNECT dnInstructConnect;
  96. DN_INTERNAL_MESSAGE_INSTRUCTED_CONNECT_FAILED dnInstructedConnectFailed;
  97. DN_INTERNAL_MESSAGE_DESTROY_PLAYER dnDestroyPlayer;
  98. DN_INTERNAL_MESSAGE_CREATE_GROUP dnCreateGroup;
  99. DN_INTERNAL_MESSAGE_DESTROY_GROUP dnDestroyGroup;
  100. DN_INTERNAL_MESSAGE_ADD_PLAYER_TO_GROUP dnAddPlayerToGroup;
  101. DN_INTERNAL_MESSAGE_DELETE_PLAYER_FROM_GROUP dnDeletePlayerFromGroup;
  102. DN_INTERNAL_MESSAGE_UPDATE_INFO dnUpdateInfo;
  103. DN_INTERNAL_MESSAGE_HOST_MIGRATE dnHostMigrate;
  104. DN_INTERNAL_MESSAGE_NAMETABLE_VERSION dnNametableVersion;
  105. DN_INTERNAL_MESSAGE_RESYNC_VERSION dnResyncVersion;
  106. DN_INTERNAL_MESSAGE_REQ_NAMETABLE_OP dnReqNametableOp;
  107. DN_INTERNAL_MESSAGE_ACK_NAMETABLE_OP dnAckNametableOp;
  108. DN_INTERNAL_MESSAGE_REQ_PROCESS_COMPLETION dnReqProcessCompletion;
  109. DN_INTERNAL_MESSAGE_PROCESS_COMPLETION dnProcessCompletion;
  110. DN_INTERNAL_MESSAGE_TERMINATE_SESSION dnTerminateSession;
  111. DN_INTERNAL_MESSAGE_INTEGRITY_CHECK dnIntegrityCheck;
  112. DN_INTERNAL_MESSAGE_INTEGRITY_CHECK_RESPONSE dnIntegrityCheckResponse;
  113. DPN_APPLICATION_DESC_INFO dnUpdateAppDescInfo;
  114. DN_NAMETABLE_ENTRY_INFO dnAddPlayer;
  115. struct
  116. {
  117. DN_INTERNAL_MESSAGE_REQ_PROCESS_COMPLETION dnReqProcessCompletionHeader;
  118. union
  119. {
  120. DN_INTERNAL_MESSAGE_REQ_CREATE_GROUP dnReqCreateGroup;
  121. DN_INTERNAL_MESSAGE_REQ_DESTROY_GROUP dnReqDestroyGroup;
  122. DN_INTERNAL_MESSAGE_REQ_ADD_PLAYER_TO_GROUP dnReqAddPlayerToGroup;
  123. DN_INTERNAL_MESSAGE_REQ_DELETE_PLAYER_FROM_GROUP dnReqDeletePlayerFromGroup;
  124. DN_INTERNAL_MESSAGE_REQ_UPDATE_INFO dnReqUpdateInfo;
  125. DN_INTERNAL_MESSAGE_REQ_INTEGRITY_CHECK dnReqIntegrityCheck;
  126. };
  127. };
  128. BYTE bOffsetBase; // used as a base for fields' offsets
  129. };
  130. };
  131. struct DN_INTERNAL_MESSAGE_FULLMSG
  132. {
  133. DWORD dwMsgType;
  134. DN_INTERNAL_MESSAGE_ALL MsgBody;
  135. };
  136. ////////////////////////////////////////////////////////////////////////////////////
  137. namespace
  138. {
  139. HPROTOCOL g_hSessionProtocol;
  140. ULPBYTE g_upbyPastEndOfFrame;
  141. //====================//
  142. // Message Type field //---------------------------------------------------------------------------------------------
  143. //====================//
  144. LABELED_DWORD g_arr_MessageTypeDWordLabels[] =
  145. { { DN_MSG_INTERNAL_PLAYER_CONNECT_INFO, "Player connection information" },
  146. { DN_MSG_INTERNAL_SEND_CONNECT_INFO, "Session information" },
  147. { DN_MSG_INTERNAL_ACK_CONNECT_INFO, "Session information has been acknowledged" },
  148. { DN_MSG_INTERNAL_SEND_PLAYER_DNID, "Player ID" },
  149. { DN_MSG_INTERNAL_CONNECT_FAILED, "Connection failed" },
  150. { DN_MSG_INTERNAL_INSTRUCT_CONNECT, "Instruction to connect" },
  151. { DN_MSG_INTERNAL_INSTRUCTED_CONNECT_FAILED, "Instruction to connect failed" },
  152. { DN_MSG_INTERNAL_NAMETABLE_VERSION, "Nametable version" },
  153. { DN_MSG_INTERNAL_RESYNC_VERSION, "Resync the version" },
  154. { DN_MSG_INTERNAL_REQ_NAMETABLE_OP, "Reqesting a nametable" },
  155. { DN_MSG_INTERNAL_ACK_NAMETABLE_OP, "Nametable acknowledgement" },
  156. { DN_MSG_INTERNAL_HOST_MIGRATE, "Host migration in process" },
  157. { DN_MSG_INTERNAL_HOST_MIGRATE_COMPLETE, "Host migration has been completed" },
  158. { DN_MSG_INTERNAL_UPDATE_APPLICATION_DESC, "Update application description" },
  159. { DN_MSG_INTERNAL_ADD_PLAYER, "Add a player" },
  160. { DN_MSG_INTERNAL_DESTROY_PLAYER, "Destroy a player" },
  161. { DN_MSG_INTERNAL_REQ_CREATE_GROUP, "Requesting a group creation" },
  162. { DN_MSG_INTERNAL_REQ_ADD_PLAYER_TO_GROUP, "Requesting a player addition to the group" },
  163. { DN_MSG_INTERNAL_REQ_DELETE_PLAYER_FROM_GROUP, "Requesting a player deletion from the group" },
  164. { DN_MSG_INTERNAL_REQ_DESTROY_GROUP, "Requesting a group destruction " },
  165. { DN_MSG_INTERNAL_REQ_UPDATE_INFO, "Requesting information update" },
  166. { DN_MSG_INTERNAL_CREATE_GROUP, "Creating a group" },
  167. { DN_MSG_INTERNAL_DESTROY_GROUP, "Destroying a group" },
  168. { DN_MSG_INTERNAL_ADD_PLAYER_TO_GROUP, "Adding a player to the group" },
  169. { DN_MSG_INTERNAL_DELETE_PLAYER_FROM_GROUP, "Deleting a player from the group" },
  170. { DN_MSG_INTERNAL_UPDATE_INFO, "Information update" },
  171. { DN_MSG_INTERNAL_BUFFER_IN_USE, "Buffer is in use" },
  172. { DN_MSG_INTERNAL_REQUEST_FAILED, "Request has failed" },
  173. { DN_MSG_INTERNAL_TERMINATE_SESSION, "Terminating session" },
  174. { DN_MSG_INTERNAL_REQ_PROCESS_COMPLETION, "Initiating reliably handled message transmission" },
  175. { DN_MSG_INTERNAL_PROCESS_COMPLETION, "Message has been handled by the message handler" },
  176. { DN_MSG_INTERNAL_REQ_INTEGRITY_CHECK, "Requesting a host to check whether another peer is still in the session" },
  177. { DN_MSG_INTERNAL_INTEGRITY_CHECK, "Querying a peer whether it's still in the session" },
  178. { DN_MSG_INTERNAL_INTEGRITY_CHECK_RESPONSE, "Acknowledgement of being still in the session" } };
  179. SET g_LabeledMessageTypeDWordSet = { sizeof(g_arr_MessageTypeDWordLabels) / sizeof(LABELED_DWORD), g_arr_MessageTypeDWordLabels };
  180. //===================//
  181. // Result Code field //----------------------------------------------------------------------------------------------
  182. //===================//
  183. LABELED_DWORD g_arr_ResultCodeDWordLabels[] = { { DPN_OK, "Success" },
  184. { DPNSUCCESS_EQUAL, "Success (equal)" },
  185. { DPNSUCCESS_NOTEQUAL, "Success (not equal)" },
  186. { DPNERR_ABORTED, "Aborted" },
  187. { DPNERR_ADDRESSING, "Addressing" },
  188. { DPNERR_ALREADYCLOSING, "Already closing" },
  189. { DPNERR_ALREADYCONNECTED, "Already connected" },
  190. { DPNERR_ALREADYDISCONNECTING, "Already disconnecting" },
  191. { DPNERR_ALREADYINITIALIZED, "Already initialized" },
  192. { DPNERR_BUFFERTOOSMALL, "Buffer is too small" },
  193. { DPNERR_CANNOTCANCEL, "Could not cancel" },
  194. { DPNERR_CANTCREATEGROUP, "Could not create a group" },
  195. { DPNERR_CANTCREATEPLAYER, "Could not create a player" },
  196. { DPNERR_CANTLAUNCHAPPLICATION, "Could not launch an application" },
  197. { DPNERR_CONNECTING, "Connecting" },
  198. { DPNERR_CONNECTIONLOST, "Connection has been lost" },
  199. { DPNERR_CONVERSION, "Conversion" },
  200. { DPNERR_DOESNOTEXIST, "Does not exist" },
  201. { DPNERR_DUPLICATECOMMAND, "Duplicate command" },
  202. { DPNERR_ENDPOINTNOTRECEIVING, "Endpoint is not receiving" },
  203. { DPNERR_ENUMQUERYTOOLARGE, "Enumeration query is too large" },
  204. { DPNERR_ENUMRESPONSETOOLARGE, "Enumeration response is too large" },
  205. { DPNERR_EXCEPTION, "Exception was thrown" },
  206. { DPNERR_GENERIC, "Generic error" },
  207. { DPNERR_GROUPNOTEMPTY, "Group is not empty" },
  208. { DPNERR_HOSTING, "Hosting" },
  209. { DPNERR_HOSTREJECTEDCONNECTION, "Host has rejected the connection" },
  210. { DPNERR_HOSTTERMINATEDSESSION, "Host terminated the session" },
  211. { DPNERR_INCOMPLETEADDRESS, "Incomplete address" },
  212. { DPNERR_INVALIDADDRESSFORMAT, "Invalid address format" },
  213. { DPNERR_INVALIDAPPLICATION, "Invalid application" },
  214. { DPNERR_INVALIDCOMMAND, "Invalid command" },
  215. { DPNERR_INVALIDENDPOINT, "Invalid endpoint" },
  216. { DPNERR_INVALIDFLAGS, "Invalid flags" },
  217. { DPNERR_INVALIDGROUP, "Invalid group" },
  218. { DPNERR_INVALIDHANDLE, "Invalid handle" },
  219. { DPNERR_INVALIDINSTANCE, "Invalid instance" },
  220. { DPNERR_INVALIDINTERFACE, "Invalid interface" },
  221. { DPNERR_INVALIDDEVICEADDRESS, "Invalid device address" },
  222. { DPNERR_INVALIDOBJECT, "Invalid object" },
  223. { DPNERR_INVALIDPARAM, "Invalid parameter" },
  224. { DPNERR_INVALIDPASSWORD, "Invalid password" },
  225. { DPNERR_INVALIDPLAYER, "Invalid player" },
  226. { DPNERR_INVALIDPOINTER, "Invalid pointer" },
  227. { DPNERR_INVALIDPRIORITY, "Invalid priority" },
  228. { DPNERR_INVALIDHOSTADDRESS, "Invalid host address" },
  229. { DPNERR_INVALIDSTRING, "Invalid string" },
  230. { DPNERR_INVALIDURL, "Invalid URL" },
  231. { DPNERR_INVALIDVERSION, "Invalid version" },
  232. { DPNERR_NOCAPS, "No CAPs" },
  233. { DPNERR_NOCONNECTION, "No connection" },
  234. { DPNERR_NOHOSTPLAYER, "No host player is present" },
  235. { DPNERR_NOINTERFACE, "No interface" },
  236. { DPNERR_NOMOREADDRESSCOMPONENTS, "No more address components" },
  237. { DPNERR_NORESPONSE, "No response" },
  238. { DPNERR_NOTALLOWED, "Not allowed" },
  239. { DPNERR_NOTHOST, "Not a host" },
  240. { DPNERR_NOTREADY, "Not ready" },
  241. { DPNERR_OUTOFMEMORY, "Out of memory" },
  242. { DPNERR_PENDING, "Pending" },
  243. { DPNERR_PLAYERLOST, "Player has been lost" },
  244. { DPNERR_PLAYERNOTREACHABLE, "Player is not reachable" },
  245. { DPNERR_SENDTOOLARGE, "Sent data is too large" },
  246. { DPNERR_SESSIONFULL, "Session is full" },
  247. { DPNERR_TABLEFULL, "Table is full" },
  248. { DPNERR_TIMEDOUT, "Timed out" },
  249. { DPNERR_UNINITIALIZED, "Uninitialized" },
  250. { DPNERR_UNSUPPORTED, "Unsupported" },
  251. { DPNERR_USERCANCEL, "User has canceled" } };
  252. SET g_LabeledResultCodeDWordSet = { sizeof(g_arr_ResultCodeDWordLabels) / sizeof(LABELED_DWORD), g_arr_ResultCodeDWordLabels };
  253. //====================//
  254. // Player Flags field //---------------------------------------------------------------------------------------------
  255. //====================//
  256. LABELED_BIT g_arr_FlagsBitLabels[] = { { 0, "Not local", "Local" }, // NAMETABLE_ENTRY_FLAG_LOCAL
  257. { 1, "Not a host", "Host" }, // NAMETABLE_ENTRY_FLAG_HOST
  258. { 2, "Not an All Players group", "All Players group" }, // NAMETABLE_ENTRY_FLAG_ALL_PLAYERS_GROUP
  259. { 4, "Not a group", "Group" }, // NAMETABLE_ENTRY_FLAG_GROUP
  260. { 5, "Not a Multicast group", "Multicast group" }, // NAMETABLE_ENTRY_FLAG_GROUP_MULTICAST
  261. { 6, "Not an Autodestruct group", "Autodestruct group" }, // NAMETABLE_ENTRY_FLAG_GROUP_AUTODESTRUCT
  262. { 8, "Not a peer", "Peer" }, // NAMETABLE_ENTRY_FLAG_PEER
  263. { 9, "Not a client", "Client" }, // NAMETABLE_ENTRY_FLAG_CLIENT
  264. { 10, "Not a server", "Server" }, // NAMETABLE_ENTRY_FLAG_SERVER
  265. { 12, "Not available", "Available" }, // NAMETABLE_ENTRY_FLAG_AVAILABLE
  266. { 13, "Not connecting", "Connecting" }, // NAMETABLE_ENTRY_FLAG_CONNECTING
  267. { 14, "Not disconnecting", "Disconnecting" } }; // NAMETABLE_ENTRY_FLAG_DISCONNECTING
  268. SET g_LabeledFlagsBitSet = { sizeof(g_arr_FlagsBitLabels) / sizeof(LABELED_BIT), g_arr_FlagsBitLabels };
  269. //===================//
  270. // Info Flags field //---------------------------------------------------------------------------------------------
  271. //===================//
  272. LABELED_BIT g_arr_InfoFlagsBitLabels[] = { { 0, "No name is included", "Name is included" }, // DPNINFO_NAME
  273. { 1, "No data is included", "Data is included" } }; // DPNINFO_DATA
  274. SET g_LabeledInfoFlagsBitSet = { sizeof(g_arr_InfoFlagsBitLabels) / sizeof(LABELED_BIT), g_arr_InfoFlagsBitLabels };
  275. //====================//
  276. // Group Flags field //---------------------------------------------------------------------------------------------
  277. //====================//
  278. LABELED_BIT g_arr_GroupFlagsBitLabels[] = { { 0, "Not an autodestruct group", "An autodestruct group" }, // DPNGROUP_AUTODESTRUCT
  279. { 5, "Not a multicast group", "A multicast group" } }; // DPNGROUP_MULTICAST
  280. SET g_LabeledGroupFlagsBitSet = { sizeof(g_arr_GroupFlagsBitLabels) / sizeof(LABELED_BIT), g_arr_GroupFlagsBitLabels };
  281. //===========================//
  282. // Maximum Number of Players //--------------------------------------------------------------------------------------------
  283. //===========================//
  284. LABELED_DWORD g_arr_MaxNumOfPlayersDWordLabels[] = { { 0, "Unlimited" } };
  285. SET g_LabeledMaxNumOfPlayersDWordSet = { sizeof(g_arr_MaxNumOfPlayersDWordLabels) / sizeof(LABELED_DWORD), g_arr_MaxNumOfPlayersDWordLabels };
  286. //=================================//
  287. // Player Destruction Reason field //---------------------------------------------------------------------------------------------
  288. //=================================//
  289. LABELED_DWORD g_arr_PlayerDestructionReasonDWordLabels[] = { { DPNDESTROYPLAYERREASON_NORMAL, "Player self-destructed" },
  290. { DPNDESTROYPLAYERREASON_CONNECTIONLOST, "Connection lost" },
  291. { DPNDESTROYPLAYERREASON_SESSIONTERMINATED, "Session has been terminated" },
  292. { DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER, "Host destroyed the player" } };
  293. SET g_LabeledPlayerDestructionReasonDWordSet = { sizeof(g_arr_PlayerDestructionReasonDWordLabels) / sizeof(LABELED_DWORD), g_arr_PlayerDestructionReasonDWordLabels };
  294. ////////////////////////////////
  295. // Custom Property Formatters //=====================================================================================
  296. ////////////////////////////////
  297. // DESCRIPTION: Custom description formatter for the Session packet summary
  298. //
  299. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  300. //
  301. // RETURNS: NOTHING
  302. //
  303. VOID WINAPIV FormatPropertyInstance_SessionSummary( LPPROPERTYINST io_pPropertyInstance )
  304. {
  305. std::string strSummary;
  306. char arr_cBuffer[10];
  307. // Check what Session frame we are dealing with
  308. DN_INTERNAL_MESSAGE_FULLMSG& rBase = *reinterpret_cast<DN_INTERNAL_MESSAGE_FULLMSG*>(io_pPropertyInstance->lpData);
  309. // Message title
  310. switch ( rBase.dwMsgType )
  311. {
  312. case DN_MSG_INTERNAL_PLAYER_CONNECT_INFO:
  313. {
  314. if ( rBase.MsgBody.dnPlayerConnectInfo.dwNameSize )
  315. {
  316. strSummary = "Player ";
  317. enum { nMAX_PLAYER_NAME = 64 };
  318. char arr_cPlayerName[nMAX_PLAYER_NAME];
  319. WideCharToMultiByte(CP_ACP, 0,
  320. reinterpret_cast<WCHAR*>( &rBase.MsgBody.bOffsetBase + rBase.MsgBody.dnPlayerConnectInfo.dwNameOffset ),
  321. rBase.MsgBody.dnPlayerConnectInfo.dwNameSize, arr_cPlayerName, sizeof(arr_cPlayerName), NULL, NULL);
  322. strSummary += arr_cPlayerName;
  323. }
  324. else
  325. {
  326. strSummary = "Unnamed player";
  327. }
  328. strSummary += " is attempting to connect to the session";
  329. break;
  330. }
  331. case DN_MSG_INTERNAL_SEND_CONNECT_INFO:
  332. {
  333. DPN_APPLICATION_DESC_INFO& rApplicationDescInfo = *reinterpret_cast<DPN_APPLICATION_DESC_INFO*>(&rBase.MsgBody.dnConnectInfo + 1);
  334. if ( rApplicationDescInfo.dwSessionNameSize )
  335. {
  336. strSummary = "Session ";
  337. enum { nMAX_SESSION_NAME = 64 };
  338. char arr_cSessionName[nMAX_SESSION_NAME];
  339. WideCharToMultiByte(CP_ACP, 0,
  340. reinterpret_cast<WCHAR*>( &rBase.MsgBody.bOffsetBase + rApplicationDescInfo.dwSessionNameOffset ),
  341. rApplicationDescInfo.dwSessionNameSize, arr_cSessionName, sizeof(arr_cSessionName), NULL, NULL);
  342. strSummary += arr_cSessionName;
  343. }
  344. else
  345. {
  346. strSummary = "Unnamed session";
  347. }
  348. strSummary += " is sending its information";
  349. break;
  350. }
  351. case DN_MSG_INTERNAL_SEND_PLAYER_DNID:
  352. {
  353. strSummary = "Player ID is 0x";
  354. strSummary += _itoa(rBase.MsgBody.dnSendPlayerID.dpnid, arr_cBuffer, 16);
  355. break;
  356. }
  357. case DN_MSG_INTERNAL_REQ_PROCESS_COMPLETION:
  358. {
  359. strSummary = "Initiating reliably handled message transmission (SyncID=0x";
  360. strSummary += _itoa(rBase.MsgBody.dnReqProcessCompletion.hCompletionOp, arr_cBuffer, 16);
  361. strSummary += ")";
  362. break;
  363. }
  364. case DN_MSG_INTERNAL_PROCESS_COMPLETION:
  365. {
  366. strSummary = "Message has been handled by the message handler (SyncID=0x";
  367. strSummary += _itoa(rBase.MsgBody.dnProcessCompletion.hCompletionOp, arr_cBuffer, 16);
  368. strSummary += ")";
  369. break;
  370. }
  371. case DN_MSG_INTERNAL_DESTROY_PLAYER:
  372. {
  373. strSummary += "Player 0x";
  374. strSummary += _itoa(rBase.MsgBody.dnDestroyPlayer.dpnidLeaving, arr_cBuffer, 16);
  375. strSummary += " is leaving the session";
  376. break;
  377. }
  378. case DN_MSG_INTERNAL_DELETE_PLAYER_FROM_GROUP:
  379. {
  380. strSummary = "Player 0x";
  381. strSummary += _itoa(rBase.MsgBody.dnDeletePlayerFromGroup.dpnidRequesting, arr_cBuffer, 16);
  382. strSummary += " is requesting to delete player 0x";
  383. strSummary += _itoa(rBase.MsgBody.dnDeletePlayerFromGroup.dpnidPlayer, arr_cBuffer, 16);
  384. strSummary += " from group 0x";
  385. strSummary += _itoa(rBase.MsgBody.dnDeletePlayerFromGroup.dpnidGroup, arr_cBuffer, 16);
  386. break;
  387. }
  388. case DN_MSG_INTERNAL_NAMETABLE_VERSION:
  389. {
  390. strSummary += "Nametable version is ";
  391. strSummary += _itoa(rBase.MsgBody.dnNametableVersion.dwVersion, arr_cBuffer, 10);
  392. break;
  393. }
  394. default:
  395. {
  396. for ( int n = 0; n < sizeof(g_arr_MessageTypeDWordLabels)/sizeof(LABELED_DWORD); ++n )
  397. {
  398. if ( g_arr_MessageTypeDWordLabels[n].Value == rBase.dwMsgType )
  399. {
  400. strSummary = g_arr_MessageTypeDWordLabels[n].Label;
  401. break;
  402. }
  403. }
  404. break;
  405. }
  406. }
  407. // Message highlights
  408. switch ( rBase.dwMsgType )
  409. {
  410. case DN_MSG_INTERNAL_HOST_MIGRATE:
  411. {
  412. strSummary += " (0x";
  413. strSummary += _itoa(rBase.MsgBody.dnHostMigrate.dpnidOldHost, arr_cBuffer, 16);
  414. strSummary += " => 0x";
  415. strSummary += _itoa(rBase.MsgBody.dnHostMigrate.dpnidNewHost, arr_cBuffer, 16);
  416. strSummary += ")";
  417. break;
  418. }
  419. }
  420. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  421. } // FormatPropertyInstance_SessionSummary
  422. // DESCRIPTION: Custom description formatter for the Application Description summary
  423. //
  424. // ARGUMENTS: io_pProperyInstance - Data of the property's instance
  425. //
  426. // RETURNS: NOTHING
  427. //
  428. VOID WINAPIV FormatPropertyInstance_AppDescSummary( LPPROPERTYINST io_pProperyInstance )
  429. {
  430. std::string strSummary;
  431. char arr_cBuffer[10];
  432. DPN_APPLICATION_DESC_INFO& rApplicationDescInfo = *reinterpret_cast<DPN_APPLICATION_DESC_INFO*>(io_pProperyInstance->lpData);
  433. if ( rApplicationDescInfo.dwSessionNameSize )
  434. {
  435. strSummary = "Session ";
  436. enum { nMAX_SESSION_NAME = 64 };
  437. char arr_cSessionName[nMAX_SESSION_NAME];
  438. // TODO: Once NetMon supports passage of pointer types via PROPERTYINSTEX,
  439. // TODO: remove the less generic reference to size of DN_INTERNAL_MESSAGE_CONNECT_INFO
  440. WideCharToMultiByte(CP_ACP, 0,
  441. reinterpret_cast<WCHAR*>( reinterpret_cast<char*>(&rApplicationDescInfo) -
  442. sizeof(DN_INTERNAL_MESSAGE_CONNECT_INFO) +
  443. rApplicationDescInfo.dwSessionNameOffset ),
  444. rApplicationDescInfo.dwSessionNameSize, arr_cSessionName, sizeof(arr_cSessionName), NULL, NULL);
  445. strSummary += arr_cSessionName;
  446. }
  447. else
  448. {
  449. strSummary = "Unnamed session";
  450. }
  451. strSummary += " is hosting ";
  452. strSummary += _itoa(rApplicationDescInfo.dwCurrentPlayers, arr_cBuffer, 10);
  453. strSummary += " out of ";
  454. strSummary += ( rApplicationDescInfo.dwMaxPlayers == 0 ? "unlimited number of" : _itoa(rApplicationDescInfo.dwMaxPlayers, arr_cBuffer, 10) );
  455. strSummary += " players";
  456. strcpy(io_pProperyInstance->szPropertyText, strSummary.c_str());
  457. } // FormatPropertyInstance_AppDescSummary
  458. // DESCRIPTION: Custom description formatter for the Name Table's summary
  459. //
  460. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  461. //
  462. // RETURNS: NOTHING
  463. //
  464. VOID WINAPIV FormatPropertyInstance_NameTableSummary( LPPROPERTYINST io_pPropertyInstance )
  465. {
  466. DN_NAMETABLE_INFO& rNameTableInfo = *reinterpret_cast<DN_NAMETABLE_INFO*>(io_pPropertyInstance->lpData);
  467. sprintf(io_pPropertyInstance->szPropertyText, "NameTable (ver=%d)", rNameTableInfo.dwVersion);
  468. } // FormatPropertyInstance_NameTableSummary
  469. // DESCRIPTION: Custom description formatter for the Application GUID field
  470. //
  471. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  472. //
  473. // RETURNS: NOTHING
  474. //
  475. VOID WINAPIV FormatPropertyInstance_ApplicationGUID( LPPROPERTYINST io_pPropertyInstance )
  476. {
  477. std::string strSummary = "Application GUID = ";
  478. REFGUID rguid = *reinterpret_cast<GUID*>(io_pPropertyInstance->lpData);
  479. enum
  480. {
  481. nMAX_GUID_STRING = 50 // more than enough characters for a symbolic representation of a GUID
  482. };
  483. OLECHAR arr_wcGUID[nMAX_GUID_STRING];
  484. StringFromGUID2(rguid, arr_wcGUID, nMAX_GUID_STRING);
  485. char arr_cGUID[nMAX_GUID_STRING];
  486. WideCharToMultiByte(CP_ACP, 0, arr_wcGUID, -1, arr_cGUID, sizeof(arr_cGUID), NULL, NULL);
  487. strSummary += arr_cGUID;
  488. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  489. } // FormatPropertyInstance_ApplicationGUID
  490. // DESCRIPTION: Custom description formatter for the Instance GUID field
  491. //
  492. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  493. //
  494. // RETURNS: NOTHING
  495. //
  496. VOID WINAPIV FormatPropertyInstance_InstanceGUID( LPPROPERTYINST io_pPropertyInstance )
  497. {
  498. std::string strSummary = "Instance GUID = ";
  499. REFGUID rguid = *reinterpret_cast<GUID*>(io_pPropertyInstance->lpData);
  500. enum
  501. {
  502. nMAX_GUID_STRING = 50 // more than enough characters for a symbolic representation of a GUID
  503. };
  504. OLECHAR arr_wcGUID[nMAX_GUID_STRING];
  505. StringFromGUID2(rguid, arr_wcGUID, nMAX_GUID_STRING);
  506. char arr_cGUID[nMAX_GUID_STRING];
  507. WideCharToMultiByte(CP_ACP, 0, arr_wcGUID, -1, arr_cGUID, sizeof(arr_cGUID), NULL, NULL);
  508. strSummary += arr_cGUID;
  509. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  510. } // FormatPropertyInstance_InstanceGUID
  511. namespace
  512. {
  513. std::string MapSetFlagsToLabels( LABELED_BIT const i_arr_FlagsBitLabels[], int i_nNumOfFlags, DWORD i_dwFlags )
  514. {
  515. std::string strString;
  516. int nBit = 0;
  517. bool bNotFirst = false;
  518. for ( DWORD dwBitMask = 1; dwBitMask != 0x80000000; dwBitMask <<= 1, ++nBit )
  519. {
  520. if ( (i_dwFlags & dwBitMask) == dwBitMask )
  521. {
  522. for ( int n = 0; n < i_nNumOfFlags; ++n )
  523. {
  524. if ( i_arr_FlagsBitLabels[n].BitNumber == nBit)
  525. {
  526. if ( bNotFirst )
  527. {
  528. strString += ", ";
  529. }
  530. bNotFirst = true;
  531. strString += i_arr_FlagsBitLabels[n].LabelOn;
  532. break;
  533. }
  534. }
  535. }
  536. }
  537. return strString;
  538. } // MapSetFlagsToLabels
  539. } // Anonymous namespace
  540. // DESCRIPTION: Custom description formatter for the Flags summary
  541. //
  542. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  543. //
  544. // RETURNS: NOTHING
  545. //
  546. VOID WINAPIV FormatPropertyInstance_FlagsSummary( LPPROPERTYINST io_pPropertyInstance )
  547. {
  548. std::string strSummary = "Flags: ";
  549. DWORD dwFlags = *reinterpret_cast<DWORD*>(io_pPropertyInstance->lpData);
  550. if ( dwFlags == 0 )
  551. {
  552. strSummary += "Must be zero";
  553. }
  554. else
  555. {
  556. strSummary += MapSetFlagsToLabels(g_arr_FlagsBitLabels, sizeof(g_arr_FlagsBitLabels)/sizeof(LABELED_BIT), dwFlags);
  557. }
  558. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  559. } // FormatPropertyInstance_FlagsSummary
  560. // DESCRIPTION: Custom description formatter for the Information Flags summary
  561. //
  562. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  563. //
  564. // RETURNS: NOTHING
  565. //
  566. VOID WINAPIV FormatPropertyInstance_InfoFlagsSummary( LPPROPERTYINST io_pPropertyInstance )
  567. {
  568. std::string strSummary = "Information Flags: ";
  569. DWORD dwInfoFlags = *reinterpret_cast<DWORD*>(io_pPropertyInstance->lpData);
  570. if ( dwInfoFlags == 0 )
  571. {
  572. strSummary += "Must be zero";
  573. }
  574. else
  575. {
  576. strSummary += MapSetFlagsToLabels(g_arr_InfoFlagsBitLabels, sizeof(g_arr_InfoFlagsBitLabels)/sizeof(LABELED_BIT), dwInfoFlags);
  577. }
  578. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  579. } // FormatPropertyInstance_InfoFlagsSummary
  580. // DESCRIPTION: Custom description formatter for the Group Flags summary
  581. //
  582. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  583. //
  584. // RETURNS: NOTHING
  585. //
  586. VOID WINAPIV FormatPropertyInstance_GroupFlagsSummary( LPPROPERTYINST io_pPropertyInstance )
  587. {
  588. std::string strSummary = "Group Flags: ";
  589. DWORD dwGroupFlags = *reinterpret_cast<DWORD*>(io_pPropertyInstance->lpData);
  590. if ( dwGroupFlags == 0 )
  591. {
  592. strSummary += "Must be zero";
  593. }
  594. else
  595. {
  596. strSummary += MapSetFlagsToLabels(g_arr_GroupFlagsBitLabels, sizeof(g_arr_GroupFlagsBitLabels)/sizeof(LABELED_BIT), dwGroupFlags);
  597. }
  598. strcpy(io_pPropertyInstance->szPropertyText, strSummary.c_str());
  599. } // FormatPropertyInstance_GroupFlagsSummary
  600. // DESCRIPTION: Custom description formatter for the Version summary
  601. //
  602. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  603. //
  604. // RETURNS: NOTHING
  605. //
  606. VOID WINAPIV FormatPropertyInstance_VersionSummary( LPPROPERTYINST io_pPropertyInstance )
  607. {
  608. sprintf(io_pPropertyInstance->szPropertyText, "Version: 0x%08X", *((DWORD*)(io_pPropertyInstance->lpByte)));
  609. } // FormatPropertyInstance_VersionSummary
  610. // DESCRIPTION: Custom description formatter for the Player ID property
  611. //
  612. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  613. //
  614. // RETURNS: NOTHING
  615. //
  616. VOID WINAPIV FormatPropertyInstance_PlayerID( LPPROPERTYINST io_pPropertyInstance )
  617. {
  618. sprintf(io_pPropertyInstance->szPropertyText, "Player ID = 0x%X", *io_pPropertyInstance->lpDword);
  619. } // FormatPropertyInstance_PlayerID
  620. // DESCRIPTION: Custom description formatter for the Old Host ID property
  621. //
  622. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  623. //
  624. // RETURNS: NOTHING
  625. //
  626. VOID WINAPIV FormatPropertyInstance_OldHostID( LPPROPERTYINST io_pPropertyInstance )
  627. {
  628. sprintf(io_pPropertyInstance->szPropertyText, "Old Host ID = 0x%X", *io_pPropertyInstance->lpDword);
  629. } // FormatPropertyInstance_OldHostID
  630. // DESCRIPTION: Custom description formatter for the New Host ID property
  631. //
  632. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  633. //
  634. // RETURNS: NOTHING
  635. //
  636. VOID WINAPIV FormatPropertyInstance_NewHostID( LPPROPERTYINST io_pPropertyInstance )
  637. {
  638. sprintf(io_pPropertyInstance->szPropertyText, "New Host ID = 0x%X", *io_pPropertyInstance->lpDword);
  639. } // FormatPropertyInstance_NewHostID
  640. // DESCRIPTION: Custom description formatter for the Group ID property
  641. //
  642. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  643. //
  644. // RETURNS: NOTHING
  645. //
  646. VOID WINAPIV FormatPropertyInstance_GroupID( LPPROPERTYINST io_pPropertyInstance )
  647. {
  648. sprintf(io_pPropertyInstance->szPropertyText, "Group ID = 0x%X", *io_pPropertyInstance->lpDword);
  649. } // FormatPropertyInstance_GroupID
  650. struct NAMETABLEENTRY_INSTDATA
  651. {
  652. DN_INTERNAL_MESSAGE_ALL* pBase;
  653. DWORD dwEntry; // if -1, then not printed
  654. };
  655. // DESCRIPTION: Custom description formatter for the NameTable Entry summary
  656. //
  657. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  658. //
  659. // RETURNS: NOTHING
  660. //
  661. VOID WINAPIV FormatPropertyInstance_NameTableEntrySummary( LPPROPERTYINST io_pPropertyInstance )
  662. {
  663. DN_NAMETABLE_ENTRY_INFO& rNameTableEntry = *reinterpret_cast<DN_NAMETABLE_ENTRY_INFO*>(io_pPropertyInstance->lpPropertyInstEx->lpData);
  664. NAMETABLEENTRY_INSTDATA& rInstData = *reinterpret_cast<NAMETABLEENTRY_INSTDATA*>(io_pPropertyInstance->lpPropertyInstEx->Byte);
  665. enum { nMAX_PLAYER_NAME = 64 };
  666. char arr_cPlayerName[nMAX_PLAYER_NAME];
  667. if ( rNameTableEntry.dwNameSize )
  668. {
  669. // Convert the UNICODE name into its ANSI equivalent
  670. WideCharToMultiByte(CP_ACP, 0, reinterpret_cast<WCHAR*>(&rInstData.pBase->bOffsetBase + rNameTableEntry.dwNameOffset),
  671. rNameTableEntry.dwNameSize, arr_cPlayerName, sizeof(arr_cPlayerName), NULL, NULL);
  672. }
  673. else
  674. {
  675. strcpy(arr_cPlayerName, "No name");
  676. }
  677. if ( rInstData.dwEntry == -1 )
  678. {
  679. sprintf(io_pPropertyInstance->szPropertyText, "%s (ID=0x%X) (%s)", arr_cPlayerName, rNameTableEntry.dpnid,
  680. MapSetFlagsToLabels(g_arr_FlagsBitLabels, sizeof(g_arr_FlagsBitLabels)/sizeof(LABELED_BIT), rNameTableEntry.dwFlags).c_str());
  681. }
  682. else
  683. {
  684. sprintf(io_pPropertyInstance->szPropertyText, "%d. %s (ID=0x%X) (%s)", rInstData.dwEntry, arr_cPlayerName, rNameTableEntry.dpnid,
  685. MapSetFlagsToLabels(g_arr_FlagsBitLabels, sizeof(g_arr_FlagsBitLabels)/sizeof(LABELED_BIT), rNameTableEntry.dwFlags).c_str());
  686. }
  687. } // FormatPropertyInstance_NameTableEntrySummary
  688. // DESCRIPTION: Custom description formatter for the NameTable Entry summary
  689. //
  690. // ARGUMENTS: io_pPropertyInstance - Data of the property's instance
  691. //
  692. // RETURNS: NOTHING
  693. //
  694. VOID WINAPIV FormatPropertyInstance_NameTableMembershipSummary( LPPROPERTYINST io_pPropertyInstance )
  695. {
  696. DN_NAMETABLE_MEMBERSHIP_INFO& rNameTableMembershipInfo = *reinterpret_cast<DN_NAMETABLE_MEMBERSHIP_INFO*>(io_pPropertyInstance->lpPropertyInstEx->lpData);
  697. sprintf(io_pPropertyInstance->szPropertyText, "%d. Player 0x%X is in group 0x%X (ver=%d)", io_pPropertyInstance->lpPropertyInstEx->Dword[0],
  698. rNameTableMembershipInfo.dpnidPlayer, rNameTableMembershipInfo.dpnidGroup, rNameTableMembershipInfo.dwVersion);
  699. } // FormatPropertyInstance_NameTableMembershipSummary
  700. //==================//
  701. // Properties table //-----------------------------------------------------------------------------------------------
  702. //==================//
  703. PROPERTYINFO g_arr_SessionProperties[] =
  704. {
  705. // Session packet summary property (SESSION_SUMMARY)
  706. {
  707. 0, // handle placeholder (MBZ)
  708. 0, // reserved (MBZ)
  709. "", // label
  710. "DPlay Session packet", // status-bar comment
  711. PROP_TYPE_SUMMARY, // data type
  712. PROP_QUAL_NONE, // data type qualifier
  713. NULL, // labeled bit set
  714. 512, // description's maximum length
  715. FormatPropertyInstance_SessionSummary // generic formatter
  716. },
  717. // Message Type property (SESSION_UNPARSABLEFRAGMENT)
  718. {
  719. 0, // handle placeholder (MBZ)
  720. 0, // reserved (MBZ)
  721. "This is a non-initial part of the fragmented Transport layer message and can not be parsed", // label
  722. "Unparsable fragment summary", // status-bar comment
  723. PROP_TYPE_SUMMARY, // data type
  724. PROP_QUAL_NONE, // data type qualifier.
  725. NULL, // labeled bit set
  726. 128, // description's maximum length
  727. FormatPropertyInstance // generic formatter
  728. },
  729. // Message Type property (SESSION_INCOMPLETEMESSAGE)
  730. {
  731. 0, // handle placeholder (MBZ)
  732. 0, // reserved (MBZ)
  733. "The rest of the data needed to parse this message has been sent in a separate fragment and can not be parsed", // label
  734. "Incomplete message summary", // status-bar comment
  735. PROP_TYPE_SUMMARY, // data type
  736. PROP_QUAL_NONE, // data type qualifier.
  737. NULL, // labeled bit set
  738. 128, // description's maximum length
  739. FormatPropertyInstance // generic formatter
  740. },
  741. // Message Type property (SESSION_INCOMPLETEFIELD)
  742. {
  743. 0, // handle placeholder (MBZ)
  744. 0, // reserved (MBZ)
  745. "The rest of the data needed to parse this field is in a separate fragment. Field value may look corrupted!", // label
  746. "Incomplete field summary", // status-bar comment
  747. PROP_TYPE_SUMMARY, // data type
  748. PROP_QUAL_NONE, // data type qualifier.
  749. NULL, // labeled bit set
  750. 150, // description's maximum length
  751. FormatPropertyInstance // generic formatter
  752. },
  753. // Message Type property (SESSION_MESSAGETYPE)
  754. {
  755. 0, // handle placeholder (MBZ)
  756. 0, // reserved (MBZ)
  757. "Message Type", // label
  758. "Message Type field", // status-bar comment
  759. PROP_TYPE_DWORD, // data type
  760. PROP_QUAL_LABELED_SET, // data type qualifier.
  761. &g_LabeledMessageTypeDWordSet, // labeled bit set
  762. 128, // description's maximum length
  763. FormatPropertyInstance // generic formatter
  764. },
  765. // Player's ID property (SESSION_PLAYERID)
  766. {
  767. 0, // handle placeholder (MBZ)
  768. 0, // reserved (MBZ)
  769. "Player ID", // label
  770. "Player ID field", // status-bar comment
  771. PROP_TYPE_DWORD, // data type
  772. PROP_QUAL_NONE, // data type qualifier.
  773. NULL, // labeled bit set
  774. 64, // description's maximum length
  775. FormatPropertyInstance_PlayerID // generic formatter
  776. },
  777. // Result Code property (SESSION_RESULTCODE)
  778. {
  779. 0, // handle placeholder (MBZ)
  780. 0, // reserved (MBZ)
  781. "Result Code", // label
  782. "Result Code field", // status-bar comment
  783. PROP_TYPE_DWORD, // data type (HRESULT)
  784. PROP_QUAL_LABELED_SET, // data type qualifier.
  785. &g_LabeledResultCodeDWordSet, // labeled byte set
  786. 64, // description's maximum length
  787. FormatPropertyInstance // generic formatter
  788. },
  789. // DPlay Version property (SESSION_DPLAYVERSION)
  790. {
  791. 0, // handle placeholder (MBZ)
  792. 0, // reserved (MBZ)
  793. "DPlay's version", // label
  794. "DPlay's version field", // status-bar comment
  795. PROP_TYPE_DWORD, // data type
  796. PROP_QUAL_NONE, // data type qualifier.
  797. NULL, // labeled bit set
  798. 64, // description's maximum length
  799. FormatPropertyInstance_VersionSummary // generic formatter
  800. },
  801. // Build Day property (SESSION_BUILDDAY)
  802. {
  803. 0, // handle placeholder (MBZ)
  804. 0, // reserved (MBZ)
  805. "Build's Day", // label
  806. "Build's Day field", // status-bar comment
  807. PROP_TYPE_BYTE, // data type
  808. PROP_QUAL_NONE, // data type qualifier.
  809. NULL, // labeled bit set
  810. 64, // description's maximum length
  811. FormatPropertyInstance // generic formatter
  812. },
  813. // Build Month property (SESSION_BUILDMONTH)
  814. {
  815. 0, // handle placeholder (MBZ)
  816. 0, // reserved (MBZ)
  817. "Build's Month", // label
  818. "Build's Month field", // status-bar comment
  819. PROP_TYPE_BYTE, // data type
  820. PROP_QUAL_NONE, // data type qualifier.
  821. NULL, // labeled bit set
  822. 64, // description's maximum length
  823. FormatPropertyInstance // generic formatter
  824. },
  825. // Build Year property (SESSION_BUILDYEAR)
  826. {
  827. 0, // handle placeholder (MBZ)
  828. 0, // reserved (MBZ)
  829. "Build's Year (starting from 2000)", // label
  830. "Build's Year field", // status-bar comment
  831. PROP_TYPE_BYTE, // data type
  832. PROP_QUAL_NONE, // data type qualifier.
  833. NULL, // labeled bit set
  834. 64, // description's maximum length
  835. FormatPropertyInstance // generic formatter
  836. },
  837. // Flags summary property (SESSION_FLAGS_SUMMARY)
  838. {
  839. 0, // handle placeholder (MBZ)
  840. 0, // reserved (MBZ)
  841. "", // label
  842. "Flags summary", // status-bar comment
  843. PROP_TYPE_SUMMARY, // data type
  844. PROP_QUAL_NONE, // data type qualifier.
  845. NULL, // labeled bit set
  846. 512, // description's maximum length
  847. FormatPropertyInstance_FlagsSummary // generic formatter
  848. },
  849. // Flags property (SESSION_FLAGS)
  850. {
  851. 0, // handle placeholder (MBZ)
  852. 0, // reserved (MBZ)
  853. "Flags", // label
  854. "Flags field", // status-bar comment
  855. PROP_TYPE_DWORD, // data type
  856. PROP_QUAL_FLAGS, // data type qualifier.
  857. &g_LabeledFlagsBitSet, // labeled bit set
  858. 2048, // description's maximum length
  859. FormatPropertyInstance // generic formatter
  860. },
  861. // Flags summary property (SESSION_INFOFLAGS_SUMMARY)
  862. {
  863. 0, // handle placeholder (MBZ)
  864. 0, // reserved (MBZ)
  865. "", // label
  866. "Information Flags summary", // status-bar comment
  867. PROP_TYPE_SUMMARY, // data type
  868. PROP_QUAL_NONE, // data type qualifier.
  869. NULL, // labeled bit set
  870. 512, // description's maximum length
  871. FormatPropertyInstance_InfoFlagsSummary // generic formatter
  872. },
  873. // Flags property (SESSION_INFOFLAGS)
  874. {
  875. 0, // handle placeholder (MBZ)
  876. 0, // reserved (MBZ)
  877. "Information Flags", // label
  878. "Information Flags field", // status-bar comment
  879. PROP_TYPE_DWORD, // data type
  880. PROP_QUAL_FLAGS, // data type qualifier.
  881. &g_LabeledInfoFlagsBitSet, // labeled bit set
  882. 2048, // description's maximum length
  883. FormatPropertyInstance // generic formatter
  884. },
  885. // Flags summary property (SESSION_GROUPFLAGS_SUMMARY)
  886. {
  887. 0, // handle placeholder (MBZ)
  888. 0, // reserved (MBZ)
  889. "", // label
  890. "Group Flags summary", // status-bar comment
  891. PROP_TYPE_SUMMARY, // data type
  892. PROP_QUAL_NONE, // data type qualifier.
  893. NULL, // labeled bit set
  894. 512, // description's maximum length
  895. FormatPropertyInstance_GroupFlagsSummary // generic formatter
  896. },
  897. // Flags property (SESSION_GROUPFLAGS)
  898. {
  899. 0, // handle placeholder (MBZ)
  900. 0, // reserved (MBZ)
  901. "Group Flags", // label
  902. "Group Flags field", // status-bar comment
  903. PROP_TYPE_DWORD, // data type
  904. PROP_QUAL_FLAGS, // data type qualifier.
  905. &g_LabeledGroupFlagsBitSet, // labeled bit set
  906. 2048, // description's maximum length
  907. FormatPropertyInstance // generic formatter
  908. },
  909. // Offset property (SESSION_FIELDOFFSET)
  910. {
  911. 0, // handle placeholder (MBZ)
  912. 0, // reserved (MBZ)
  913. "Offset", // label
  914. "Offset field", // status-bar comment
  915. PROP_TYPE_DWORD, // data type
  916. PROP_QUAL_NONE, // data type qualifier.
  917. NULL, // labeled bit set
  918. 64, // description's maximum length
  919. FormatPropertyInstance // generic formatter
  920. },
  921. // Size property (SESSION_FIELDSIZE)
  922. {
  923. 0, // handle placeholder (MBZ)
  924. 0, // reserved (MBZ)
  925. "Size", // label
  926. "Size field", // status-bar comment
  927. PROP_TYPE_DWORD, // data type
  928. PROP_QUAL_NONE, // data type qualifier.
  929. NULL, // labeled bit set
  930. 64, // description's maximum length
  931. FormatPropertyInstance // generic formatter
  932. },
  933. // Session Name property (SESSION_SESSIONNAME)
  934. {
  935. 0, // handle placeholder (MBZ)
  936. 0, // reserved (MBZ)
  937. "Session Name", // label
  938. "Session Name field", // status-bar comment
  939. PROP_TYPE_STRING, // data type
  940. PROP_QUAL_NONE, // data type qualifier.
  941. NULL, // labeled bit set
  942. 128, // description's maximum length
  943. FormatPropertyInstance // generic formatter
  944. },
  945. // No Session Name summary property (SESSION_NOSESSIONNAME_SUMMARY)
  946. {
  947. 0, // handle placeholder (MBZ)
  948. 0, // reserved (MBZ)
  949. "No Session Name", // label
  950. "No Session Name summary", // status-bar comment
  951. PROP_TYPE_SUMMARY, // data type
  952. PROP_QUAL_NONE, // data type qualifier
  953. NULL, // labeled bit set
  954. 128, // description's maximum length
  955. FormatPropertyInstance // generic formatter
  956. },
  957. // Player Name property (SESSION_PLAYERNAME)
  958. {
  959. 0, // handle placeholder (MBZ)
  960. 0, // reserved (MBZ)
  961. "Player name", // label
  962. "Player name field", // status-bar comment
  963. PROP_TYPE_STRING, // data type
  964. PROP_QUAL_NONE, // data type qualifier.
  965. NULL, // labeled bit set
  966. 128, // description's maximum length
  967. FormatPropertyInstance // generic formatter
  968. },
  969. // No Player Name summary property (SESSION_NOPLAYERNAME_SUMMARY)
  970. {
  971. 0, // handle placeholder (MBZ)
  972. 0, // reserved (MBZ)
  973. "No Player Name", // label
  974. "No Player Name summary", // status-bar comment
  975. PROP_TYPE_SUMMARY, // data type
  976. PROP_QUAL_NONE, // data type qualifier
  977. NULL, // labeled bit set
  978. 128, // description's maximum length
  979. FormatPropertyInstance // generic formatter
  980. },
  981. // Data property (SESSION_DATA)
  982. {
  983. 0, // handle placeholder (MBZ)
  984. 0, // reserved (MBZ)
  985. "Data", // label
  986. "Data field", // status-bar comment
  987. PROP_TYPE_VOID, // data type
  988. PROP_QUAL_NONE, // data type qualifier.
  989. NULL, // labeled bit set
  990. 64, // description's maximum length
  991. FormatPropertyInstance // generic formatter
  992. },
  993. // No Data summary property (SESSION_NODATA_SUMMARY)
  994. {
  995. 0, // handle placeholder (MBZ)
  996. 0, // reserved (MBZ)
  997. "No Data", // label
  998. "No Data summary", // status-bar comment
  999. PROP_TYPE_SUMMARY, // data type
  1000. PROP_QUAL_NONE, // data type qualifier
  1001. NULL, // labeled bit set
  1002. 128, // description's maximum length
  1003. FormatPropertyInstance // generic formatter
  1004. },
  1005. // Data property (SESSION_REPLY)
  1006. {
  1007. 0, // handle placeholder (MBZ)
  1008. 0, // reserved (MBZ)
  1009. "Reply", // label
  1010. "Reply field", // status-bar comment
  1011. PROP_TYPE_STRING, // data type
  1012. PROP_QUAL_NONE, // data type qualifier.
  1013. NULL, // labeled bit set
  1014. 64, // description's maximum length
  1015. FormatPropertyInstance // generic formatter
  1016. },
  1017. // No Data summary property (SESSION_NOREPLY_SUMMARY)
  1018. {
  1019. 0, // handle placeholder (MBZ)
  1020. 0, // reserved (MBZ)
  1021. "No Reply", // label
  1022. "No Reply summary", // status-bar comment
  1023. PROP_TYPE_SUMMARY, // data type
  1024. PROP_QUAL_NONE, // data type qualifier
  1025. NULL, // labeled bit set
  1026. 128, // description's maximum length
  1027. FormatPropertyInstance // generic formatter
  1028. },
  1029. // Password property (SESSION_PASSWORD)
  1030. {
  1031. 0, // handle placeholder (MBZ)
  1032. 0, // reserved (MBZ)
  1033. "Password", // label
  1034. "Password field", // status-bar comment
  1035. PROP_TYPE_STRING, // data type
  1036. PROP_QUAL_NONE, // data type qualifier.
  1037. NULL, // labeled bit set
  1038. 64, // description's maximum length
  1039. FormatPropertyInstance // generic formatter
  1040. },
  1041. // No Password summary property (SESSION_NOPASSWORD_SUMMARY)
  1042. {
  1043. 0, // handle placeholder (MBZ)
  1044. 0, // reserved (MBZ)
  1045. "No Password", // label
  1046. "No Password summary", // status-bar comment
  1047. PROP_TYPE_SUMMARY, // data type
  1048. PROP_QUAL_NONE, // data type qualifier
  1049. NULL, // labeled bit set
  1050. 128, // description's maximum length
  1051. FormatPropertyInstance // generic formatter
  1052. },
  1053. // Connection Data property (SESSION_CONNECTIONDATA)
  1054. {
  1055. 0, // handle placeholder (MBZ)
  1056. 0, // reserved (MBZ)
  1057. "Connection Data", // label
  1058. "Connection Data field", // status-bar comment
  1059. PROP_TYPE_VOID, // data type
  1060. PROP_QUAL_NONE, // data type qualifier.
  1061. NULL, // labeled bit set
  1062. 64, // description's maximum length
  1063. FormatPropertyInstance // generic formatter
  1064. },
  1065. // No Connection Data summary property (SESSION_NOCONNECTIONDATA_SUMMARY)
  1066. {
  1067. 0, // handle placeholder (MBZ)
  1068. 0, // reserved (MBZ)
  1069. "No Connection Data", // label
  1070. "No Connection Data summary", // status-bar comment
  1071. PROP_TYPE_SUMMARY, // data type
  1072. PROP_QUAL_NONE, // data type qualifier
  1073. NULL, // labeled bit set
  1074. 128, // description's maximum length
  1075. FormatPropertyInstance // generic formatter
  1076. },
  1077. // URL property (SESSION_URL)
  1078. {
  1079. 0, // handle placeholder (MBZ)
  1080. 0, // reserved (MBZ)
  1081. "URL", // label
  1082. "URL field", // status-bar comment
  1083. PROP_TYPE_STRING, // data type
  1084. PROP_QUAL_NONE, // data type qualifier.
  1085. NULL, // labeled bit set
  1086. 512, // description's maximum length
  1087. FormatPropertyInstance // generic formatter
  1088. },
  1089. // No URL summary property (SESSION_NOURL_SUMMARY)
  1090. {
  1091. 0, // handle placeholder (MBZ)
  1092. 0, // reserved (MBZ)
  1093. "No URL", // label
  1094. "No URL summary", // status-bar comment
  1095. PROP_TYPE_SUMMARY, // data type
  1096. PROP_QUAL_NONE, // data type qualifier
  1097. NULL, // labeled bit set
  1098. 128, // description's maximum length
  1099. FormatPropertyInstance // generic formatter
  1100. },
  1101. // Application GUID property (SESSION_APPGUID)
  1102. {
  1103. 0, // handle placeholder (MBZ)
  1104. 0, // reserved (MBZ)
  1105. "Application GUID", // label
  1106. "Application GUID field", // status-bar comment
  1107. PROP_TYPE_DWORD, // data type
  1108. PROP_QUAL_NONE, // data type qualifier.
  1109. NULL, // labeled bit set
  1110. 64, // description's maximum length
  1111. FormatPropertyInstance_ApplicationGUID // generic formatter
  1112. },
  1113. // Instance GUID property (SESSION_INSTGUID)
  1114. {
  1115. 0, // handle placeholder (MBZ)
  1116. 0, // reserved (MBZ)
  1117. "Instance GUID", // label
  1118. "Instance GUID field", // status-bar comment
  1119. PROP_TYPE_DWORD, // data type
  1120. PROP_QUAL_NONE, // data type qualifier.
  1121. NULL, // labeled bit set
  1122. 64, // description's maximum length
  1123. FormatPropertyInstance_InstanceGUID // generic formatter
  1124. },
  1125. // Application Description summary property (SESSION_APPDESCINFO_SUMMARY)
  1126. {
  1127. 0, // handle placeholder (MBZ)
  1128. 0, // reserved (MBZ)
  1129. "", // label
  1130. "Application Description summary", // status-bar comment
  1131. PROP_TYPE_SUMMARY, // data type
  1132. PROP_QUAL_NONE, // data type qualifier
  1133. NULL, // labeled bit set
  1134. 128, // description's maximum length
  1135. FormatPropertyInstance_AppDescSummary // generic formatter
  1136. },
  1137. // Application Description's Size property (SESSION_APPDESCINFOSIZE)
  1138. {
  1139. 0, // handle placeholder (MBZ)
  1140. 0, // reserved (MBZ)
  1141. "Application Description's Size", // label
  1142. "Application Description's Size field", // status-bar comment
  1143. PROP_TYPE_DWORD, // data type
  1144. PROP_QUAL_NONE, // data type qualifier.
  1145. NULL, // labeled bit set
  1146. 64, // description's maximum length
  1147. FormatPropertyInstance // generic formatter
  1148. },
  1149. // Maximum Number of Players property (SESSION_MAXPLAYERS)
  1150. {
  1151. 0, // handle placeholder (MBZ)
  1152. 0, // reserved (MBZ)
  1153. "Maximum Number of Players", // label
  1154. "Maximum Number of Players field", // status-bar comment
  1155. PROP_TYPE_DWORD, // data type
  1156. PROP_QUAL_LABELED_SET, // data type qualifier.
  1157. &g_LabeledMaxNumOfPlayersDWordSet, // labeled bit set
  1158. 64, // description's maximum length
  1159. FormatPropertyInstance // generic formatter
  1160. },
  1161. // Current Number of Players property (SESSION_CURRENTPLAYERS)
  1162. {
  1163. 0, // handle placeholder (MBZ)
  1164. 0, // reserved (MBZ)
  1165. "Current Number of Players", // label
  1166. "Current Number of Players field", // status-bar comment
  1167. PROP_TYPE_DWORD, // data type
  1168. PROP_QUAL_NONE, // data type qualifier.
  1169. NULL, // labeled bit set
  1170. 64, // description's maximum length
  1171. FormatPropertyInstance // generic formatter
  1172. },
  1173. // Reserved Data property (SESSION_RESERVEDDATA)
  1174. {
  1175. 0, // handle placeholder (MBZ)
  1176. 0, // reserved (MBZ)
  1177. "Reserved Data", // label
  1178. "Reserved Data", // status-bar comment
  1179. PROP_TYPE_VOID, // data type
  1180. PROP_QUAL_NONE, // data type qualifier.
  1181. NULL, // labeled bit set
  1182. 64, // description's maximum length
  1183. FormatPropertyInstance // generic formatter
  1184. },
  1185. // No Reserved Data summary property (SESSION_NORESERVEDDATA_SUMMARY)
  1186. {
  1187. 0, // handle placeholder (MBZ)
  1188. 0, // reserved (MBZ)
  1189. "No Reserved Data", // label
  1190. "No Reserved Data summary", // status-bar comment
  1191. PROP_TYPE_SUMMARY, // data type
  1192. PROP_QUAL_NONE, // data type qualifier
  1193. NULL, // labeled bit set
  1194. 128, // description's maximum length
  1195. FormatPropertyInstance // generic formatter
  1196. },
  1197. // Application Reserved Data property (SESSION_APPRESERVEDDATA)
  1198. {
  1199. 0, // handle placeholder (MBZ)
  1200. 0, // reserved (MBZ)
  1201. "Application Reserved Data", // label
  1202. "Application Reserved Data", // status-bar comment
  1203. PROP_TYPE_VOID, // data type
  1204. PROP_QUAL_NONE, // data type qualifier.
  1205. NULL, // labeled bit set
  1206. 64, // description's maximum length
  1207. FormatPropertyInstance // generic formatter
  1208. },
  1209. // No Application Reserved Data summary property (SESSION_NOAPPRESERVEDDATA_SUMMARY)
  1210. {
  1211. 0, // handle placeholder (MBZ)
  1212. 0, // reserved (MBZ)
  1213. "No Application Reserved Data", // label
  1214. "No Application Reserved Data summary", // status-bar comment
  1215. PROP_TYPE_SUMMARY, // data type
  1216. PROP_QUAL_NONE, // data type qualifier
  1217. NULL, // labeled bit set
  1218. 128, // description's maximum length
  1219. FormatPropertyInstance // generic formatter
  1220. },
  1221. // NameTable's summary property (SESSION_NAMETABLEINFO_SUMMARY)
  1222. {
  1223. 0, // handle placeholder (MBZ)
  1224. 0, // reserved (MBZ)
  1225. "", // label
  1226. "NameTable's summary", // status-bar comment
  1227. PROP_TYPE_SUMMARY, // data type
  1228. PROP_QUAL_NONE, // data type qualifier
  1229. NULL, // labeled bit set
  1230. 128, // description's maximum length
  1231. FormatPropertyInstance_NameTableSummary // generic formatter
  1232. },
  1233. // Version property (SESSION_VERSION)
  1234. {
  1235. 0, // handle placeholder (MBZ)
  1236. 0, // reserved (MBZ)
  1237. "Version", // label
  1238. "Version field", // status-bar comment
  1239. PROP_TYPE_DWORD, // data type
  1240. PROP_QUAL_NONE, // data type qualifier.
  1241. NULL, // labeled bit set
  1242. 64, // description's maximum length
  1243. FormatPropertyInstance // generic formatter
  1244. },
  1245. // RESERVED property (SESSION_RESERVED)
  1246. {
  1247. 0, // handle placeholder (MBZ)
  1248. 0, // reserved (MBZ)
  1249. "RESERVED", // label
  1250. "RESERVED field", // status-bar comment
  1251. PROP_TYPE_DWORD, // data type
  1252. PROP_QUAL_NONE, // data type qualifier.
  1253. NULL, // labeled bit set
  1254. 64, // description's maximum length
  1255. FormatPropertyInstance // generic formatter
  1256. },
  1257. // Number of Entries in the NameTable property (SESSION_NUMBEROFENTRIES)
  1258. {
  1259. 0, // handle placeholder (MBZ)
  1260. 0, // reserved (MBZ)
  1261. "Number of Entries", // label
  1262. "Number of Entries field", // status-bar comment
  1263. PROP_TYPE_DWORD, // data type
  1264. PROP_QUAL_NONE, // data type qualifier.
  1265. NULL, // labeled bit set
  1266. 64, // description's maximum length
  1267. FormatPropertyInstance // generic formatter
  1268. },
  1269. // Number of Memberships in the NameTable property (SESSION_NUMBEROFMEMBERSHIPS)
  1270. {
  1271. 0, // handle placeholder (MBZ)
  1272. 0, // reserved (MBZ)
  1273. "Number of Memberships", // label
  1274. "Number of Memberships field", // status-bar comment
  1275. PROP_TYPE_DWORD, // data type
  1276. PROP_QUAL_NONE, // data type qualifier.
  1277. NULL, // labeled bit set
  1278. 64, // description's maximum length
  1279. FormatPropertyInstance // generic formatter
  1280. },
  1281. // NameTable Entry summary property (SESSION_PLAYERS_SUMMARY)
  1282. {
  1283. 0, // handle placeholder (MBZ)
  1284. 0, // reserved (MBZ)
  1285. "Players", // label
  1286. "NameTable player entries summary", // status-bar comment
  1287. PROP_TYPE_SUMMARY, // data type
  1288. PROP_QUAL_NONE, // data type qualifier
  1289. NULL, // labeled bit set
  1290. 128, // description's maximum length
  1291. FormatPropertyInstance // generic formatter
  1292. },
  1293. // NameTable Entry summary property (SESSION_GROUPS_SUMMARY)
  1294. {
  1295. 0, // handle placeholder (MBZ)
  1296. 0, // reserved (MBZ)
  1297. "Groups", // label
  1298. "NameTable group entries summary", // status-bar comment
  1299. PROP_TYPE_SUMMARY, // data type
  1300. PROP_QUAL_NONE, // data type qualifier
  1301. NULL, // labeled bit set
  1302. 128, // description's maximum length
  1303. FormatPropertyInstance // generic formatter
  1304. },
  1305. // NameTable Entry summary property (SESSION_NAMETABLEENTRY_SUMMARY)
  1306. {
  1307. 0, // handle placeholder (MBZ)
  1308. 0, // reserved (MBZ)
  1309. "", // label
  1310. "NameTable Entry summary", // status-bar comment
  1311. PROP_TYPE_SUMMARY, // data type
  1312. PROP_QUAL_NONE, // data type qualifier
  1313. NULL, // labeled bit set
  1314. 256, // description's maximum length
  1315. FormatPropertyInstance_NameTableEntrySummary // generic formatter
  1316. },
  1317. // Owner's ID property (SESSION_OWNERID)
  1318. {
  1319. 0, // handle placeholder (MBZ)
  1320. 0, // reserved (MBZ)
  1321. "Owner ID", // label
  1322. "Owner ID field", // status-bar comment
  1323. PROP_TYPE_DWORD, // data type
  1324. PROP_QUAL_NONE, // data type qualifier.
  1325. NULL, // labeled bit set
  1326. 64, // description's maximum length
  1327. FormatPropertyInstance // generic formatter
  1328. },
  1329. // NameTable Memberships summary property (SESSION_NAMETABLEMEMBERSHIPS_SUMMARY)
  1330. {
  1331. 0, // handle placeholder (MBZ)
  1332. 0, // reserved (MBZ)
  1333. "Memberships", // label
  1334. "Memberships summary", // status-bar comment
  1335. PROP_TYPE_SUMMARY, // data type
  1336. PROP_QUAL_NONE, // data type qualifier
  1337. NULL, // labeled bit set
  1338. 128, // description's maximum length
  1339. FormatPropertyInstance // generic formatter
  1340. },
  1341. // NameTable Membership Entry summary property (SESSION_NAMETABLEMEMBERSHIPENTRY_SUMMARY)
  1342. {
  1343. 0, // handle placeholder (MBZ)
  1344. 0, // reserved (MBZ)
  1345. "", // label
  1346. "Membership Entry summary", // status-bar comment
  1347. PROP_TYPE_SUMMARY, // data type
  1348. PROP_QUAL_NONE, // data type qualifier
  1349. NULL, // labeled bit set
  1350. 128, // description's maximum length
  1351. FormatPropertyInstance_NameTableMembershipSummary // generic formatter
  1352. },
  1353. // Group's ID property (SESSION_GROUPID)
  1354. {
  1355. 0, // handle placeholder (MBZ)
  1356. 0, // reserved (MBZ)
  1357. "Group ID", // label
  1358. "Group ID field", // status-bar comment
  1359. PROP_TYPE_DWORD, // data type
  1360. PROP_QUAL_NONE, // data type qualifier.
  1361. NULL, // labeled bit set
  1362. 64, // description's maximum length
  1363. FormatPropertyInstance_GroupID // generic formatter
  1364. },
  1365. // Old Host ID property (SESSION_OLDHOSTID)
  1366. {
  1367. 0, // handle placeholder (MBZ)
  1368. 0, // reserved (MBZ)
  1369. "Old Host ID", // label
  1370. "Old Host ID field", // status-bar comment
  1371. PROP_TYPE_DWORD, // data type
  1372. PROP_QUAL_NONE, // data type qualifier.
  1373. NULL, // labeled bit set
  1374. 64, // description's maximum length
  1375. FormatPropertyInstance_OldHostID // generic formatter
  1376. },
  1377. // New Host ID property (SESSION_NEWHOSTID)
  1378. {
  1379. 0, // handle placeholder (MBZ)
  1380. 0, // reserved (MBZ)
  1381. "New Host ID", // label
  1382. "New Host ID field", // status-bar comment
  1383. PROP_TYPE_DWORD, // data type
  1384. PROP_QUAL_NONE, // data type qualifier.
  1385. NULL, // labeled bit set
  1386. 64, // description's maximum length
  1387. FormatPropertyInstance_NewHostID // generic formatter
  1388. },
  1389. // New Host ID property (SESSION_SYNCID)
  1390. {
  1391. 0, // handle placeholder (MBZ)
  1392. 0, // reserved (MBZ)
  1393. "Synchronization ID", // label
  1394. "Synchronization ID field", // status-bar comment
  1395. PROP_TYPE_DWORD, // data type
  1396. PROP_QUAL_NONE, // data type qualifier.
  1397. NULL, // labeled bit set
  1398. 64, // description's maximum length
  1399. FormatPropertyInstance // generic formatter
  1400. },
  1401. // Player's ID property (SESSION_REQUESTINGPLAYERID)
  1402. {
  1403. 0, // handle placeholder (MBZ)
  1404. 0, // reserved (MBZ)
  1405. "Requesting Player ID", // label
  1406. "Requesting Player ID field", // status-bar comment
  1407. PROP_TYPE_DWORD, // data type
  1408. PROP_QUAL_NONE, // data type qualifier.
  1409. NULL, // labeled bit set
  1410. 64, // description's maximum length
  1411. FormatPropertyInstance // generic formatter
  1412. },
  1413. // Player Destruction Reason property (SESSION_PLAYERDESTRUCTIONREASON)
  1414. {
  1415. 0, // handle placeholder (MBZ)
  1416. 0, // reserved (MBZ)
  1417. "Reason", // label
  1418. "Reason field", // status-bar comment
  1419. PROP_TYPE_DWORD, // data type
  1420. PROP_QUAL_LABELED_SET, // data type qualifier.
  1421. &g_LabeledPlayerDestructionReasonDWordSet, // labeled bit set
  1422. 64, // description's maximum length
  1423. FormatPropertyInstance // generic formatter
  1424. },
  1425. // Target Peer's ID property (SESSION_TARGETPEERID)
  1426. {
  1427. 0, // handle placeholder (MBZ)
  1428. 0, // reserved (MBZ)
  1429. "Target Peer ID", // label
  1430. "Target Peer ID field", // status-bar comment
  1431. PROP_TYPE_DWORD, // data type
  1432. PROP_QUAL_NONE, // data type qualifier.
  1433. NULL, // labeled bit set
  1434. 64, // description's maximum length
  1435. FormatPropertyInstance // generic formatter
  1436. },
  1437. // Requesting Peer's ID property (SESSION_REQUESTINGPEERID)
  1438. {
  1439. 0, // handle placeholder (MBZ)
  1440. 0, // reserved (MBZ)
  1441. "Requesting Peer ID", // label
  1442. "Requesting Peer ID field", // status-bar comment
  1443. PROP_TYPE_DWORD, // data type
  1444. PROP_QUAL_NONE, // data type qualifier.
  1445. NULL, // labeled bit set
  1446. 64, // description's maximum length
  1447. FormatPropertyInstance // generic formatter
  1448. }
  1449. };
  1450. enum
  1451. {
  1452. nNUM_OF_Session_PROPS = sizeof(g_arr_SessionProperties) / sizeof(PROPERTYINFO)
  1453. };
  1454. // Properties' indices
  1455. enum
  1456. {
  1457. SESSION_SUMMARY = 0,
  1458. SESSION_UNPARSABLEFRAGMENT,
  1459. SESSION_INCOMPLETEMESSAGE,
  1460. SESSION_INCOMPLETEFIELD,
  1461. SESSION_MESSAGETYPE,
  1462. SESSION_PLAYERID,
  1463. SESSION_RESULTCODE,
  1464. SESSION_DPLAYVERSION,
  1465. SESSION_BUILDDAY,
  1466. SESSION_BUILDMONTH,
  1467. SESSION_BUILDYEAR,
  1468. SESSION_FLAGS_SUMMARY,
  1469. SESSION_FLAGS,
  1470. SESSION_INFOFLAGS_SUMMARY,
  1471. SESSION_INFOFLAGS,
  1472. SESSION_GROUPFLAGS_SUMMARY,
  1473. SESSION_GROUPFLAGS,
  1474. SESSION_FIELDOFFSET,
  1475. SESSION_FIELDSIZE,
  1476. SESSION_SESSIONNAME,
  1477. SESSION_NOSESSIONNAME_SUMMARY,
  1478. SESSION_PLAYERNAME,
  1479. SESSION_NOPLAYERNAME_SUMMARY,
  1480. SESSION_DATA,
  1481. SESSION_NODATA_SUMMARY,
  1482. SESSION_REPLY,
  1483. SESSION_NOREPLY_SUMMARY,
  1484. SESSION_PASSWORD,
  1485. SESSION_NOPASSWORD_SUMMARY,
  1486. SESSION_CONNECTIONDATA,
  1487. SESSION_NOCONNECTIONDATA_SUMMARY,
  1488. SESSION_URL,
  1489. SESSION_NOURL_SUMMARY,
  1490. SESSION_APPGUID,
  1491. SESSION_INSTGUID,
  1492. SESSION_APPDESCINFO_SUMMARY,
  1493. SESSION_APPDESCINFOSIZE,
  1494. SESSION_MAXPLAYERS,
  1495. SESSION_CURRENTPLAYERS,
  1496. SESSION_RESERVEDDATA,
  1497. SESSION_NORESERVEDDATA_SUMMARY,
  1498. SESSION_APPRESERVEDDATA,
  1499. SESSION_NOAPPRESERVEDDATA_SUMMARY,
  1500. SESSION_NAMETABLEINFO_SUMMARY,
  1501. SESSION_VERSION,
  1502. SESSION_RESERVED,
  1503. SESSION_NUMBEROFENTRIES,
  1504. SESSION_NUMBEROFMEMBERSHIPS,
  1505. SESSION_PLAYERS_SUMMARY,
  1506. SESSION_GROUPS_SUMMARY,
  1507. SESSION_NAMETABLEENTRY_SUMMARY,
  1508. SESSION_OWNERID,
  1509. SESSION_NAMETABLEMEMBERSHIPS_SUMMARY,
  1510. SESSION_NAMETABLEMEMBERSHIPENTRY_SUMMARY,
  1511. SESSION_GROUPID,
  1512. SESSION_OLDHOSTID,
  1513. SESSION_NEWHOSTID,
  1514. SESSION_SYNCID,
  1515. SESSION_REQUESTINGPLAYERID,
  1516. SESSION_PLAYERDESTRUCTIONREASON,
  1517. SESSION_TARGETPEERID,
  1518. SESSION_REQUESTINGPEERID
  1519. };
  1520. } // anonymous namespace
  1521. // DESCRIPTION: Creates and fills-in a properties database for the protocol.
  1522. // Network Monitor uses this database to determine which properties the protocol supports.
  1523. //
  1524. // ARGUMENTS: i_hSessionProtocol - The handle of the protocol provided by the Network Monitor.
  1525. //
  1526. // RETURNS: NOTHING
  1527. //
  1528. DPLAYPARSER_API VOID BHAPI SessionRegister( HPROTOCOL i_hSessionProtocol )
  1529. {
  1530. // TODO: PROCESS THE RETURN VALUE
  1531. CreatePropertyDatabase(i_hSessionProtocol, nNUM_OF_Session_PROPS);
  1532. // Add the properties to the database
  1533. for( int nProp=0; nProp < nNUM_OF_Session_PROPS; ++nProp )
  1534. {
  1535. // TODO: PROCESS THE RETURN VALUE
  1536. AddProperty(i_hSessionProtocol, &g_arr_SessionProperties[nProp]);
  1537. }
  1538. } // SessionRegister
  1539. // DESCRIPTION: Frees the resources used to create the protocol property database.
  1540. //
  1541. // ARGUMENTS: i_hSessionProtocol - The handle of the protocol provided by the Network Monitor.
  1542. //
  1543. // RETURNS: NOTHING
  1544. //
  1545. DPLAYPARSER_API VOID WINAPI SessionDeregister( HPROTOCOL i_hProtocol )
  1546. {
  1547. // TODO: PROCESS THE RETURN VALUE
  1548. DestroyPropertyDatabase(i_hProtocol);
  1549. } // SessionDeregister
  1550. namespace
  1551. {
  1552. // DESCRIPTION: Parses the Session frame to find its size (in bytes) NOT including the user data
  1553. //
  1554. // ARGUMENTS: i_pbSessionFrame - Pointer to the start of the unclaimed data. Typically, the unclaimed data is located
  1555. // in the middle of a frame because a previous parser has claimed data before this parser.
  1556. //
  1557. // RETURNS: Size of the Sessionecified Session frame (in bytes)
  1558. //
  1559. int SessionHeaderSize( LPBYTE i_pbSessionFrame )
  1560. {
  1561. DN_INTERNAL_MESSAGE_FULLMSG& rSessionFrame = *reinterpret_cast<DN_INTERNAL_MESSAGE_FULLMSG*>(i_pbSessionFrame);
  1562. DN_INTERNAL_MESSAGE_ALL& rMsgBody = rSessionFrame.MsgBody;
  1563. int nHeaderSize = sizeof(rSessionFrame.dwMsgType);
  1564. switch ( rSessionFrame.dwMsgType )
  1565. {
  1566. case DN_MSG_INTERNAL_PLAYER_CONNECT_INFO:
  1567. {
  1568. nHeaderSize += sizeof(rMsgBody.dnPlayerConnectInfo) + rMsgBody.dnPlayerConnectInfo.dwNameSize + rMsgBody.dnPlayerConnectInfo.dwDataSize +
  1569. rMsgBody.dnPlayerConnectInfo.dwPasswordSize + rMsgBody.dnPlayerConnectInfo.dwConnectDataSize + rMsgBody.dnPlayerConnectInfo.dwURLSize;
  1570. break;
  1571. }
  1572. case DN_MSG_INTERNAL_SEND_CONNECT_INFO:
  1573. {
  1574. DPN_APPLICATION_DESC_INFO& rApplicationDescInfo = *reinterpret_cast<DPN_APPLICATION_DESC_INFO*>(&rMsgBody.dnConnectInfo + 1);
  1575. DN_NAMETABLE_INFO& rNameTableInfo = *reinterpret_cast<DN_NAMETABLE_INFO*>(&rApplicationDescInfo + 1);
  1576. DN_NAMETABLE_ENTRY_INFO* pNameTableEntryInfo = reinterpret_cast<DN_NAMETABLE_ENTRY_INFO*>(&rNameTableInfo + 1);
  1577. nHeaderSize += sizeof(DN_INTERNAL_MESSAGE_CONNECT_INFO) + rApplicationDescInfo.dwSize + sizeof(DN_NAMETABLE_INFO) +
  1578. rNameTableInfo.dwEntryCount * sizeof(DN_NAMETABLE_ENTRY_INFO) +
  1579. rNameTableInfo.dwMembershipCount * sizeof(DN_NAMETABLE_MEMBERSHIP_INFO);
  1580. for ( size_t sztEntry = 1; sztEntry <= rNameTableInfo.dwEntryCount; ++sztEntry, ++pNameTableEntryInfo )
  1581. {
  1582. nHeaderSize += pNameTableEntryInfo->dwNameSize + pNameTableEntryInfo->dwDataSize + pNameTableEntryInfo->dwURLSize;
  1583. }
  1584. break;
  1585. }
  1586. case DN_MSG_INTERNAL_ACK_CONNECT_INFO:
  1587. {
  1588. // No fields
  1589. break;
  1590. }
  1591. case DN_MSG_INTERNAL_SEND_PLAYER_DNID:
  1592. {
  1593. nHeaderSize += sizeof(rMsgBody.dnSendPlayerID);
  1594. break;
  1595. }
  1596. case DN_MSG_INTERNAL_CONNECT_FAILED:
  1597. {
  1598. nHeaderSize += sizeof(rMsgBody.dnConnectFailed);
  1599. break;
  1600. }
  1601. case DN_MSG_INTERNAL_INSTRUCT_CONNECT:
  1602. {
  1603. nHeaderSize += sizeof(rMsgBody.dnInstructConnect);
  1604. break;
  1605. }
  1606. case DN_MSG_INTERNAL_INSTRUCTED_CONNECT_FAILED:
  1607. {
  1608. nHeaderSize += sizeof(rMsgBody.dnInstructedConnectFailed);
  1609. break;
  1610. }
  1611. case DN_MSG_INTERNAL_NAMETABLE_VERSION:
  1612. {
  1613. nHeaderSize += sizeof(rMsgBody.dnNametableVersion);
  1614. break;
  1615. }
  1616. case DN_MSG_INTERNAL_RESYNC_VERSION:
  1617. {
  1618. nHeaderSize += sizeof(rMsgBody.dnResyncVersion);
  1619. break;
  1620. }
  1621. case DN_MSG_INTERNAL_REQ_NAMETABLE_OP:
  1622. {
  1623. nHeaderSize += sizeof(rMsgBody.dnReqNametableOp);
  1624. break;
  1625. }
  1626. case DN_MSG_INTERNAL_ACK_NAMETABLE_OP:
  1627. {
  1628. nHeaderSize += sizeof(rMsgBody.dnAckNametableOp);
  1629. const DN_NAMETABLE_OP_INFO* pOpInfo = reinterpret_cast<DN_NAMETABLE_OP_INFO*>(&rMsgBody.dnAckNametableOp.dwNumEntries + 1);
  1630. for ( size_t sztOp = 0; sztOp < rMsgBody.dnAckNametableOp.dwNumEntries; ++sztOp, ++pOpInfo )
  1631. {
  1632. nHeaderSize += sizeof(*pOpInfo) + pOpInfo->dwOpSize;
  1633. }
  1634. break;
  1635. }
  1636. case DN_MSG_INTERNAL_HOST_MIGRATE:
  1637. {
  1638. nHeaderSize += sizeof(rMsgBody.dnHostMigrate);
  1639. break;
  1640. }
  1641. case DN_MSG_INTERNAL_HOST_MIGRATE_COMPLETE:
  1642. {
  1643. // No fields
  1644. break;
  1645. }
  1646. case DN_MSG_INTERNAL_UPDATE_APPLICATION_DESC:
  1647. {
  1648. nHeaderSize += rMsgBody.dnUpdateAppDescInfo.dwSize;
  1649. break;
  1650. }
  1651. case DN_MSG_INTERNAL_ADD_PLAYER:
  1652. {
  1653. nHeaderSize += sizeof(rMsgBody.dnAddPlayer) + rMsgBody.dnAddPlayer.dwDataSize +
  1654. rMsgBody.dnAddPlayer.dwNameSize + rMsgBody.dnAddPlayer.dwURLSize;
  1655. break;
  1656. }
  1657. case DN_MSG_INTERNAL_DESTROY_PLAYER:
  1658. {
  1659. nHeaderSize += sizeof(rMsgBody.dnDestroyPlayer);
  1660. break;
  1661. }
  1662. case DN_MSG_INTERNAL_REQ_CREATE_GROUP:
  1663. {
  1664. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletionHeader) + sizeof(rMsgBody.dnReqCreateGroup) +
  1665. rMsgBody.dnReqCreateGroup.dwNameSize + rMsgBody.dnReqCreateGroup.dwDataSize;
  1666. break;
  1667. }
  1668. case DN_MSG_INTERNAL_REQ_ADD_PLAYER_TO_GROUP:
  1669. case DN_MSG_INTERNAL_REQ_DELETE_PLAYER_FROM_GROUP: // same structure as in AddPlayerToGroup
  1670. {
  1671. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletionHeader) + sizeof(rMsgBody.dnAddPlayerToGroup);
  1672. break;
  1673. }
  1674. case DN_MSG_INTERNAL_REQ_DESTROY_GROUP:
  1675. {
  1676. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletionHeader) + sizeof(rMsgBody.dnReqDestroyGroup);
  1677. break;
  1678. }
  1679. case DN_MSG_INTERNAL_REQ_UPDATE_INFO:
  1680. {
  1681. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletionHeader) + sizeof(rMsgBody.dnReqUpdateInfo) +
  1682. rMsgBody.dnReqUpdateInfo.dwNameSize + rMsgBody.dnReqUpdateInfo.dwDataSize;
  1683. break;
  1684. }
  1685. case DN_MSG_INTERNAL_CREATE_GROUP:
  1686. {
  1687. nHeaderSize += sizeof(rMsgBody.dnCreateGroup);
  1688. break;
  1689. }
  1690. case DN_MSG_INTERNAL_DESTROY_GROUP:
  1691. {
  1692. nHeaderSize += sizeof(rMsgBody.dnDestroyGroup);
  1693. break;
  1694. }
  1695. case DN_MSG_INTERNAL_ADD_PLAYER_TO_GROUP:
  1696. case DN_MSG_INTERNAL_DELETE_PLAYER_FROM_GROUP: // same structure as AddPlayerToGroup
  1697. {
  1698. nHeaderSize += sizeof(rMsgBody.dnAddPlayerToGroup);
  1699. break;
  1700. }
  1701. case DN_MSG_INTERNAL_UPDATE_INFO:
  1702. {
  1703. nHeaderSize += sizeof(rMsgBody.dnUpdateInfo) + rMsgBody.dnUpdateInfo.dwNameSize + rMsgBody.dnUpdateInfo.dwDataSize;
  1704. break;
  1705. }
  1706. case DN_MSG_INTERNAL_BUFFER_IN_USE:
  1707. {
  1708. // No fields
  1709. break;
  1710. }
  1711. case DN_MSG_INTERNAL_REQUEST_FAILED:
  1712. {
  1713. nHeaderSize += sizeof(rMsgBody.dnRequestFailed);
  1714. break;
  1715. }
  1716. case DN_MSG_INTERNAL_TERMINATE_SESSION:
  1717. {
  1718. nHeaderSize += sizeof(rMsgBody.dnTerminateSession) + rMsgBody.dnTerminateSession.dwTerminateDataSize;
  1719. break;
  1720. }
  1721. case DN_MSG_INTERNAL_REQ_PROCESS_COMPLETION:
  1722. {
  1723. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletion);
  1724. break;
  1725. }
  1726. case DN_MSG_INTERNAL_PROCESS_COMPLETION :
  1727. {
  1728. nHeaderSize += sizeof(rMsgBody.dnProcessCompletion);
  1729. break;
  1730. }
  1731. case DN_MSG_INTERNAL_REQ_INTEGRITY_CHECK:
  1732. {
  1733. nHeaderSize += sizeof(rMsgBody.dnReqProcessCompletionHeader) + sizeof(rMsgBody.dnReqIntegrityCheck);
  1734. break;
  1735. }
  1736. case DN_MSG_INTERNAL_INTEGRITY_CHECK:
  1737. {
  1738. nHeaderSize += sizeof(rMsgBody.dnIntegrityCheck);
  1739. break;
  1740. }
  1741. case DN_MSG_INTERNAL_INTEGRITY_CHECK_RESPONSE:
  1742. {
  1743. nHeaderSize += sizeof(rMsgBody.dnIntegrityCheckResponse);
  1744. break;
  1745. }
  1746. default:
  1747. {
  1748. return -1; // TODO: DPF(0, "Unknown Session frame!");
  1749. }
  1750. }
  1751. return nHeaderSize;
  1752. } // SessionHeaderSize
  1753. } // Anonymous namespace
  1754. // DESCRIPTION: Indicates whether a piece of data is recognized as the protocol that the parser detects.
  1755. //
  1756. // ARGUMENTS: i_hFrame - The handle to the frame that contains the data.
  1757. // i_pbMacFrame - The pointer to the first byte of the frame; the pointer provides a way to view
  1758. // the data that the other parsers recognize.
  1759. // i_pbSessionFrame - Pointer to the start of the unclaimed data. Typically, the unclaimed data is located
  1760. // in the middle of a frame because a previous parser has claimed data before this parser.
  1761. // i_dwMacType - MAC value of the first protocol in a frame. Typically, the i_dwMacType value is used
  1762. // when the parser must identify the first protocol in the frame. Can be one of the following:
  1763. // MAC_TYPE_ETHERNET = 802.3, MAC_TYPE_TOKENRING = 802.5, MAC_TYPE_FDDI ANSI = X3T9.5.
  1764. // i_dwBytesLeft - The remaining number of bytes from a location in the frame to the end of the frame.
  1765. // i_hPrevProtocol - Handle of the previous protocol.
  1766. // i_dwPrevProtOffset - Offset of the previous protocol (from the beginning of the frame).
  1767. // o_pdwProtocolStatus - Protocol status indicator. Must be one of the following: PROTOCOL_STATUS_RECOGNIZED,
  1768. // PROTOCOL_STATUS_NOT_RECOGNIZED, PROTOCOL_STATUS_CLAIMED, PROTOCOL_STATUS_NEXT_PROTOCOL.
  1769. // o_phNextProtocol - Placeholder for the handle of the next protocol. This parameter is set when the parser identifies
  1770. // the protocol that follows its own protocol.
  1771. // io_pdwptrInstData - On input, a pointer to the instance data from the previous protocol.
  1772. // On output, a pointer to the instance data for the current protocol.
  1773. //
  1774. // RETURNS: If the function is successful, the return value is a pointer to the first byte after the recognized parser data.
  1775. // If the parser claims all the remaining data, the return value is NULL. If the function is unsuccessful, the return
  1776. // value is the initial value of the i_pbSessionFrame parameter.
  1777. //
  1778. DPLAYPARSER_API LPBYTE BHAPI SessionRecognizeFrame( HFRAME i_hFrame,
  1779. ULPBYTE i_upbMacFrame,
  1780. ULPBYTE i_upbySessionFrame,
  1781. DWORD i_dwMacType,
  1782. DWORD i_dwBytesLeft,
  1783. HPROTOCOL i_hPrevProtocol,
  1784. DWORD i_dwPrevProtOffset,
  1785. LPDWORD o_pdwProtocolStatus,
  1786. LPHPROTOCOL o_phNextProtocol,
  1787. PDWORD_PTR io_pdwptrInstData )
  1788. {
  1789. // Validate the amount of unclaimed data
  1790. enum
  1791. {
  1792. // TODO: CHANGE TO PROPER MIN SIZE
  1793. nMIN_SessionHeaderSize = sizeof(DWORD),
  1794. nNUMBER_OF_MSG_TYPES = sizeof(g_arr_MessageTypeDWordLabels) / sizeof(LABELED_DWORD)
  1795. };
  1796. for ( int nTypeIndex = 0; nTypeIndex < nNUMBER_OF_MSG_TYPES; ++nTypeIndex )
  1797. {
  1798. if ( g_arr_MessageTypeDWordLabels[nTypeIndex].Value == *i_upbySessionFrame )
  1799. {
  1800. break;
  1801. }
  1802. }
  1803. // Validate the packet as DPlay Session type
  1804. if ( ((i_dwBytesLeft >= nMIN_SessionHeaderSize) && (nTypeIndex < nNUMBER_OF_MSG_TYPES)) || (*io_pdwptrInstData == 0) )
  1805. {
  1806. // Claim the remaining data
  1807. *o_pdwProtocolStatus = PROTOCOL_STATUS_CLAIMED;
  1808. return ( g_upbyPastEndOfFrame = i_upbySessionFrame + SessionHeaderSize(i_upbySessionFrame) );
  1809. }
  1810. // Assume the unclaimed data is not recognizable
  1811. *o_pdwProtocolStatus = PROTOCOL_STATUS_NOT_RECOGNIZED;
  1812. return i_upbySessionFrame;
  1813. } // SessionRecognizeFrame
  1814. namespace
  1815. {
  1816. // DESCRIPTION:
  1817. //
  1818. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  1819. // i_nProperty -
  1820. // i_pSessionFrame -
  1821. // i_pdwOffset -
  1822. // i_pdwSize -
  1823. // i_dwFlags -
  1824. // i_nLevel -
  1825. //
  1826. // RETURNS: NOTHING
  1827. //
  1828. void AttachValueOffsetSizeProperties( HFRAME i_hFrame, int i_nProperty, DN_INTERNAL_MESSAGE_ALL* i_pBase,
  1829. DWORD* i_pdwOffset, DWORD* i_pdwSize, DWORD i_dwFlags, int i_nLevel )
  1830. {
  1831. if ( *i_pdwSize )
  1832. {
  1833. // Value field
  1834. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[i_nProperty].hProperty,
  1835. *i_pdwSize, &i_pBase->bOffsetBase + *i_pdwOffset, 0, i_nLevel, i_dwFlags);
  1836. // If the field's value is outside the frame, let the user know it will show up incomplete or corrupted
  1837. if ( &i_pBase->bOffsetBase + *i_pdwOffset + *i_pdwSize >= g_upbyPastEndOfFrame )
  1838. {
  1839. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INCOMPLETEFIELD].hProperty,
  1840. *i_pdwSize, &i_pBase->bOffsetBase + *i_pdwOffset, 0, i_nLevel+1, 0);
  1841. }
  1842. // Value's Offset field
  1843. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FIELDOFFSET].hProperty,
  1844. sizeof(*i_pdwOffset), i_pdwOffset, 0, i_nLevel + 1, 0);
  1845. // Value's Size field
  1846. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FIELDSIZE].hProperty,
  1847. sizeof(*i_pdwSize), i_pdwSize, 0, i_nLevel + 1, 0);
  1848. }
  1849. else
  1850. {
  1851. // No field summary
  1852. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[i_nProperty + 1].hProperty,
  1853. sizeof(*i_pdwOffset) + sizeof(*i_pdwSize), i_pdwOffset, 0, i_nLevel, 0);
  1854. }
  1855. }// AttachValueOffsetSizeProperties
  1856. // DESCRIPTION: Attaches the properties to the nametable entry
  1857. //
  1858. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed
  1859. // i_pNameTableEntryInfo - Pointer to the beginning of nametable's entry
  1860. // i_dwEntry - Ordinal number of the entry (if -1, then not printed)
  1861. // i_pSessionFrame - Pointer to the beginning of the protocol data in a frame.
  1862. //
  1863. // RETURNS: NOTHING
  1864. //
  1865. void AttachNameTableEntry(HFRAME i_hFrame, DN_NAMETABLE_ENTRY_INFO* i_pNameTableEntryInfo, DWORD i_dwEntry,
  1866. DN_INTERNAL_MESSAGE_ALL* i_pBase )
  1867. {
  1868. NAMETABLEENTRY_INSTDATA rInstData = { i_pBase, i_dwEntry };
  1869. // NameTable entry summary
  1870. AttachPropertyInstanceEx(i_hFrame, g_arr_SessionProperties[SESSION_NAMETABLEENTRY_SUMMARY].hProperty,
  1871. sizeof(*i_pNameTableEntryInfo), i_pNameTableEntryInfo,
  1872. sizeof(rInstData), &rInstData, 0, 3, 0);
  1873. if ( i_pNameTableEntryInfo->dwFlags & NAMETABLE_ENTRY_FLAG_ANY_GROUP )
  1874. {
  1875. // Player ID field
  1876. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  1877. sizeof(i_pNameTableEntryInfo->dpnid), &i_pNameTableEntryInfo->dpnid, 0, 4, 0);
  1878. }
  1879. else
  1880. {
  1881. // Group ID field
  1882. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  1883. sizeof(i_pNameTableEntryInfo->dpnid), &i_pNameTableEntryInfo->dpnid, 0, 4, 0);
  1884. }
  1885. // Owner ID field
  1886. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_OWNERID].hProperty,
  1887. sizeof(i_pNameTableEntryInfo->dpnidOwner), &i_pNameTableEntryInfo->dpnidOwner, 0, 4, 0);
  1888. // Flags summary
  1889. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS_SUMMARY].hProperty,
  1890. sizeof(i_pNameTableEntryInfo->dwFlags), &i_pNameTableEntryInfo->dwFlags, 0, 4, 0);
  1891. // Flags field
  1892. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS].hProperty,
  1893. sizeof(i_pNameTableEntryInfo->dwFlags), &i_pNameTableEntryInfo->dwFlags, 0, 5, 0);
  1894. // Version field
  1895. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  1896. sizeof(i_pNameTableEntryInfo->dwVersion), &i_pNameTableEntryInfo->dwVersion, 0, 4, 0);
  1897. // RESERVED field
  1898. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  1899. sizeof(i_pNameTableEntryInfo->dwVersionNotUsed), &i_pNameTableEntryInfo->dwVersionNotUsed, 0, 4, 0);
  1900. // DPlay Version field
  1901. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_DPLAYVERSION].hProperty,
  1902. sizeof(i_pNameTableEntryInfo->dwDNETVersion), &i_pNameTableEntryInfo->dwDNETVersion, 0, 4, 0);
  1903. // Player Name field
  1904. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PLAYERNAME, i_pBase,
  1905. &i_pNameTableEntryInfo->dwNameOffset, &i_pNameTableEntryInfo->dwNameSize, IFLAG_UNICODE, 4);
  1906. // Data field
  1907. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  1908. &i_pNameTableEntryInfo->dwDataOffset, &i_pNameTableEntryInfo->dwDataSize, NULL, 4);
  1909. // URL field
  1910. AttachValueOffsetSizeProperties(i_hFrame, SESSION_URL, i_pBase,
  1911. &i_pNameTableEntryInfo->dwURLOffset, &i_pNameTableEntryInfo->dwURLSize, NULL, 4);
  1912. } // AttachNameTableEntry
  1913. // DESCRIPTION: Attaches the properties to the Application Description structure
  1914. //
  1915. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  1916. // i_pbSessionFrame - Pointer to the beginning of the protocol data in a frame.
  1917. // i_pApplicationDescInfo - Pointer to the beginning of the application description.
  1918. //
  1919. // RETURNS: NOTHING
  1920. //
  1921. void AttachApplicationDescriptionProperties( HFRAME i_hFrame, DN_INTERNAL_MESSAGE_ALL* i_pBase,
  1922. DPN_APPLICATION_DESC_INFO* i_pApplicationDescInfo )
  1923. {
  1924. // Application Description summary
  1925. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_APPDESCINFO_SUMMARY].hProperty,
  1926. sizeof(*i_pApplicationDescInfo), i_pApplicationDescInfo, 0, 1, 0);
  1927. // Application Description's Size field
  1928. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_APPDESCINFOSIZE].hProperty,
  1929. sizeof(i_pApplicationDescInfo->dwSize), &i_pApplicationDescInfo->dwSize, 0, 2, 0);
  1930. // Flags summary
  1931. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS_SUMMARY].hProperty,
  1932. sizeof(i_pApplicationDescInfo->dwFlags), &i_pApplicationDescInfo->dwFlags, 0, 2, 0);
  1933. // Flags field
  1934. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS].hProperty,
  1935. sizeof(i_pApplicationDescInfo->dwFlags), &i_pApplicationDescInfo->dwFlags, 0, 3, 0);
  1936. // Maximum Number of Players field
  1937. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_MAXPLAYERS].hProperty,
  1938. sizeof(i_pApplicationDescInfo->dwMaxPlayers), &i_pApplicationDescInfo->dwMaxPlayers, 0, 2, 0);
  1939. // Current Number of Players field
  1940. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_CURRENTPLAYERS].hProperty,
  1941. sizeof(i_pApplicationDescInfo->dwCurrentPlayers), &i_pApplicationDescInfo->dwCurrentPlayers, 0, 2, 0);
  1942. // Session Name field
  1943. AttachValueOffsetSizeProperties(i_hFrame, SESSION_SESSIONNAME, i_pBase,
  1944. &i_pApplicationDescInfo->dwSessionNameOffset, &i_pApplicationDescInfo->dwSessionNameSize, IFLAG_UNICODE, 2);
  1945. // Password field
  1946. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PASSWORD, i_pBase,
  1947. &i_pApplicationDescInfo->dwPasswordOffset, &i_pApplicationDescInfo->dwPasswordSize, IFLAG_UNICODE, 2);
  1948. // Reserved Data field
  1949. AttachValueOffsetSizeProperties(i_hFrame, SESSION_RESERVEDDATA, i_pBase,
  1950. &i_pApplicationDescInfo->dwReservedDataOffset, &i_pApplicationDescInfo->dwReservedDataSize, NULL, 2);
  1951. // Application Reserved Data field
  1952. AttachValueOffsetSizeProperties(i_hFrame, SESSION_APPRESERVEDDATA, i_pBase,
  1953. &i_pApplicationDescInfo->dwApplicationReservedDataOffset, &i_pApplicationDescInfo->dwApplicationReservedDataSize, NULL, 2);
  1954. // Instance GUID field
  1955. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INSTGUID].hProperty,
  1956. sizeof(i_pApplicationDescInfo->guidInstance), &i_pApplicationDescInfo->guidInstance, 0, 2, 0);
  1957. // Application GUID field
  1958. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_APPGUID].hProperty,
  1959. sizeof(i_pApplicationDescInfo->guidApplication), &i_pApplicationDescInfo->guidApplication, 0, 2, 0);
  1960. } // AttachApplicationDescriptionProperties
  1961. // DESCRIPTION: Attaches the properties to the Session Information packet
  1962. //
  1963. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  1964. // i_pbSessionFrame - Pointer to the beginning of the protocol data in a frame.
  1965. //
  1966. // RETURNS: NOTHING
  1967. //
  1968. void AttachSessionInformationProperties( HFRAME i_hFrame, DN_INTERNAL_MESSAGE_ALL* i_pBase )
  1969. {
  1970. // Reply field
  1971. AttachValueOffsetSizeProperties(i_hFrame, SESSION_REPLY, i_pBase,
  1972. &i_pBase->dnConnectInfo.dwReplyOffset, &i_pBase->dnConnectInfo.dwReplySize, NULL, 1);
  1973. DPN_APPLICATION_DESC_INFO& rApplicationDescInfo = *reinterpret_cast<DPN_APPLICATION_DESC_INFO*>(&i_pBase->dnConnectInfo + 1);
  1974. AttachApplicationDescriptionProperties(i_hFrame, i_pBase, &rApplicationDescInfo);
  1975. DN_NAMETABLE_INFO& rNameTableInfo = *reinterpret_cast<DN_NAMETABLE_INFO*>(&rApplicationDescInfo + 1);
  1976. DN_NAMETABLE_ENTRY_INFO* pNameTableEntryInfo = reinterpret_cast<DN_NAMETABLE_ENTRY_INFO*>(&rNameTableInfo + 1);
  1977. // Calculating the size of the nametable
  1978. size_t sztNameTableSize = sizeof(DN_NAMETABLE_INFO) +
  1979. rNameTableInfo.dwEntryCount * sizeof(DN_NAMETABLE_ENTRY_INFO) +
  1980. rNameTableInfo.dwMembershipCount * sizeof(DN_NAMETABLE_MEMBERSHIP_INFO);
  1981. //
  1982. for ( size_t sztEntry = 1; sztEntry <= rNameTableInfo.dwEntryCount; ++sztEntry, ++pNameTableEntryInfo )
  1983. {
  1984. sztNameTableSize += pNameTableEntryInfo->dwNameSize + pNameTableEntryInfo->dwDataSize + pNameTableEntryInfo->dwURLSize;
  1985. }
  1986. // Nametable's summary
  1987. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NAMETABLEINFO_SUMMARY].hProperty,
  1988. sztNameTableSize, &rNameTableInfo, 0, 1, 0);
  1989. // Player ID field
  1990. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  1991. sizeof(rNameTableInfo.dpnid), &rNameTableInfo.dpnid, 0, 2, 0);
  1992. // Version field
  1993. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  1994. sizeof(rNameTableInfo.dwVersion), &rNameTableInfo.dwVersion, 0, 2, 0);
  1995. // RESERVED field
  1996. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  1997. sizeof(rNameTableInfo.dwVersionNotUsed), &rNameTableInfo.dwVersionNotUsed, 0, 2, 0);
  1998. // Number of NameTable Entries field
  1999. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NUMBEROFENTRIES].hProperty,
  2000. sizeof(rNameTableInfo.dwEntryCount), &rNameTableInfo.dwEntryCount, 0, 2, 0);
  2001. // Number of NameTable Memberships field
  2002. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NUMBEROFMEMBERSHIPS].hProperty,
  2003. sizeof(rNameTableInfo.dwMembershipCount), &rNameTableInfo.dwMembershipCount, 0, 2, 0);
  2004. pNameTableEntryInfo = reinterpret_cast<DN_NAMETABLE_ENTRY_INFO*>(&rNameTableInfo + 1);
  2005. // NameTable Player entries summary
  2006. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERS_SUMMARY].hProperty,
  2007. rNameTableInfo.dwEntryCount * sizeof(*pNameTableEntryInfo), pNameTableEntryInfo, 0, 2, 0);
  2008. std::queue<DN_NAMETABLE_ENTRY_INFO*> queGroups;
  2009. // Process player entries
  2010. int nPlayerEntry = 1;
  2011. for ( sztEntry = 1; sztEntry <= rNameTableInfo.dwEntryCount; ++sztEntry, ++pNameTableEntryInfo )
  2012. {
  2013. // If the entry contains group information, enqueue it for later processing
  2014. if ( pNameTableEntryInfo->dwFlags & NAMETABLE_ENTRY_FLAG_ANY_GROUP )
  2015. {
  2016. queGroups.push(pNameTableEntryInfo);
  2017. }
  2018. else
  2019. {
  2020. AttachNameTableEntry(i_hFrame, pNameTableEntryInfo, nPlayerEntry, i_pBase);
  2021. ++nPlayerEntry;
  2022. }
  2023. }
  2024. DN_NAMETABLE_MEMBERSHIP_INFO* pNameTableMembershipInfo = reinterpret_cast<DN_NAMETABLE_MEMBERSHIP_INFO*>(pNameTableEntryInfo);
  2025. // Process group entries
  2026. if ( !queGroups.empty() )
  2027. {
  2028. pNameTableEntryInfo = reinterpret_cast<DN_NAMETABLE_ENTRY_INFO*>(&rNameTableInfo + 1);
  2029. // NameTable Group entries summary
  2030. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPS_SUMMARY].hProperty,
  2031. rNameTableInfo.dwEntryCount * sizeof(*pNameTableEntryInfo), pNameTableEntryInfo, 0, 2, 0);
  2032. for ( nPlayerEntry = 1; !queGroups.empty(); queGroups.pop(), ++nPlayerEntry )
  2033. {
  2034. AttachNameTableEntry(i_hFrame, queGroups.front(), nPlayerEntry, i_pBase);
  2035. }
  2036. }
  2037. // NameTable's Memberships summary
  2038. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NAMETABLEMEMBERSHIPS_SUMMARY].hProperty,
  2039. rNameTableInfo.dwMembershipCount * sizeof(*pNameTableMembershipInfo), pNameTableMembershipInfo, 0, 2, 0);
  2040. for ( sztEntry = 1; sztEntry <= rNameTableInfo.dwMembershipCount; ++sztEntry, ++pNameTableMembershipInfo )
  2041. {
  2042. // NameTable's Membership Entry summary
  2043. AttachPropertyInstanceEx(i_hFrame, g_arr_SessionProperties[SESSION_NAMETABLEMEMBERSHIPENTRY_SUMMARY].hProperty,
  2044. sizeof(*pNameTableMembershipInfo), pNameTableMembershipInfo,
  2045. sizeof(sztEntry), &sztEntry, 0, 3, 0);
  2046. // Player ID field
  2047. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2048. sizeof(pNameTableMembershipInfo->dpnidPlayer), &pNameTableMembershipInfo->dpnidPlayer, 0, 4, 0);
  2049. // Group ID field
  2050. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  2051. sizeof(pNameTableMembershipInfo->dpnidGroup), &pNameTableMembershipInfo->dpnidGroup, 0, 4, 0);
  2052. // Version field
  2053. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2054. sizeof(pNameTableMembershipInfo->dwVersion), &pNameTableMembershipInfo->dwVersion, 0, 4, 0);
  2055. // RESERVED field
  2056. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2057. sizeof(pNameTableMembershipInfo->dwVersionNotUsed), &pNameTableMembershipInfo->dwVersionNotUsed, 0, 4, 0);
  2058. }
  2059. } // AttachSessionInformationProperties
  2060. // DESCRIPTION: Attaches the properties to the Session Information packet
  2061. //
  2062. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  2063. // i_pPlayerConnectionInfo - Pointer to the connecting player's information.
  2064. //
  2065. // RETURNS: NOTHING
  2066. //
  2067. void AttachPlayerInformationProperties( HFRAME i_hFrame, DN_INTERNAL_MESSAGE_ALL* i_pBase )
  2068. {
  2069. // Synonym declaration (to make code more readable)
  2070. DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO& rPlayerConnectInfo = i_pBase->dnPlayerConnectInfo;
  2071. // Flags summary
  2072. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS_SUMMARY].hProperty,
  2073. sizeof(rPlayerConnectInfo.dwFlags), &rPlayerConnectInfo.dwFlags, 0, 1, 0);
  2074. // Flags field
  2075. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_FLAGS].hProperty,
  2076. sizeof(rPlayerConnectInfo.dwFlags), &rPlayerConnectInfo.dwFlags, 0, 2, 0);
  2077. // DPlay Version field
  2078. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_DPLAYVERSION].hProperty,
  2079. sizeof(rPlayerConnectInfo.dwDNETVersion), &rPlayerConnectInfo.dwDNETVersion, 0, 1, 0);
  2080. // DPlay Version Day subfield
  2081. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_BUILDDAY].hProperty,
  2082. sizeof(BYTE), reinterpret_cast<LPBYTE>(&rPlayerConnectInfo.dwDNETVersion) + 2, 0, 2, 0);
  2083. // DPlay Version Month subfield
  2084. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_BUILDMONTH].hProperty,
  2085. sizeof(BYTE), reinterpret_cast<LPBYTE>(&rPlayerConnectInfo.dwDNETVersion) + 1, 0, 2, 0);
  2086. // DPlay Version Year subfield
  2087. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_BUILDYEAR].hProperty,
  2088. sizeof(BYTE), &rPlayerConnectInfo.dwDNETVersion, 0, 2, 0);
  2089. // Player Name field
  2090. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PLAYERNAME, i_pBase,
  2091. &rPlayerConnectInfo.dwNameOffset, &rPlayerConnectInfo.dwNameSize, IFLAG_UNICODE, 1);
  2092. // Data field
  2093. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  2094. &rPlayerConnectInfo.dwDataOffset, &rPlayerConnectInfo.dwDataSize, NULL, 1);
  2095. // Password field
  2096. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PASSWORD, i_pBase,
  2097. &rPlayerConnectInfo.dwPasswordOffset, &rPlayerConnectInfo.dwPasswordSize, IFLAG_UNICODE, 1);
  2098. // Connection Data field
  2099. AttachValueOffsetSizeProperties(i_hFrame, SESSION_CONNECTIONDATA, i_pBase,
  2100. &rPlayerConnectInfo.dwConnectDataOffset, &rPlayerConnectInfo.dwConnectDataSize, NULL, 1);
  2101. // URL field
  2102. AttachValueOffsetSizeProperties(i_hFrame, SESSION_URL, i_pBase,
  2103. &rPlayerConnectInfo.dwURLOffset, &rPlayerConnectInfo.dwURLSize, NULL, 1);
  2104. // Instance GUID field
  2105. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INSTGUID].hProperty,
  2106. sizeof(rPlayerConnectInfo.guidInstance), &rPlayerConnectInfo.guidInstance, 0, 1, 0);
  2107. // Application GUID field
  2108. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_APPGUID].hProperty,
  2109. sizeof(rPlayerConnectInfo.guidApplication), &rPlayerConnectInfo.guidApplication, 0, 1, 0);
  2110. } // AttachPlayerInformationProperties
  2111. // DESCRIPTION: Attaches the properties to a Session message packet or delegates to appropriate function
  2112. //
  2113. // ARGUMENTS: i_dwMsgType - Message ID
  2114. // i_hFrame - Handle of the frame that is being parsed.
  2115. // i_pSessionFrame - Pointer to the start of the recognized data.
  2116. //
  2117. // RETURNS: NOTHING
  2118. //
  2119. void AttachMessageProperties( const DWORD i_dwMsgType, const HFRAME i_hFrame, DN_INTERNAL_MESSAGE_ALL *const i_pBase )
  2120. {
  2121. switch ( i_dwMsgType )
  2122. {
  2123. case DN_MSG_INTERNAL_PLAYER_CONNECT_INFO:
  2124. {
  2125. AttachPlayerInformationProperties(i_hFrame, i_pBase);
  2126. break;
  2127. }
  2128. case DN_MSG_INTERNAL_SEND_CONNECT_INFO:
  2129. {
  2130. AttachSessionInformationProperties(i_hFrame, i_pBase);
  2131. break;
  2132. }
  2133. case DN_MSG_INTERNAL_ACK_CONNECT_INFO:
  2134. {
  2135. // No fields
  2136. break;
  2137. }
  2138. case DN_MSG_INTERNAL_SEND_PLAYER_DNID:
  2139. {
  2140. // Player ID field
  2141. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2142. sizeof(i_pBase->dnSendPlayerID.dpnid), &i_pBase->dnSendPlayerID.dpnid, 0, 1, 0);
  2143. break;
  2144. }
  2145. case DN_MSG_INTERNAL_INSTRUCT_CONNECT:
  2146. {
  2147. // Player ID field
  2148. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2149. sizeof(i_pBase->dnInstructConnect.dpnid), &i_pBase->dnInstructConnect.dpnid, 0, 1, 0);
  2150. // Version field
  2151. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2152. sizeof(i_pBase->dnInstructConnect.dwVersion), &i_pBase->dnInstructConnect.dwVersion, 0, 1, 0);
  2153. // RESERVED field
  2154. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2155. sizeof(i_pBase->dnInstructConnect.dwVersionNotUsed), &i_pBase->dnInstructConnect.dwVersionNotUsed, 0, 1, 0);
  2156. break;
  2157. }
  2158. case DN_MSG_INTERNAL_CONNECT_FAILED:
  2159. {
  2160. // Result Code field
  2161. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESULTCODE].hProperty,
  2162. sizeof(i_pBase->dnConnectFailed.hResultCode), &i_pBase->dnConnectFailed.hResultCode, 0, 1, 0);
  2163. // Reply field
  2164. AttachValueOffsetSizeProperties(i_hFrame, SESSION_REPLY, i_pBase,
  2165. &i_pBase->dnConnectFailed.dwReplyOffset, &i_pBase->dnConnectFailed.dwReplySize, NULL, 1);
  2166. break;
  2167. }
  2168. case DN_MSG_INTERNAL_INSTRUCTED_CONNECT_FAILED:
  2169. {
  2170. // Player ID field
  2171. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2172. sizeof(i_pBase->dnInstructedConnectFailed.dpnid), &i_pBase->dnInstructedConnectFailed.dpnid, 0, 1, 0);
  2173. break;
  2174. }
  2175. case DN_MSG_INTERNAL_ACK_NAMETABLE_OP:
  2176. {
  2177. // Number of Entries field
  2178. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NUMBEROFENTRIES].hProperty,
  2179. sizeof(i_pBase->dnAckNametableOp.dwNumEntries), &i_pBase->dnAckNametableOp.dwNumEntries, 0, 1, 0);
  2180. const DN_NAMETABLE_OP_INFO* pOpInfo = reinterpret_cast<DN_NAMETABLE_OP_INFO*>(&i_pBase->dnAckNametableOp.dwNumEntries + 1);
  2181. for ( size_t sztOp = 0; sztOp < i_pBase->dnAckNametableOp.dwNumEntries; ++sztOp, ++pOpInfo )
  2182. {
  2183. AttachMessageProperties(pOpInfo->dwMsgId, i_hFrame, reinterpret_cast<DN_INTERNAL_MESSAGE_ALL*>(reinterpret_cast<BYTE*>(i_pBase) + pOpInfo->dwOpOffset));
  2184. }
  2185. break;
  2186. }
  2187. case DN_MSG_INTERNAL_HOST_MIGRATE:
  2188. {
  2189. // Old Host ID field
  2190. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_OLDHOSTID].hProperty,
  2191. sizeof(i_pBase->dnHostMigrate.dpnidOldHost), &i_pBase->dnHostMigrate.dpnidOldHost, 0, 1, 0);
  2192. // New Host ID field
  2193. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_NEWHOSTID].hProperty,
  2194. sizeof(i_pBase->dnHostMigrate.dpnidNewHost), &i_pBase->dnHostMigrate.dpnidNewHost, 0, 1, 0);
  2195. break;
  2196. }
  2197. case DN_MSG_INTERNAL_NAMETABLE_VERSION:
  2198. case DN_MSG_INTERNAL_REQ_NAMETABLE_OP: // same structure as in NameTableVersion
  2199. case DN_MSG_INTERNAL_RESYNC_VERSION: // same structure as in NameTableVersion
  2200. {
  2201. // Version field
  2202. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2203. sizeof(i_pBase->dnNametableVersion.dwVersion), &i_pBase->dnNametableVersion.dwVersion, 0, 1, 0);
  2204. // RESERVED field
  2205. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2206. sizeof(i_pBase->dnNametableVersion.dwVersionNotUsed), &i_pBase->dnNametableVersion.dwVersionNotUsed, 0, 1, 0);
  2207. break;
  2208. }
  2209. case DN_MSG_INTERNAL_HOST_MIGRATE_COMPLETE:
  2210. {
  2211. // No fields
  2212. break;
  2213. }
  2214. case DN_MSG_INTERNAL_UPDATE_APPLICATION_DESC:
  2215. {
  2216. AttachApplicationDescriptionProperties(i_hFrame, i_pBase, &i_pBase->dnUpdateAppDescInfo);
  2217. break;
  2218. }
  2219. case DN_MSG_INTERNAL_ADD_PLAYER:
  2220. {
  2221. AttachNameTableEntry(i_hFrame, &i_pBase->dnAddPlayer, -1, i_pBase);
  2222. break;
  2223. }
  2224. case DN_MSG_INTERNAL_DESTROY_PLAYER:
  2225. {
  2226. // Player ID field
  2227. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2228. sizeof(i_pBase->dnDestroyPlayer.dpnidLeaving), &i_pBase->dnDestroyPlayer.dpnidLeaving, 0, 1, 0);
  2229. // Version field
  2230. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2231. sizeof(i_pBase->dnDestroyPlayer.dwVersion), &i_pBase->dnDestroyPlayer.dwVersion, 0, 1, 0);
  2232. // RESERVED field
  2233. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2234. sizeof(i_pBase->dnDestroyPlayer.dwVersionNotUsed), &i_pBase->dnDestroyPlayer.dwVersionNotUsed, 0, 1, 0);
  2235. // Player Destruction Reason field
  2236. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERDESTRUCTIONREASON].hProperty,
  2237. sizeof(i_pBase->dnDestroyPlayer.dwDestroyReason), &i_pBase->dnDestroyPlayer.dwDestroyReason, 0, 1, 0);
  2238. break;
  2239. }
  2240. case DN_MSG_INTERNAL_REQ_CREATE_GROUP:
  2241. {
  2242. // Synchronization ID field
  2243. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2244. sizeof(i_pBase->dnReqProcessCompletionHeader.hCompletionOp), &i_pBase->dnReqProcessCompletionHeader.hCompletionOp, 0, 1, 0);
  2245. // Group flags summary
  2246. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPFLAGS_SUMMARY].hProperty,
  2247. sizeof(i_pBase->dnReqCreateGroup.dwGroupFlags), &i_pBase->dnReqCreateGroup.dwGroupFlags, 0, 1, 0);
  2248. // Group field
  2249. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPFLAGS].hProperty,
  2250. sizeof(i_pBase->dnReqCreateGroup.dwGroupFlags), &i_pBase->dnReqCreateGroup.dwGroupFlags, 0, 2, 0);
  2251. // Info flags summary
  2252. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS_SUMMARY].hProperty,
  2253. sizeof(i_pBase->dnReqCreateGroup.dwInfoFlags), &i_pBase->dnReqCreateGroup.dwInfoFlags, 0, 1, 0);
  2254. // Info flags field
  2255. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS].hProperty,
  2256. sizeof(i_pBase->dnReqCreateGroup.dwInfoFlags), &i_pBase->dnReqCreateGroup.dwInfoFlags, 0, 2, 0);
  2257. // Player Name field
  2258. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PLAYERNAME, i_pBase,
  2259. &i_pBase->dnReqCreateGroup.dwNameOffset, &i_pBase->dnReqCreateGroup.dwNameSize, IFLAG_UNICODE, 1);
  2260. // Data field
  2261. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  2262. &i_pBase->dnReqCreateGroup.dwDataOffset, &i_pBase->dnReqCreateGroup.dwDataSize, NULL, 1);
  2263. break;
  2264. }
  2265. case DN_MSG_INTERNAL_REQ_ADD_PLAYER_TO_GROUP:
  2266. case DN_MSG_INTERNAL_REQ_DELETE_PLAYER_FROM_GROUP: // same structure as in AddPlayerToGroup
  2267. {
  2268. // Synchronization ID field
  2269. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2270. sizeof(i_pBase->dnReqProcessCompletionHeader.hCompletionOp), &i_pBase->dnReqProcessCompletionHeader.hCompletionOp, 0, 1, 0);
  2271. // Group ID field
  2272. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  2273. sizeof(i_pBase->dnReqAddPlayerToGroup.dpnidGroup), &i_pBase->dnReqAddPlayerToGroup.dpnidGroup, 0, 1, 0);
  2274. // Player ID field
  2275. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2276. sizeof(i_pBase->dnReqAddPlayerToGroup.dpnidPlayer), &i_pBase->dnReqAddPlayerToGroup.dpnidPlayer, 0, 1, 0);
  2277. break;
  2278. }
  2279. case DN_MSG_INTERNAL_REQ_DESTROY_GROUP:
  2280. {
  2281. // Synchronization ID field
  2282. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2283. sizeof(i_pBase->dnReqProcessCompletionHeader.hCompletionOp), &i_pBase->dnReqProcessCompletionHeader.hCompletionOp, 0, 1, 0);
  2284. // Group ID field
  2285. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  2286. sizeof(i_pBase->dnReqDestroyGroup.dpnidGroup), &i_pBase->dnReqDestroyGroup.dpnidGroup, 0, 1, 0);
  2287. break;
  2288. }
  2289. case DN_MSG_INTERNAL_REQ_UPDATE_INFO:
  2290. {
  2291. // Synchronization ID field
  2292. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2293. sizeof(i_pBase->dnReqProcessCompletionHeader.hCompletionOp), &i_pBase->dnReqProcessCompletionHeader.hCompletionOp, 0, 1, 0);
  2294. // Player ID field
  2295. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2296. sizeof(i_pBase->dnReqUpdateInfo.dpnid), &i_pBase->dnReqUpdateInfo.dpnid, 0, 1, 0);
  2297. // Info flags summary
  2298. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS_SUMMARY].hProperty,
  2299. sizeof(i_pBase->dnReqUpdateInfo.dwInfoFlags), &i_pBase->dnReqUpdateInfo.dwInfoFlags, 0, 1, 0);
  2300. // Info flags field
  2301. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS].hProperty,
  2302. sizeof(i_pBase->dnReqUpdateInfo.dwInfoFlags), &i_pBase->dnReqUpdateInfo.dwInfoFlags, 0, 2, 0);
  2303. // Player Name field
  2304. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PLAYERNAME, i_pBase,
  2305. &i_pBase->dnReqUpdateInfo.dwNameOffset, &i_pBase->dnReqUpdateInfo.dwNameSize, IFLAG_UNICODE, 1);
  2306. // Data field
  2307. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  2308. &i_pBase->dnReqUpdateInfo.dwDataOffset, &i_pBase->dnReqUpdateInfo.dwDataSize, NULL, 1);
  2309. break;
  2310. }
  2311. case DN_MSG_INTERNAL_CREATE_GROUP:
  2312. {
  2313. // Requesting Player ID field
  2314. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_REQUESTINGPLAYERID].hProperty,
  2315. sizeof(i_pBase->dnCreateGroup.dpnidRequesting), &i_pBase->dnCreateGroup.dpnidRequesting, 0, 1, 0);
  2316. // Synchronization ID
  2317. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2318. sizeof(i_pBase->dnCreateGroup.hCompletionOp), &i_pBase->dnCreateGroup.hCompletionOp, 0, 1, 0);
  2319. break;
  2320. }
  2321. case DN_MSG_INTERNAL_DESTROY_GROUP:
  2322. {
  2323. // Group ID field
  2324. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  2325. sizeof(i_pBase->dnDestroyGroup.dpnidGroup), &i_pBase->dnDestroyGroup.dpnidGroup, 0, 1, 0);
  2326. // Requesting Player ID field
  2327. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_REQUESTINGPLAYERID].hProperty,
  2328. sizeof(i_pBase->dnDestroyGroup.dpnidRequesting), &i_pBase->dnDestroyGroup.dpnidRequesting, 0, 1, 0);
  2329. // Version field
  2330. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2331. sizeof(i_pBase->dnDestroyGroup.dwVersion), &i_pBase->dnDestroyGroup.dwVersion, 0, 1, 0);
  2332. // RESERVED field
  2333. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2334. sizeof(i_pBase->dnDestroyGroup.dwVersionNotUsed), &i_pBase->dnDestroyGroup.dwVersionNotUsed, 0, 1, 0);
  2335. // Synchronization ID field
  2336. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2337. sizeof(i_pBase->dnDestroyGroup.hCompletionOp), &i_pBase->dnDestroyGroup.hCompletionOp, 0, 1, 0);
  2338. break;
  2339. }
  2340. case DN_MSG_INTERNAL_ADD_PLAYER_TO_GROUP:
  2341. case DN_MSG_INTERNAL_DELETE_PLAYER_FROM_GROUP: // same structure as AddPlayerToGroup
  2342. {
  2343. // Group ID field
  2344. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_GROUPID].hProperty,
  2345. sizeof(i_pBase->dnAddPlayerToGroup.dpnidGroup), &i_pBase->dnAddPlayerToGroup.dpnidGroup, 0, 1, 0);
  2346. // Player ID field
  2347. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2348. sizeof(i_pBase->dnAddPlayerToGroup.dpnidPlayer), &i_pBase->dnAddPlayerToGroup.dpnidPlayer, 0, 1, 0);
  2349. // Version field
  2350. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2351. sizeof(i_pBase->dnAddPlayerToGroup.dwVersion), &i_pBase->dnAddPlayerToGroup.dwVersion, 0, 1, 0);
  2352. // RESERVED field
  2353. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2354. sizeof(i_pBase->dnAddPlayerToGroup.dwVersionNotUsed), &i_pBase->dnAddPlayerToGroup.dwVersionNotUsed, 0, 1, 0);
  2355. // Requesting Player ID field
  2356. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_REQUESTINGPLAYERID].hProperty,
  2357. sizeof(i_pBase->dnAddPlayerToGroup.dpnidRequesting), &i_pBase->dnAddPlayerToGroup.dpnidRequesting, 0, 1, 0);
  2358. // Synchronization ID field
  2359. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2360. sizeof(i_pBase->dnAddPlayerToGroup.hCompletionOp), &i_pBase->dnAddPlayerToGroup.hCompletionOp, 0, 1, 0);
  2361. break;
  2362. }
  2363. case DN_MSG_INTERNAL_UPDATE_INFO:
  2364. {
  2365. // Player ID field
  2366. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_PLAYERID].hProperty,
  2367. sizeof(i_pBase->dnUpdateInfo.dpnid), &i_pBase->dnUpdateInfo.dpnid, 0, 1, 0);
  2368. // Version field
  2369. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_VERSION].hProperty,
  2370. sizeof(i_pBase->dnUpdateInfo.dwVersion), &i_pBase->dnUpdateInfo.dwVersion, 0, 1, 0);
  2371. // RESERVED field
  2372. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESERVED].hProperty,
  2373. sizeof(i_pBase->dnUpdateInfo.dwVersionNotUsed), &i_pBase->dnUpdateInfo.dwVersionNotUsed, 0, 1, 0);
  2374. // Flags summary
  2375. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS_SUMMARY].hProperty,
  2376. sizeof(i_pBase->dnUpdateInfo.dwInfoFlags), &i_pBase->dnUpdateInfo.dwInfoFlags, 0, 1, 0);
  2377. // Flags field
  2378. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INFOFLAGS].hProperty,
  2379. sizeof(i_pBase->dnUpdateInfo.dwInfoFlags), &i_pBase->dnUpdateInfo.dwInfoFlags, 0, 2, 0);
  2380. // Player Name field
  2381. AttachValueOffsetSizeProperties(i_hFrame, SESSION_PLAYERNAME, i_pBase,
  2382. &i_pBase->dnUpdateInfo.dwNameOffset, &i_pBase->dnUpdateInfo.dwNameSize, IFLAG_UNICODE, 1);
  2383. // Data field
  2384. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  2385. &i_pBase->dnUpdateInfo.dwDataOffset, &i_pBase->dnUpdateInfo.dwDataSize, NULL, 1);
  2386. // Requesting Player ID field
  2387. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_REQUESTINGPLAYERID].hProperty,
  2388. sizeof(i_pBase->dnUpdateInfo.dpnidRequesting), &i_pBase->dnUpdateInfo.dpnidRequesting, 0, 1, 0);
  2389. // Synchronization ID field
  2390. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2391. sizeof(i_pBase->dnUpdateInfo.hCompletionOp), &i_pBase->dnUpdateInfo.hCompletionOp, 0, 1, 0);
  2392. break;
  2393. }
  2394. case DN_MSG_INTERNAL_BUFFER_IN_USE:
  2395. {
  2396. // No fields
  2397. break;
  2398. }
  2399. case DN_MSG_INTERNAL_REQUEST_FAILED:
  2400. {
  2401. // Synchronization ID field
  2402. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2403. sizeof(i_pBase->dnRequestFailed.hCompletionOp), &i_pBase->dnRequestFailed.hCompletionOp, 0, 1, 0);
  2404. // Result Code field
  2405. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_RESULTCODE].hProperty,
  2406. sizeof(i_pBase->dnRequestFailed.hResultCode), &i_pBase->dnRequestFailed.hResultCode, 0, 1, 0);
  2407. break;
  2408. }
  2409. case DN_MSG_INTERNAL_TERMINATE_SESSION:
  2410. {
  2411. // Data field
  2412. AttachValueOffsetSizeProperties(i_hFrame, SESSION_DATA, i_pBase,
  2413. &i_pBase->dnTerminateSession.dwTerminateDataOffset, &i_pBase->dnTerminateSession.dwTerminateDataSize, NULL, 1);
  2414. break;
  2415. }
  2416. case DN_MSG_INTERNAL_REQ_PROCESS_COMPLETION:
  2417. {
  2418. // Synchronization ID field
  2419. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2420. sizeof(i_pBase->dnReqProcessCompletion.hCompletionOp), &i_pBase->dnReqProcessCompletion.hCompletionOp, 0, 1, 0);
  2421. // TODO: AttachPropertyInstance(REST OF THE FRAME IS USER DATA)
  2422. break;
  2423. }
  2424. case DN_MSG_INTERNAL_PROCESS_COMPLETION :
  2425. {
  2426. // Synchronization ID field
  2427. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2428. sizeof(i_pBase->dnProcessCompletion.hCompletionOp), &i_pBase->dnProcessCompletion.hCompletionOp, 0, 1, 0);
  2429. break;
  2430. }
  2431. case DN_MSG_INTERNAL_REQ_INTEGRITY_CHECK:
  2432. {
  2433. // Synchronization ID field
  2434. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SYNCID].hProperty,
  2435. sizeof(i_pBase->dnReqProcessCompletionHeader.hCompletionOp), &i_pBase->dnReqProcessCompletionHeader.hCompletionOp, 0, 1, 0);
  2436. // Target Peer ID field
  2437. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_TARGETPEERID].hProperty,
  2438. sizeof(i_pBase->dnReqIntegrityCheck.dpnidTarget), &i_pBase->dnReqIntegrityCheck.dpnidTarget, 0, 1, 0);
  2439. break;
  2440. }
  2441. case DN_MSG_INTERNAL_INTEGRITY_CHECK:
  2442. {
  2443. // Requesting Peer ID field
  2444. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_TARGETPEERID].hProperty,
  2445. sizeof(i_pBase->dnIntegrityCheck.dpnidRequesting), &i_pBase->dnIntegrityCheck.dpnidRequesting, 0, 1, 0);
  2446. break;
  2447. }
  2448. case DN_MSG_INTERNAL_INTEGRITY_CHECK_RESPONSE:
  2449. {
  2450. // Requesting Peer ID field
  2451. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_TARGETPEERID].hProperty,
  2452. sizeof(i_pBase->dnIntegrityCheckResponse.dpnidRequesting), &i_pBase->dnIntegrityCheckResponse.dpnidRequesting, 0, 1, 0);
  2453. break;
  2454. }
  2455. default:
  2456. {
  2457. break; // TODO: DPF(0, "Unknown Session frame!");
  2458. }
  2459. }
  2460. } // AttachMessageProperties
  2461. } // Anonymous namespace
  2462. // DESCRIPTION: Maps the properties that exist in a piece of recognized data to Sessionecific locations.
  2463. //
  2464. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  2465. // i_pbMacFram - Pointer to the first byte in the frame.
  2466. // i_pbSessionFrame - Pointer to the start of the recognized data.
  2467. // i_dwMacType - MAC value of the first protocol in a frame. Typically, the i_dwMacType value is used
  2468. // when the parser must identify the first protocol in the frame. Can be one of the following:
  2469. // MAC_TYPE_ETHERNET = 802.3, MAC_TYPE_TOKENRING = 802.5, MAC_TYPE_FDDI ANSI = X3T9.5.
  2470. // i_dwBytesLeft - The remaining number of bytes in a frame (starting from the beginning of the recognized data).
  2471. // i_hPrevProtocol - Handle of the previous protocol.
  2472. // i_dwPrevProtOffset - Offset of the previous protocol (starting from the beginning of the frame).
  2473. // i_dwptrInstData - Pointer to the instance data that the previous protocol provides.
  2474. //
  2475. // RETURNS: Must return NULL
  2476. //
  2477. DPLAYPARSER_API LPBYTE BHAPI SessionAttachProperties( HFRAME i_hFrame,
  2478. ULPBYTE i_upbMacFrame,
  2479. ULPBYTE i_upbySessionFrame,
  2480. DWORD i_dwMacType,
  2481. DWORD i_dwBytesLeft,
  2482. HPROTOCOL i_hPrevProtocol,
  2483. DWORD i_dwPrevProtOffset,
  2484. DWORD_PTR i_dwptrInstData )
  2485. {
  2486. //===================//
  2487. // Attach Properties //
  2488. //===================//
  2489. if ( i_dwptrInstData == 0 )
  2490. {
  2491. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_UNPARSABLEFRAGMENT].hProperty,
  2492. i_dwBytesLeft, i_upbySessionFrame, 0, 0, 0);
  2493. return NULL;
  2494. }
  2495. // Summary line
  2496. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_SUMMARY].hProperty,
  2497. SessionHeaderSize(i_upbySessionFrame), i_upbySessionFrame, 0, 0, 0);
  2498. // Check what Session frame we are dealing with
  2499. DN_INTERNAL_MESSAGE_FULLMSG& rSessionFrame = *reinterpret_cast<DN_INTERNAL_MESSAGE_FULLMSG*>(i_upbySessionFrame);
  2500. // Message type field
  2501. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_MESSAGETYPE].hProperty,
  2502. sizeof(rSessionFrame.dwMsgType), &rSessionFrame.dwMsgType, 0, 1, 0);
  2503. __try
  2504. {
  2505. // Attach the properties appropriate to the message type
  2506. AttachMessageProperties(rSessionFrame.dwMsgType, i_hFrame, &rSessionFrame.MsgBody);
  2507. }
  2508. __except ( GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH )
  2509. {
  2510. AttachPropertyInstance(i_hFrame, g_arr_SessionProperties[SESSION_INCOMPLETEMESSAGE].hProperty,
  2511. i_dwBytesLeft, i_upbySessionFrame, 0, 1, 0);
  2512. }
  2513. return NULL;
  2514. } // SessionAttachProperties
  2515. // DESCRIPTION: Formats the data that is diSessionlayed in the details pane of the Network Monitor UI.
  2516. //
  2517. // ARGUMENTS: i_hFrame - Handle of the frame that is being parsed.
  2518. // i_pbMacFrame - Pointer to the first byte of a frame.
  2519. // i_pbSessionFrame - Pointer to the beginning of the protocol data in a frame.
  2520. // i_dwPropertyInsts - Number of PROPERTYINST structures provided by lpPropInst.
  2521. // i_pPropInst - Pointer to an array of PROPERTYINST structures.
  2522. //
  2523. // RETURNS: If the function is successful, the return value is a pointer to the first byte after the recognized data in a frame,
  2524. // or NULL if the recognized data is the last piece of data in a frame. If the function is unsuccessful, the return value
  2525. // is the initial value of i_pbSessionFrame.
  2526. //
  2527. DPLAYPARSER_API DWORD BHAPI SessionFormatProperties( HFRAME i_hFrame,
  2528. ULPBYTE i_upbMacFrame,
  2529. ULPBYTE i_upbySessionFrame,
  2530. DWORD i_dwPropertyInsts,
  2531. LPPROPERTYINST i_pPropInst )
  2532. {
  2533. // Loop through the property instances...
  2534. while( i_dwPropertyInsts-- > 0)
  2535. {
  2536. // ...and call the formatter for each
  2537. reinterpret_cast<FORMAT>(i_pPropInst->lpPropertyInfo->InstanceData)(i_pPropInst);
  2538. ++i_pPropInst;
  2539. }
  2540. // TODO: MAKE SURE THIS SHOULD NOT BE TRUE
  2541. return NMERR_SUCCESS;
  2542. } // SessionFormatProperties
  2543. // DESCRIPTION: Notifies Network Monitor that DNET protocol parser exists.
  2544. //
  2545. // ARGUMENTS: NONE
  2546. //
  2547. // RETURNS: TRUE - success, FALSE - failure
  2548. //
  2549. bool CreateSessionProtocol( void )
  2550. {
  2551. // The entry points to the export functions that Network Monitor uses to operate the parser
  2552. ENTRYPOINTS SessionEntryPoints =
  2553. {
  2554. // SessionParser Entry Points
  2555. SessionRegister,
  2556. SessionDeregister,
  2557. SessionRecognizeFrame,
  2558. SessionAttachProperties,
  2559. SessionFormatProperties
  2560. };
  2561. // The first active instance of this parser needs to register with the kernel
  2562. g_hSessionProtocol = CreateProtocol("DPLAYSESSION", &SessionEntryPoints, ENTRYPOINTS_SIZE);
  2563. return (g_hSessionProtocol ? TRUE : FALSE);
  2564. } // CreateSessionProtocol
  2565. // DESCRIPTION: Removes the DNET protocol parser from the Network Monitor's database of parsers
  2566. //
  2567. // ARGUMENTS: NONE
  2568. //
  2569. // RETURNS: NOTHING
  2570. //
  2571. void DestroySessionProtocol( void )
  2572. {
  2573. DestroyProtocol(g_hSessionProtocol);
  2574. } // DestroySessionProtocol