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.

1410 lines
42 KiB

  1. #define UINT_PTR UINT
  2. #define DWORD_PTR DWORD
  3. #include <dplay.h>
  4. #include <dplaypr.h>
  5. #include <arpdint.h>
  6. #include <mcontext.h>
  7. //#include <basedef.h>
  8. #include <vmm.h>
  9. /*
  10. GetArg - Gets a command line argument from a string.
  11. IN ppArg = pointer to pointer to argument string
  12. OUT *ppArg = pointer to next argument, or NULL if this was the last.
  13. Returns Pointer to uppercase ASCIZ argument with delimeters stripped,
  14. or NULL if
  15. no more arguments.
  16. Note Not reentrant
  17. */
  18. #define MAX_ARG_LEN 30
  19. UCHAR CmdArg[MAX_ARG_LEN+1] = {0};
  20. PUCHAR GetArg(PUCHAR *ppArg)
  21. {
  22. // Note - Always returns at least one blank argument if string is valid, even
  23. // if the string is empty.
  24. PUCHAR pDest = CmdArg;
  25. UCHAR c;
  26. UINT i;
  27. #define pArg (*ppArg)
  28. // If end of command already reached, fail
  29. if (!pArg)
  30. return NULL;
  31. // Skip leading whitespace
  32. while (*pArg == ' ' || *pArg == '\t')
  33. pArg++;
  34. // Copy the argument
  35. for (i = 0; i < MAX_ARG_LEN; i++) {
  36. if ((c = *pArg) == 0 || c == '\t' || c == ' ' || c == ';' ||
  37. c == '\n' || c == ',')
  38. break;
  39. if (c >= 'a' && c <= 'z')
  40. c -= ('a' - 'A');
  41. *(pDest++) = c;
  42. pArg++;
  43. }
  44. // Null terminate the result
  45. *pDest = '\0';
  46. // Skip trailing whitespace
  47. while (*pArg == ' ' || *pArg == '\t')
  48. pArg++;
  49. // strip up to one comma
  50. if (*pArg == ',')
  51. pArg++;
  52. // If end of command reached, make next request fail
  53. else if (*pArg == 0 || *pArg == ';' || *pArg == '\n')
  54. pArg = NULL;
  55. // return copy
  56. return CmdArg;
  57. #undef pArg
  58. }
  59. /*
  60. AtoI - Convert a string to a signed or unsigned integer
  61. IN pStr = ASCIZ representation of number with optional leading/trailing
  62. whitespace and optional leading '-'.
  63. Radix = Radix to use for conversion (2, 8, 10, or 16)
  64. OUT *pResult = Numeric result, or unchanged on failure
  65. Returns 1 on success, 0 if malformed string.
  66. Note Not reentrant
  67. */
  68. UINT AtoI(PUCHAR pStr, UINT Radix, PUINT pResult)
  69. {
  70. UINT r = 0;
  71. UINT Sign = 0;
  72. UCHAR c;
  73. UINT d;
  74. while (*pStr == ' ' || *pStr == '\t')
  75. pStr++;
  76. if (*pStr == '-') {
  77. Sign = 1;
  78. pStr++;
  79. }
  80. if (*pStr == 0)
  81. return 0; // Empty string!
  82. while ((c = *pStr) != 0 && c != ' ' && c != '\t') {
  83. if (c >= '0' && c <= '9')
  84. d = c - '0';
  85. else if (c >= 'A' && c <= 'F')
  86. d = c - ('A' - 10);
  87. else if (c >= 'a' && c <= 'f')
  88. d = c - ('a' - 10);
  89. else
  90. return 0; // Not a digit
  91. if (d >= Radix)
  92. return 0; // Not in radix
  93. r = r*Radix+d;
  94. pStr++;
  95. }
  96. while (*pStr == ' ' || *pStr == '\t')
  97. pStr++;
  98. if (*pStr != 0)
  99. return 0; // Garbage at end of string
  100. if (Sign)
  101. r = (UINT)(-(INT)r);
  102. *pResult = r;
  103. return 1; // Success!
  104. }
  105. /*
  106. GetNumericArg - Gets a numeric command line argument from a string.
  107. IN ppArg = pointer to pointer to argument string
  108. Radix = radix to use for conversion (2, 8, 10, or 16)
  109. OUT *ppArg = pointer to next argument, or NULL if this was the last.
  110. *pResult = numeric result on success; unchanged on failure
  111. Returns 1 on success, 0 on malformed string or no more arguments
  112. Note Not reentrant
  113. */
  114. UINT GetNumericArg(PUCHAR *ppArg, UINT Radix, PVOID pResult)
  115. {
  116. PUCHAR pA = GetArg(ppArg);
  117. UINT rc;
  118. if (!pA)
  119. return 0; // No argument
  120. rc = AtoI(pA, Radix, (PUINT)pResult);
  121. if (!rc)
  122. DbgPrint("? Invalid base-%d value, %s\n", Radix, pA);
  123. return rc;
  124. }
  125. /*
  126. GetDecimalArg - Gets a decimal command line argument from a string.
  127. IN ppArg = pointer to pointer to argument string
  128. OUT *ppArg = pointer to next argument, or NULL if this was the last.
  129. *pResult = numeric result on success; unchanged on failure
  130. Returns 1 on success, 0 on malformed string or no more arguments
  131. Note Not reentrant
  132. */
  133. UINT GetDecimalArg(PUCHAR *ppArg, PVOID pResult)
  134. {
  135. return GetNumericArg(ppArg, 10, pResult);
  136. }
  137. /*
  138. GetHexArg - Gets a hexadecimal command line argument from a string.
  139. IN ppArg = pointer to pointer to argument string
  140. OUT *ppArg = pointer to next argument, or NULL if this was the last.
  141. *pResult = numeric result on success; unchanged on failure
  142. Returns 1 on success, 0 on malformed string or no more arguments
  143. Note Not reentrant
  144. */
  145. UINT GetHexArg(PUCHAR *ppArg, PVOID pResult)
  146. {
  147. return GetNumericArg(ppArg, 16, pResult);
  148. }
  149. extern VOID DumpLog(UINT start);
  150. extern VOID DumpWholeLog(VOID);
  151. extern SetLogLevel(UINT level, UINT fExact);
  152. VOID DQLog(PUCHAR pArgs)
  153. {
  154. UINT record;
  155. if(!GetDecimalArg(&pArgs, &record)){
  156. DumpWholeLog();
  157. } else {
  158. DumpLog(record);
  159. }
  160. }
  161. VOID DQLogLast(PUCHAR pArgs)
  162. {
  163. UINT nDump;
  164. if(!GetDecimalArg(&pArgs, &nDump)){
  165. DumpLogLast(50);
  166. } else {
  167. DumpLogLast(nDump);
  168. }
  169. }
  170. VOID DQLogLevel(PUCHAR pArgs)
  171. {
  172. UINT level;
  173. if (!GetDecimalArg(&pArgs, &level))
  174. return;
  175. SetLogLevel(level,FALSE);
  176. }
  177. VOID DQLogExact(PUCHAR pArgs)
  178. {
  179. UINT level;
  180. if (!GetDecimalArg(&pArgs, &level))
  181. return;
  182. SetLogLevel(level,TRUE);
  183. }
  184. VOID PrintThisFlags(DWORD dwFlags)
  185. {
  186. DWORD dwMask, dwField, dwBitCount;
  187. dwBitCount = 0;
  188. dwMask = 1;
  189. while (dwMask)
  190. {
  191. dwField = dwFlags & dwMask;
  192. if (dwField)
  193. {
  194. if (dwBitCount == 0)
  195. DbgPrint(" (");
  196. else
  197. DbgPrint(" |\n ");
  198. switch (dwField)
  199. {
  200. case DPLAYI_DPLAY_PENDING:
  201. DbgPrint("DPLAYI_DPLAY_PENDING");
  202. break;
  203. case DPLAYI_DPLAY_SESSIONLOST:
  204. DbgPrint("DPLAYI_DPLAY_SESSIONLOST");
  205. break;
  206. case DPLAYI_DPLAY_CLOSED:
  207. DbgPrint("DPLAYI_DPLAY_CLOSED");
  208. break;
  209. case DPLAYI_DPLAY_DX3INGAME:
  210. DbgPrint("DPLAYI_DPLAY_DX3INGAME");
  211. break;
  212. case DPLAYI_DPLAY_EXECUTINGPENDING:
  213. DbgPrint("DPLAYI_DPLAY_EXECUTINGPENDING");
  214. break;
  215. case DPLAYI_DPLAY_DX3SP:
  216. DbgPrint("DPLAYI_DPLAY_DX3SP");
  217. break;
  218. case DPLAYI_DPLAY_UNINITIALIZED:
  219. DbgPrint("DPLAYI_DPLAY_UNINITIALIZED");
  220. break;
  221. case DPLAYI_DPLAY_ENUM:
  222. DbgPrint("DPLAYI_DPLAY_ENUM");
  223. break;
  224. case DPLAYI_DPLAY_KEEPALIVE:
  225. DbgPrint("DPLAYI_DPLAY_KEEPALIVE");
  226. break;
  227. case DPLAYI_DPLAY_LOBBYOWNS:
  228. DbgPrint("DPLAYI_DPLAY_LOBBYOWNS");
  229. break;
  230. case DPLAYI_DPLAY_SECURITY:
  231. DbgPrint("DPLAYI_DPLAY_SECURITY");
  232. break;
  233. case DPLAYI_DPLAY_ENUMACTIVE:
  234. DbgPrint("DPLAYI_DPLAY_ENUMACTIVE");
  235. break;
  236. case DPLAYI_DPLAY_ENCRYPTION:
  237. DbgPrint("DPLAYI_DPLAY_ENCRYPTION");
  238. break;
  239. case DPLAYI_DPLAY_SPSECURITY:
  240. DbgPrint("DPLAYI_DPLAY_SPSECURITY");
  241. break;
  242. case DPLAYI_DPLAY_HANDLEMULTICAST:
  243. DbgPrint("DPLAYI_DPLAY_HANDLEMULTICAST");
  244. break;
  245. case DPLAYI_DPLAY_SPUNRELIABLE:
  246. DbgPrint("DPLAYI_DPLAY_SPUNRELIABLE");
  247. break;
  248. case DPLAYI_DPLAY_PROTOCOL:
  249. DbgPrint("DPLAYI_DPLAY_PROTOCOL");
  250. break;
  251. case DPLAYI_DPLAY_PROTOCOLNOORDER:
  252. DbgPrint("DPLAYI_DPLAY_PROTOCOLNOORDER");
  253. break;
  254. default:
  255. DbgPrint("unknown: %08x", dwField);
  256. break;
  257. }
  258. dwBitCount++;
  259. }
  260. dwMask <<= 1;
  261. }
  262. if (dwBitCount)
  263. DbgPrint(")\n");
  264. }
  265. VOID DQThis(PUCHAR pArgs)
  266. {
  267. DPLAYI_DPLAY *this;
  268. if (!GetHexArg(&pArgs, &this))
  269. return;
  270. DbgPrint("\nThis\n\n");
  271. DbgPrint("dwSize : %d\n", this->dwSize);
  272. DbgPrint("pInterfaces : %08x\n", this->pInterfaces);
  273. DbgPrint("dwRefCnt : %d\n", this->dwRefCnt);
  274. DbgPrint("dwFlags : %08x\n", this->dwFlags);
  275. PrintThisFlags(this->dwFlags);
  276. DbgPrint("pcbSPCallbacks : %08x\n", this->pcbSPCallbacks);
  277. DbgPrint("pPlayers : %08x\n", this->pPlayers);
  278. DbgPrint("pGroups : %08x\n", this->pGroups);
  279. DbgPrint("pSysPlayer : %08x\n", this->pSysPlayer);
  280. DbgPrint("pNameTable : %08x\n", this->pNameTable);
  281. DbgPrint("nGroups : %d\n", this->nGroups);
  282. DbgPrint("nPlayers : %d\n", this->nPlayers);
  283. DbgPrint("uiNameTableSize : %d\n", this->uiNameTableSize);
  284. DbgPrint("uiNameTableLastUsed : %d\n", this->uiNameTableLastUsed);
  285. DbgPrint("lpsdDesc : %08x\n", this->lpsdDesc);
  286. DbgPrint("pMessageList : %08x\n", this->pMessageList);
  287. DbgPrint("pLastMessage : %08x\n", this->pLastMessage);
  288. DbgPrint("nMessages : %d\n", this->nMessages);
  289. DbgPrint("dwSPHeaderSize : %d\n", this->dwSPHeaderSize);
  290. DbgPrint("pMessagesPending : %08x\n", this->pMessagesPending);
  291. DbgPrint("pLastPendingMessage : %08x\n", this->pLastPendingMessage);
  292. DbgPrint("nMessagesPending : %d\n", this->nMessagesPending);
  293. DbgPrint("dwSPMaxMessage : %d\n", this->dwSPMaxMessage);
  294. DbgPrint("dwSPMaxMessageGuaranteed: %d\n", this->dwSPMaxMessageGuaranteed);
  295. DbgPrint("pPacketList : %08x\n", this->pPacketList);
  296. DbgPrint("hDPlayThread : %08x\n", this->hDPlayThread);
  297. DbgPrint("hSPModule : %08x\n", this->hSPModule);
  298. DbgPrint("hDPlayThreadEvent : %08x\n", this->hDPlayThreadEvent);
  299. DbgPrint("pNameServer : %08x\n", this->pNameServer);
  300. DbgPrint("pSysGroup : %08x\n", this->pSysGroup);
  301. DbgPrint("pServerPlayer : %08x\n", this->pServerPlayer);
  302. DbgPrint("pPerfData : %08x\n", this->pPerfData);
  303. DbgPrint("pPerfThread : %08x\n", this->hPerfThread);
  304. DbgPrint("hPerfEvent : %08x\n", this->hPerfEvent);
  305. DbgPrint("pSecurityDesc : %08x\n", this->pSecurityDesc);
  306. DbgPrint("ulMaxContextBufferSize : %d\n", this->ulMaxContextBufferSize);
  307. DbgPrint("ulMaxSignatureSize : %d\n", this->ulMaxSignatureSize);
  308. DbgPrint("hCSP : %08x\n", this->hCSP);
  309. DbgPrint("hPublicKey : %08x\n", this->hPublicKey);
  310. DbgPrint("pPublicKey : %08x\n", this->pPublicKey);
  311. DbgPrint("dwPublicKeySize : %d\n", this->dwPublicKeySize);
  312. DbgPrint("pUserCredentials : %08x\n", this->pUserCredentials);
  313. DbgPrint("LoginState : %d\n", this->LoginState);
  314. DbgPrint("phCredential : %08x\n", this->phCredential);
  315. DbgPrint("phContext : %08x\n", this->phContext);
  316. DbgPrint("hEncryptionKey : %08x\n", this->hEncryptionKey);
  317. DbgPrint("hDecryptionKey : %08x\n", this->hDecryptionKey);
  318. DbgPrint("hServerPublicKey : %08x\n", this->hServerPublicKey);
  319. DbgPrint("pspNode : %08x\n", this->pspNode);
  320. DbgPrint("pvSPLocalData : %08x\n", this->pvSPLocalData);
  321. DbgPrint("dwSPLocalDataSize : %d\n", this->dwSPLocalDataSize);
  322. DbgPrint("pISP : %08x\n", this->pISP);
  323. DbgPrint("pNextObject : %08x\n", this->pNextObject);
  324. DbgPrint("dwLastEnum : %d\n", this->dwLastEnum);
  325. DbgPrint("dwLastPing : %d\n", this->dwLastPing);
  326. DbgPrint("dwEnumTimeout : %d\n", this->dwEnumTimeout);
  327. DbgPrint("pbAsyncEnumBuffer : %08x\n", this->pbAsyncEnumBuffer);
  328. DbgPrint("dwEnumBufferSize : %d\n", this->dwEnumBufferSize);
  329. DbgPrint("lpLobbyObject : %08x\n", this->lpLobbyObject);
  330. DbgPrint("lpLaunchingLobbyObject : %08x\n", this->lpLaunchingLobbyObject);
  331. DbgPrint("pSessionList : %08x\n", this->pSessionList);
  332. DbgPrint("dwMinVersion : %d\n", this->dwMinVersion);
  333. DbgPrint("pAddForwardList : %08x\n", this->pAddForwardList);
  334. DbgPrint("pProtocol : %08x\n", this->pProtocol);
  335. DbgPrint("lpPlayerMsgPool : %08x\n", this->lpPlayerMsgPool);
  336. DbgPrint("lpSendParmsPool : %08x\n", this->lpSendParmsPool);
  337. DbgPrint("dwPlayerReservations : %08x\n", this->dwPlayerReservations);
  338. DbgPrint("dwLastReservationTime : %08x\n", this->dwLastReservationTime);
  339. DbgPrint("dwSPVersion : %08x\n", this->dwSPVersion);
  340. DbgPrint("dwZombieCount : %08x\n", this->dwZombieCount);
  341. }
  342. VOID DQContextPool(PUCHAR pArgs)
  343. {
  344. DPLAYI_DPLAY *this;
  345. UINT iNext;
  346. UINT i=0,j=0;
  347. PVOID pv;
  348. if (!GetHexArg(&pArgs, &this))
  349. return;
  350. DbgPrint("Dumping Message Context Pool\n");
  351. DbgPrint("----------------------------\n");
  352. for(i=0;i<MSG_FAST_CONTEXT_POOL_SIZE+1;i++)
  353. {
  354. DbgPrint("[%d]",i);
  355. if(this->GrpMsgContextPool[i]){
  356. pv=this->GrpMsgContextPool;
  357. while(pv){
  358. DbgPrint("(%x)->\n",pv);
  359. pv=*((LPVOID *)pv);
  360. j++;
  361. if(j==10){
  362. DbgPrint("\n");
  363. j=0;
  364. }
  365. }
  366. }
  367. DbgPrint("\n");
  368. }
  369. }
  370. VOID DQContextList(PUCHAR pArgs)
  371. {
  372. DPLAYI_DPLAY *pIDP;
  373. PMSGCONTEXTTABLE this;
  374. UINT iNext;
  375. UINT i=0,j;
  376. if (!GetHexArg(&pArgs, &pIDP))
  377. return;
  378. this=pIDP->pMsgContexts;
  379. DbgPrint("Dumping pMsgContexts at %x off of IDplay %x:\n",this,pIDP);
  380. DbgPrint("------------------------------------------------------------\n");
  381. DbgPrint("nUnique : %x\n",this->nUnique);
  382. DbgPrint("nTableSize : %d\n",this->nTableSize);
  383. DbgPrint("FreeList:\n");
  384. iNext=this->iNextAvail;
  385. while(iNext != LIST_END){
  386. DbgPrint("[%d]->",iNext);
  387. iNext=this->MsgContextEntry[iNext].iNextAvail;
  388. i++;
  389. if(i==10){
  390. DbgPrint("\n");
  391. i=0;
  392. }
  393. }
  394. DbgPrint("\nFull Dump:\n");
  395. for(i=0;i<this->nTableSize;i++){
  396. DbgPrint("[%d] psp %x nUnique %x nContexts %d",i,
  397. this->MsgContextEntry[i].psp,this->MsgContextEntry[i].nUnique,
  398. this->MsgContextEntry[i].nContexts);
  399. if(this->MsgContextEntry[i].nUnique){
  400. DbgPrint(" Context List @ %x:\n",this->MsgContextEntry[i].papv);
  401. for(j=0;j<this->MsgContextEntry[i].nContexts;j++){
  402. DbgPrint("[%x] %x\n", j, *(((PVOID *)this->MsgContextEntry[i].papv)+j));
  403. }
  404. } else {
  405. DbgPrint(" NONE\n");
  406. }
  407. }
  408. }
  409. VOID PrintPlayerFlags(DWORD dwFlags)
  410. {
  411. DWORD dwMask, dwField, dwBitCount;
  412. dwBitCount = 0;
  413. dwMask = 1;
  414. while (dwMask)
  415. {
  416. dwField = dwFlags & dwMask;
  417. if (dwField)
  418. {
  419. if (dwBitCount == 0)
  420. DbgPrint(" (");
  421. else
  422. DbgPrint(" |\n ");
  423. switch (dwField)
  424. {
  425. case DPLAYI_PLAYER_SYSPLAYER:
  426. DbgPrint("DPLAYI_PLAYER_SYSPLAYER");
  427. break;
  428. case DPLAYI_PLAYER_NAMESRVR:
  429. DbgPrint("DPLAYI_PLAYER_NAMESRVR");
  430. break;
  431. case DPLAYI_PLAYER_PLAYERINGROUP:
  432. DbgPrint("DPLAYI_PLAYER_PLAYERINGROUP");
  433. break;
  434. case DPLAYI_PLAYER_PLAYERLOCAL:
  435. DbgPrint("DPLAYI_PLAYER_PLAYERLOCAL");
  436. break;
  437. case DPLAYI_PLAYER_CREATEDPLAYEREVENT:
  438. DbgPrint("DPLAYI_PLAYER_CREATEDPLAYEREVENT");
  439. break;
  440. case DPLAYI_GROUP_SYSGROUP:
  441. DbgPrint("DPLAYI_GROUP_SYSGROUP");
  442. break;
  443. case DPLAYI_GROUP_DPLAYOWNS:
  444. DbgPrint("DPLAYI_GROUP_DPLAYOWNS");
  445. break;
  446. case DPLAYI_PLAYER_APPSERVER:
  447. DbgPrint("DPLAYI_PLAYER_APPSERVER");
  448. break;
  449. case DPLAYI_GROUP_STAGINGAREA:
  450. DbgPrint("DPLAYI_GROUP_STAGINGAREA");
  451. break;
  452. case DPLAYI_GROUP_HIDDEN:
  453. DbgPrint("DPLAYI_GROUP_HIDDEN");
  454. break;
  455. case DPLAYI_PLAYER_OWNER:
  456. DbgPrint("DPLAYI_PLAYER_OWNER");
  457. break;
  458. case DPLAYI_DPLAY_SPUNRELIABLE:
  459. DbgPrint("DPLAYI_DPLAY_SPUNRELIABLE\n");
  460. break;
  461. case DPLAYI_DPLAY_PROTOCOL:
  462. DbgPrint("DPLAYI_DPLAY_PROTOCOL\n");
  463. break;
  464. case DPLAYI_DPLAY_PROTOCOLNOORDER:
  465. DbgPrint("DPLAYI_DPLAY_PROTOCOLNOORDER\n");
  466. break;
  467. case DPLAYI_PLAYER_ON_DEATH_ROW:
  468. DbgPrint("DPLAYI_PLAYER_ON_DEATH_ROW");
  469. break;
  470. case DPLAYI_PLAYER_DOESNT_HAVE_NAMETABLE:
  471. DbgPrint("DPLAYI_PLAYER_DOESNT_HAVE_NAMETABLE");
  472. break;
  473. case DPLAYI_PLAYER_CONNECTION_LOST:
  474. DbgPrint("DPLAYI_PLAYER_CONNECTION_LOST");
  475. break;
  476. case DPLAYI_PLAYER_BEING_DESTROYED:
  477. DbgPrint("DPLAYI_PLAYER_BEING_DESTROYED");
  478. break;
  479. default:
  480. DbgPrint("unknown: %08x", dwField);
  481. break;
  482. }
  483. dwBitCount++;
  484. }
  485. dwMask <<= 1;
  486. }
  487. if (dwBitCount)
  488. DbgPrint(")\n");
  489. }
  490. VOID DQFixedMemPool(PUCHAR pArgs)
  491. {
  492. void *pv;
  493. PFPOOL pPool;
  494. UINT i;
  495. if (!GetHexArg(&pArgs, &pPool))
  496. return;
  497. DbgPrint("MemoryPool @ (%x) : ItemSize (%d)\n",pPool,pPool->cbItemSize);
  498. DbgPrint("-------------------------------------------------\n");
  499. DbgPrint("nAllocated : %d\n",pPool->nAllocated);
  500. DbgPrint("nInUse : %d\n",pPool->nInUse);
  501. DbgPrint("nMaxInUse : %d\n",pPool->nMaxInUse);
  502. DbgPrint("\nfnGet : %x\n",pPool->Get);
  503. DbgPrint( "fnRelease : %x\n",pPool->Release);
  504. DbgPrint( "fnScale : %x\n",pPool->Scale);
  505. DbgPrint( "fnFini : %x\n",pPool->Fini);
  506. DbgPrint("fnBlockInitAlloc :%x\n",pPool->fnBlockInitAlloc);
  507. DbgPrint("fnBlockInit :%x\n",pPool->fnBlockInit);
  508. DbgPrint("fnBlockFini :%x\n",pPool->fnBlockFini);
  509. DbgPrint("FreeList->");
  510. pv=pPool->pPool;
  511. i=0;
  512. while(pv){
  513. DbgPrint("(%x)->",pv);
  514. pv=*((void **)pv);
  515. i++;
  516. if(i==6){
  517. i=0;
  518. DbgPrint("\n");
  519. }
  520. }
  521. DbgPrint("NULL");
  522. }
  523. VOID DQSendParms(PUCHAR pArgs)
  524. {
  525. PSENDPARMS psp;
  526. UINT i;
  527. if (!GetHexArg(&pArgs, &psp))
  528. return;
  529. DbgPrint( "SENDPARMS @ (%x)\n",psp);
  530. DbgPrint( "----------------------\n");
  531. DbgPrint( "idFrom %x pPlayerFrom:%x\n",psp->idFrom,psp->pPlayerFrom);
  532. if(psp->pPlayerTo){
  533. DbgPrint( " idTo %x pPlayerTo :%x\n",psp->idTo, psp->pPlayerTo);
  534. }
  535. if(psp->pGroupTo){
  536. DbgPrint( " idTo %x pGroupTo :%x\n",psp->idTo, psp->pGroupTo);
  537. }
  538. DbgPrint( "RefCount :%d\n",psp->RefCount);
  539. DbgPrint( "lpData :%x\n",psp->lpData);
  540. DbgPrint( "dwDataSize :%d\n",psp->dwDataSize);
  541. DbgPrint( "dwFlags :%x\n",psp->dwFlags);
  542. DbgPrint( "dwPriority :%x\n",psp->dwPriority);
  543. DbgPrint( "dwTimeout :%d\n",psp->dwTimeout);
  544. DbgPrint( "hContext :%x\n",psp->hContext);
  545. DbgPrint( "nContext :%d\n",psp->nContext);
  546. DbgPrint( "nComplete :%d\n",psp->nComplete);
  547. DbgPrint( "hr :%x\n",psp->hr);
  548. DbgPrint( "dwSendTime :%x\n",psp->dwSendTime);
  549. DbgPrint( "dwCompTime :%x\n",psp->dwSendCompletionTime);
  550. DbgPrint( "\nSG Buffers:\n-----------\n");
  551. for(i=0;i<psp->cBuffers;i++){
  552. DbgPrint("Addr %x Len %d fnFree %x\n",psp->Buffers[i].pData,psp->Buffers[i].len,psp->BufFree[i].fnFree);
  553. }
  554. DbgPrint( "dwTotalSize:%d\n",psp->dwTotalSize);
  555. }
  556. VOID DQProtocolReceive(PUCHAR pArgs)
  557. {
  558. PRECEIVE pR;
  559. if (!GetHexArg(&pArgs, &pR))
  560. return;
  561. #ifdef SIGN
  562. DbgPrint("Signature : %08x\n", pR->Signature); // Signature for SIGN
  563. #endif
  564. DbgPrint("pNext : %08x\n", pR->pNext);
  565. /*
  566. union {
  567. BILINK pReceiveQ;
  568. struct _RECEIVE * pNext;
  569. };
  570. BILINK RcvBuffList; // List of receive buffers that make up the message.
  571. CRITICAL_SECTION ReceiveLock;
  572. */
  573. DbgPrint("pSession : %08x\n", pR->pSession);
  574. DbgPrint("fBusy : %08x\n", pR->fBusy);
  575. DbgPrint("fReliable : %08x\n", pR->fReliable);
  576. DbgPrint("fEOM : %08x\n", pR->fEOM);
  577. DbgPrint("command : %08x\n", pR->command);
  578. DbgPrint("messageid : %08x\n", pR->messageid);
  579. DbgPrint("MessageSize : %08x\n\n", pR->MessageSize);
  580. DbgPrint("iNR : %08x\n", pR->iNR);
  581. DbgPrint("NR : %08x\n", pR->NR);
  582. DbgPrint("NS : %08x\n", pR->NS);
  583. DbgPrint("RCVMask : %08x\n", pR->RCVMask);
  584. DbgPrint("pSPHeader : %08x\n", pR->pSPHeader);
  585. //UCHAR SPHeader[0];
  586. }
  587. VOID DQProtocolSend(PUCHAR pArgs)
  588. {
  589. PSEND pS;
  590. if (!GetHexArg(&pArgs, &pS))
  591. return;
  592. #ifdef SIGN
  593. DbgPrint("Signature : %08x\n", pS->Signature);
  594. #endif
  595. // CRITICAL_SECTION SendLock; // Lock for Send Structure
  596. DbgPrint("RefCount : %d\n", pS->RefCount);
  597. DbgPrint("SendState: %08x\n", pS->SendState); // State of this message's transmission.
  598. // Lists and Links...
  599. // union {
  600. // struct _SEND *pNext; // linking on free pool
  601. // BILINK SendQ; // linking on session send queue
  602. // };
  603. // BILINK m_GSendQ; // Global Priority Queue
  604. DbgPrint("pSession: %08x\n",pS->pSession); // pointer to SESSIONion(gets a ref)
  605. // Send Information
  606. DbgPrint("idFrom: %08x\n",pS->idFrom);
  607. DbgPrint("idTo: %08x\n",pS->idTo);
  608. DbgPrint("wIdTo: %08x\n",pS->wIdTo); // index in table
  609. DbgPrint("wIdFrom: %08x\n",pS->wIdFrom); // index in table
  610. DbgPrint("dwFlags: %08x\n",pS->dwFlags); // Send Flags (include reliable)
  611. DbgPrint("pMessage: %08x\n",pS->pMessage); // Buffer chain describing message.
  612. DbgPrint("MessageSize: %08x\n",pS->MessageSize); // Total size of the message.
  613. DbgPrint("FrameDataLen: %08x\n",pS->FrameDataLen); // Data area of each frame.
  614. DbgPrint("nFrames: %08x\n",pS->nFrames); // Number of frames for this message.
  615. DbgPrint("Priority: %08x\n",pS->Priority); // Send Priority.
  616. // Vars for reliability
  617. DbgPrint("fSendSmall: %08x\n",pS->fSendSmall);
  618. DbgPrint("fUpdate: %08x\n",pS->fUpdate); // update to NS,NR NACKMask made by receive.
  619. DbgPrint("messageid: %08x\n",pS->messageid); // Message ID number.
  620. DbgPrint("serial: %08x\n",pS->serial); // serial number.
  621. DbgPrint("OpenWindows %08x\n",pS->OpenWindow);
  622. DbgPrint("NS: %08x\n",pS->NS); // Sequence Sent.
  623. DbgPrint("NR: %08x\n",pS->NR); // Sequence ACKED.
  624. DbgPrint("SendSEQMSK: %08x\n",pS->SendSEQMSK); // Mask to use. - BUGBUG: determine speed at start
  625. DbgPrint("NACKMask: %08x\n",pS->NACKMask); // Bit pattern of NACKed frames.
  626. // These are the values at NR - updated by ACKs
  627. DbgPrint("SendOffset: %08x\n",pS->SendOffset); // Current offset we are sending.
  628. DbgPrint("pCurrentBuffer: %08x\n",pS->pCurrentBuffer); // Current buffer being sent.
  629. DbgPrint("CurrentBufferOffset: %08x\n",pS->CurrentBufferOffset);// Offset in the current buffer of next packet.
  630. // info to update link characteristics when ACKs come in.
  631. //BILINK StatList: // Info for packets already sent.
  632. // Operational Characteristics
  633. // DbgPrint("PendedRetryTimer: %08x\n",pS->PendedRetryTimer);
  634. // DbgPrint("CancelledRetryTimer: %08x\n",pS->CancelledRetryTimer);
  635. DbgPrint("uRetryTimer: %08x\n",pS->uRetryTimer);
  636. DbgPrint("RetryCount: %08x\n",pS->RetryCount);// Number of times we retransmitted.
  637. DbgPrint("WindowSize: %08x\n",pS->WindowSize);// Maximum Window Size.
  638. DbgPrint("tLastACK: %08x\n",pS->tLastACK);// Time we last got an ACK.
  639. //BUGBUG:
  640. DbgPrint("PacketSize: %08x\n",pS->PacketSize);// Size of packets to send.
  641. DbgPrint("FrameSize: %08x\n",pS->FrameSize);// Size of Frames for this send.
  642. // Completion Vars
  643. DbgPrint("hEvent: %08x\n",pS->hEvent);// Event to wait on for internal send.
  644. DbgPrint("Status: %08x\n",pS->Status);// Send Completion Status.
  645. DbgPrint("pAsyncInfo: %08x\n",pS->pAsyncInfo);// ptr to Info for completing Async send(NULL=>internal send)
  646. // DbgPrint("AsyncInfo: // actual info (copied at send call).
  647. }
  648. VOID DQProtocolSession(PUCHAR pArgs)
  649. {
  650. PSESSION pS;
  651. if (!GetHexArg(&pArgs, &pS))
  652. return;
  653. DbgPrint("pProtocol : %08x\n", pS->pProtocol);
  654. #ifdef SIGN
  655. DbgPrint("Signature : %08x\n", pS->Signature);
  656. #endif
  657. // Identification
  658. // DbgPrint(" SessionLock; // Lock for the SESSIONion.
  659. DbgPrint("RefCount : %d\n", pS->RefCount);
  660. DbgPrint("eState : %d\n", pS->eState);
  661. DbgPrint("hClosingEvent : %d\n", pS->hClosingEvent);
  662. DbgPrint("fSendSmall : %d\n", pS->fSendSmall);
  663. DbgPrint("fSendSmallDG : %d\n", pS->fSendSmallDG);
  664. DbgPrint("dpid : %08x\n",pS->dpid);
  665. DbgPrint("iSession; : %d\n", pS->iSession);
  666. DbgPrint("MaxPacketSize : x%08x %d\n",pS->MaxPacketSize,pS->MaxPacketSize);
  667. DbgPrint("\n Operating Parameters:SEND \n --------- --------------- \n");
  668. // Operating parameters -- Send
  669. // Common
  670. DbgPrint("Common:\n");
  671. DbgPrint("MaxCSends : %d\n",pS->MaxCSends);
  672. DbgPrint("Reliable:\n");
  673. // Reliable
  674. DbgPrint("FirstMsg : %08x\n",pS->FirstMsg); // First message number being transmitted
  675. DbgPrint("LastMsg : %08x\n",pS->LastMsg); // Last message number being transmitted
  676. DbgPrint("OutMsgMask : %08x\n",pS->OutMsgMask); // relative to FirstMsg, unacked messages
  677. DbgPrint("nWaitingForMessageid: %08x\n", pS->nWaitingForMessageid);
  678. // DataGram
  679. DbgPrint("Datagram:\n");
  680. DbgPrint("DGFirstMsg : %08x\n",pS->DGFirstMsg);
  681. DbgPrint("DGLastMsg : %08x\n",pS->DGLastMsg);
  682. DbgPrint("DGOutMsgMask : %08x\n",pS->DGOutMsgMask);
  683. DbgPrint("nWaitingForDGMessageid: %08x\n",pS->nWaitingForDGMessageid);
  684. // Send stats are tracked seperately since sends may
  685. // no longer be around when completions come in.
  686. //BILINK OldStatList;
  687. // Operating parameters -- Receive
  688. DbgPrint("\n Operating Parameters:RECEIVE \n --------- ------------------ \n");
  689. // DataGram Receive.
  690. // BILINK pDGReceiveQ; // queue of ongoing datagram receives
  691. // Reliable Receive.
  692. // BILINK pRlyReceiveQ; // queue of ongoing reliable receives
  693. // BILINK pRlyWaitingQ; // Queue of out of order reliable receives waiting.
  694. // only used when PROTOCOL_NO_ORDER not set.
  695. DbgPrint("FirstRlyReceive : %08x\n",pS->FirstRlyReceive);
  696. DbgPrint("LastRlyReceive : %08x\n",pS->LastRlyReceive);
  697. DbgPrint("InMsgMask : %08x\n",pS->InMsgMask);
  698. DbgPrint("\n Operating Parameters:STATS \n --------- ---------------- \n");
  699. // Operational characteristics - MUST BE DWORD ALIGNED!!!
  700. DbgPrint("WindowSize :%d\n",pS->WindowSize);
  701. DbgPrint("DGWindowSize :%d\n",pS->DGWindowSize);
  702. DbgPrint("MaxRetry :%d\n",pS->MaxRetry); // Usualy max retries before dropping.
  703. DbgPrint("MinDropTime :%d\n",pS->MinDropTime); // Min time to retry before dropping.
  704. DbgPrint("MaxDropTime :%d\n",pS->MaxDropTime); // After this time always drop.
  705. DbgPrint("LocalBytesReceived :%d\n",pS->LocalBytesReceived); // Total Data Bytes received (including retries).
  706. DbgPrint("RemoteBytesReceived :%d\n",pS->RemoteBytesReceived); // Last value from remote.
  707. DbgPrint("LongestLatency :%d\n",pS->LongestLatency); // longest observed latency (msec)
  708. DbgPrint("ShortestLatency :%d\n",pS->ShortestLatency); // shortest observed latency(msec)
  709. DbgPrint("FpAverageLatency :%d\n",pS->FpAverageLatency/256);
  710. DbgPrint("FpLocalAverageLatency:%d\n",pS->FpLocalAverageLatency/256); // Local average latency (msec 24.8) (across fewer samples)
  711. DbgPrint("FpLocalAvgDeviation :%d\n",pS->FpLocalAvgDeviation/256); // average deviation of latency. (msec 24.8)
  712. DbgPrint("Bandwidth :%d\n",pS->Bandwidth); // latest observed bandwidth (bps)
  713. DbgPrint("HighestBandwidth :%d\n",pS->HighestBandwidth); // highest observed bandwidth (bps)
  714. }
  715. void PrintWideString(LPWSTR lpwStr, LONG lFieldWidth)
  716. {
  717. if (lpwStr)
  718. {
  719. while (*lpwStr)
  720. {
  721. DbgPrint("%c", *lpwStr);
  722. lpwStr++;
  723. lFieldWidth--;
  724. }
  725. }
  726. while (lFieldWidth > 0)
  727. {
  728. DbgPrint(" ");
  729. lFieldWidth--;
  730. }
  731. }
  732. void PrintNameString(LPWSTR lpwStr)
  733. {
  734. if (lpwStr)
  735. {
  736. DbgPrint(" \"");
  737. PrintWideString(lpwStr, 0);
  738. DbgPrint("\"\n");
  739. }
  740. else
  741. DbgPrint("\n");
  742. }
  743. // this is from the winsock file dpsp.h
  744. typedef struct _SPPLAYERDATA
  745. {
  746. SOCKADDR saddrStream,saddrDatagram;
  747. }SPPLAYERDATA,*LPSPPLAYERDATA;
  748. void PrintSocketInfo(SOCKADDR *lpSockAddr)
  749. {
  750. switch (lpSockAddr->sa_family)
  751. {
  752. case AF_INET:
  753. DbgPrint("port = %d, ip = %d.%d.%d.%d",
  754. *((u_short *)&lpSockAddr->sa_data[0]),
  755. (BYTE) lpSockAddr->sa_data[2],
  756. (BYTE) lpSockAddr->sa_data[3],
  757. (BYTE) lpSockAddr->sa_data[4],
  758. (BYTE) lpSockAddr->sa_data[5]);
  759. break;
  760. case AF_IPX:
  761. DbgPrint("IPX");
  762. break;
  763. default:
  764. DbgPrint("Unknown");
  765. break;
  766. }
  767. }
  768. void PrintAddress(LPVOID lpData, DWORD dwDataSize)
  769. {
  770. if ((lpData) && (dwDataSize == sizeof(SPPLAYERDATA)))
  771. {
  772. LPSPPLAYERDATA this = (LPSPPLAYERDATA) lpData;
  773. DbgPrint(" (Stream : ");
  774. PrintSocketInfo(&this->saddrStream);
  775. DbgPrint("\n Datagram: ");
  776. PrintSocketInfo(&this->saddrDatagram);
  777. DbgPrint(")\n");
  778. }
  779. }
  780. VOID DQPlayer(PUCHAR pArgs)
  781. {
  782. DPLAYI_PLAYER *this;
  783. if (!GetHexArg(&pArgs, &this))
  784. return;
  785. DbgPrint("\nPlayer\n\n");
  786. DbgPrint("dwSize : %d\n", this->dwSize);
  787. DbgPrint("dwFlags : %08x\n", this->dwFlags);
  788. PrintPlayerFlags(this->dwFlags);
  789. DbgPrint("dwID : %08x\n", this->dwID);
  790. DbgPrint("lpszShortName : %08x", this->lpszShortName);
  791. PrintNameString(this->lpszShortName);
  792. DbgPrint("lpszLongName : %08x", this->lpszLongName);
  793. PrintNameString(this->lpszLongName);
  794. DbgPrint("pvPlayerData : %08x\n", this->pvPlayerData);
  795. DbgPrint("dwPlayerDataSize : %d\n", this->dwPlayerDataSize);
  796. DbgPrint("pvPlayerLocalData : %08x\n", this->pvPlayerLocalData);
  797. DbgPrint("dwPlayerLocalDataSize : %d\n", this->dwPlayerLocalDataSize);
  798. DbgPrint("pvSPData : %08x\n", this->pvSPData);
  799. PrintAddress(this->pvSPData, this->dwSPDataSize);
  800. DbgPrint("dwSPDataSize : %d\n", this->dwSPDataSize);
  801. DbgPrint("pvSPLocalData : %08x\n", this->pvSPLocalData);
  802. DbgPrint("dwSPLocalDataSize : %d\n", this->dwSPLocalDataSize);
  803. DbgPrint("dwIDSysPlayer : %08x\n", this->dwIDSysPlayer);
  804. DbgPrint("dwVersion : %08x\n", this->dwVersion);
  805. DbgPrint("lpDP : %08x\n", this->lpDP);
  806. DbgPrint("nGroups : %d\n", this->nGroups);
  807. DbgPrint("dwIDParent : %08x\n", this->dwIDParent);
  808. DbgPrint("pNextPlayer: : %08x\n", this->pNextPlayer);
  809. DbgPrint("hEvent : %08x\n", this->hEvent);
  810. DbgPrint("dwNPings : %d\n", this->dwNPings);
  811. DbgPrint("nPendingSends : %d\n", this->nPendingSends);
  812. DbgPrint("dwChatterCount : %d\n", this->dwChatterCount);
  813. DbgPrint("dwUnansweredPings : %d\n", this->dwUnansweredPings);
  814. DbgPrint("dwProtLastSendBytes : %d\n", this->dwProtLastSendBytes);
  815. DbgPrint("dwProtLastRcvdBytes : %d\n", this->dwProtLastRcvdBytes);
  816. DbgPrint("dwTimeToDie : %d\n", this->dwTimeToDie);
  817. DbgPrint("pClientInfo : %08x\n", this->pClientInfo);
  818. DbgPrint("pOwnerGroupList : %08x\n", this->pOwnerGroupList);
  819. }
  820. VOID DQPlayerList(PUCHAR pArgs)
  821. {
  822. DPLAYI_PLAYER *this;
  823. if (!GetHexArg(&pArgs, &this))
  824. return;
  825. DbgPrint("\nPlayer List\n\n");
  826. DbgPrint(" pPlayer dwFlags dwID dwVersion short name long name address\n");
  827. // 00000000 00000000 00000000 00000000 123456789012345 123456789012345
  828. while (this)
  829. {
  830. DbgPrint("%08x %08x %08x %08x ",
  831. this, this->dwFlags, this->dwID, this->dwVersion);
  832. PrintWideString(this->lpszShortName, 16);
  833. PrintWideString(this->lpszLongName, 16);
  834. if ((this->pvSPData) && (this->dwSPDataSize == sizeof(SPPLAYERDATA)))
  835. {
  836. LPSPPLAYERDATA lpSocketAddr = (LPSPPLAYERDATA) this->pvSPData;
  837. PrintSocketInfo(&lpSocketAddr->saddrStream);
  838. }
  839. DbgPrint("\n");
  840. this = this->pNextPlayer;
  841. }
  842. }
  843. VOID DQGroup(PUCHAR pArgs)
  844. {
  845. DPLAYI_GROUP *this;
  846. if (!GetHexArg(&pArgs, &this))
  847. return;
  848. DbgPrint("\nGroup\n\n");
  849. DbgPrint("dwSize : %d\n", this->dwSize);
  850. DbgPrint("dwFlags : %08x\n", this->dwFlags);
  851. PrintPlayerFlags(this->dwFlags);
  852. DbgPrint("dwID : %08x\n", this->dwID);
  853. DbgPrint("lpszShortName : %08x", this->lpszShortName);
  854. PrintNameString(this->lpszShortName);
  855. DbgPrint("lpszLongName : %08x", this->lpszLongName);
  856. PrintNameString(this->lpszLongName);
  857. DbgPrint("pvPlayerData : %08x\n", this->pvPlayerData);
  858. DbgPrint("dwPlayerDataSize : %d\n", this->dwPlayerDataSize);
  859. DbgPrint("pvPlayerLocalData : %08x\n", this->pvPlayerLocalData);
  860. DbgPrint("dwPlayerLocalDataSize : %d\n", this->dwPlayerLocalDataSize);
  861. DbgPrint("pvSPData : %08x\n", this->pvSPData);
  862. PrintAddress(this->pvSPData, this->dwSPDataSize);
  863. DbgPrint("dwSPDataSize : %d\n", this->dwSPDataSize);
  864. DbgPrint("pvSPLocalData : %08x\n", this->pvSPLocalData);
  865. DbgPrint("dwSPLocalDataSize : %d\n", this->dwSPLocalDataSize);
  866. DbgPrint("dwIDSysPlayer : %08x\n", this->dwIDSysPlayer);
  867. DbgPrint("dwVersion : %08x\n", this->dwVersion);
  868. DbgPrint("lpDP : %08x\n", this->lpDP);
  869. DbgPrint("nGroups : %d\n", this->nGroups);
  870. DbgPrint("dwIDParent : %08x\n", this->dwIDParent);
  871. DbgPrint("pGroupnodes: : %08x\n", this->pGroupnodes);
  872. DbgPrint("pSysPlayerGroupnodes : %08x\n", this->pSysPlayerGroupnodes);
  873. DbgPrint("pNextGroup : %08x\n", this->pNextGroup);
  874. DbgPrint("nPlayers : %d\n", this->nPlayers);
  875. DbgPrint("pSubgroups : %08x\n", this->pSubgroups);
  876. DbgPrint("nSubgroups : %d\n", this->nSubgroups);
  877. DbgPrint("dwOwnerID : %08x\n", this->dwOwnerID);
  878. }
  879. VOID DQGroupList(PUCHAR pArgs)
  880. {
  881. DPLAYI_GROUP *this;
  882. if (!GetHexArg(&pArgs, &this))
  883. return;
  884. DbgPrint("\nGroup List\n\n");
  885. DbgPrint(" pGroup dwFlags dwID dwVersion nPlr nGrp nSubGrp short name long name\n");
  886. // 00000000 00000000 00000000 00000000 4 4 4 123456789012345
  887. while (this)
  888. {
  889. DbgPrint("%08x %08x %08x %08x %4d %4d %7d ",
  890. this, this->dwFlags, this->dwID, this->dwVersion,
  891. this->nPlayers, this->nGroups, this->nSubgroups);
  892. PrintWideString(this->lpszShortName, 16);
  893. PrintWideString(this->lpszLongName, 16);
  894. DbgPrint("\n");
  895. this = this->pNextGroup;
  896. }
  897. }
  898. VOID PrintSessionDescFlags(DWORD dwFlags)
  899. {
  900. DWORD dwMask, dwField, dwBitCount;
  901. dwBitCount = 0;
  902. dwMask = 1;
  903. while (dwMask)
  904. {
  905. dwField = dwFlags & dwMask;
  906. if (dwField)
  907. {
  908. if (dwBitCount == 0)
  909. DbgPrint(" (");
  910. else
  911. DbgPrint(" |\n ");
  912. switch (dwField)
  913. {
  914. case DPSESSION_NEWPLAYERSDISABLED:
  915. DbgPrint("DPSESSION_NEWPLAYERSDISABLED");
  916. break;
  917. case DPSESSION_MIGRATEHOST:
  918. DbgPrint("DPSESSION_MIGRATEHOST");
  919. break;
  920. case DPSESSION_NOMESSAGEID:
  921. DbgPrint("DPSESSION_NOMESSAGEID");
  922. break;
  923. case DPSESSION_NOPLAYERMGMT:
  924. DbgPrint("DPSESSION_NOPLAYERMGMT");
  925. break;
  926. case DPSESSION_JOINDISABLED:
  927. DbgPrint("DPSESSION_JOINDISABLED");
  928. break;
  929. case DPSESSION_KEEPALIVE:
  930. DbgPrint("DPSESSION_KEEPALIVE");
  931. break;
  932. case DPSESSION_NODATAMESSAGES:
  933. DbgPrint("DPSESSION_NODATAMESSAGES");
  934. break;
  935. case DPSESSION_SECURESERVER:
  936. DbgPrint("DPSESSION_SECURESERVER");
  937. break;
  938. case DPSESSION_PRIVATE:
  939. DbgPrint("DPSESSION_PRIVATE");
  940. break;
  941. case DPSESSION_PASSWORDREQUIRED:
  942. DbgPrint("DPSESSION_PASSWORDREQUIRED");
  943. break;
  944. case DPSESSION_MULTICASTSERVER:
  945. DbgPrint("DPSESSION_MULTICASTSERVER");
  946. break;
  947. case DPSESSION_CLIENTSERVER:
  948. DbgPrint("DPSESSION_CLIENTSERVER");
  949. break;
  950. default:
  951. DbgPrint("unknown: %08x", dwField);
  952. break;
  953. }
  954. dwBitCount++;
  955. }
  956. dwMask <<= 1;
  957. }
  958. if (dwBitCount)
  959. DbgPrint(")\n");
  960. }
  961. VOID DQSessionDesc(PUCHAR pArgs)
  962. {
  963. DPSESSIONDESC2 *this;
  964. if (!GetHexArg(&pArgs, &this))
  965. return;
  966. DbgPrint("\nSession Desc\n\n");
  967. DbgPrint("dwSize : %d\n", this->dwSize);
  968. DbgPrint("dwFlags : %08x\n", this->dwFlags);
  969. PrintSessionDescFlags(this->dwFlags);
  970. DbgPrint("guidInstance : %08x %08x %08x %08x\n",
  971. *((LPDWORD)(&this->guidInstance) + 0),
  972. *((LPDWORD)(&this->guidInstance) + 1),
  973. *((LPDWORD)(&this->guidInstance) + 2),
  974. *((LPDWORD)(&this->guidInstance) + 3));
  975. DbgPrint("guidApplication : %08x %08x %08x %08x\n",
  976. *((LPDWORD)(&this->guidApplication) + 0),
  977. *((LPDWORD)(&this->guidApplication) + 1),
  978. *((LPDWORD)(&this->guidApplication) + 2),
  979. *((LPDWORD)(&this->guidApplication) + 3));
  980. DbgPrint("dwMaxPlayers : %d\n", this->dwMaxPlayers);
  981. DbgPrint("dwCurrentPlayers : %d\n", this->dwCurrentPlayers);
  982. DbgPrint("lpszSessionName : %08x", this->lpszSessionName);
  983. PrintNameString(this->lpszSessionName);
  984. DbgPrint("lpszPassword : %08x", this->lpszPassword);
  985. PrintNameString(this->lpszPassword);
  986. DbgPrint("dwReserved1 : %08x\n", this->dwReserved1);
  987. DbgPrint("dwReserved2 : %08x\n", this->dwReserved2);
  988. DbgPrint("dwUser1 : %08x\n", this->dwUser1);
  989. DbgPrint("dwUser2 : %08x\n", this->dwUser2);
  990. DbgPrint("dwUser3 : %08x\n", this->dwUser3);
  991. DbgPrint("dwUser4 : %08x\n", this->dwUser4);
  992. }
  993. /*
  994. DQInfo - handles dot-commands of the form:
  995. .NWSERVER INFO
  996. */
  997. VOID DQInfo(PUCHAR pArgs)
  998. {
  999. DbgPrint("Hello World!\n");
  1000. }
  1001. UINT RequestTraceLevel = 0;
  1002. VOID DQTraceRequestsOn(PUCHAR pArgs)
  1003. {
  1004. RequestTraceLevel = 1;
  1005. }
  1006. VOID DQTraceRequestsOff(PUCHAR pArgs)
  1007. {
  1008. RequestTraceLevel = 0;
  1009. }
  1010. VOID DQTraceRequestsBreak(PUCHAR pArgs)
  1011. {
  1012. RequestTraceLevel = 2;
  1013. }
  1014. typedef VOID (*pQDHandler)(PUCHAR pCmd);
  1015. typedef struct {
  1016. PUCHAR pName; // Command name (unique part uppercase, optional lowercase)
  1017. pQDHandler pHandler;
  1018. } QD, *pQD;
  1019. QD QueryDispatch[] = {
  1020. { "L" , DQLog },
  1021. { "LL" , DQLogLast },
  1022. { "LV" , DQLogLevel },
  1023. { "LE" , DQLogExact },
  1024. { "Info" , DQInfo },
  1025. { "t" , DQThis },
  1026. { "p" , DQPlayer },
  1027. { "pl" , DQPlayerList },
  1028. { "pr" , DQProtocolReceive },
  1029. { "ps" , DQProtocolSession },
  1030. { "psp" , DQSendParms },
  1031. { "pool" , DQFixedMemPool },
  1032. { "g" , DQGroup },
  1033. { "gl" , DQGroupList },
  1034. { "ss" , DQProtocolSend },
  1035. { "sd" , DQSessionDesc },
  1036. { "cl" , DQContextList },
  1037. { "cp" , DQContextPool },
  1038. { "" , 0 }
  1039. };
  1040. QD TraceDispatch[] = {
  1041. { "" , 0 }
  1042. };
  1043. QD TraceRequestDispatch[] = {
  1044. { "ON" , DQTraceRequestsOn },
  1045. { "OFf" , DQTraceRequestsOff },
  1046. { "Break" , DQTraceRequestsBreak },
  1047. { "" , 0 }
  1048. };
  1049. UINT QDMatch(PUCHAR pU, PUCHAR pT)
  1050. {
  1051. while (*pU == *pT) {
  1052. if (*pU == 0)
  1053. return 1;
  1054. pU++;
  1055. pT++;
  1056. }
  1057. if (*pT < 'a')
  1058. return 0;
  1059. while (*pT != 0 && *pU == (*pT - ('a' - 'A'))) {
  1060. pU++;
  1061. pT++;
  1062. }
  1063. if (*pU != 0)
  1064. return 0;
  1065. return 1;
  1066. }
  1067. pQD LookUpQD(PUCHAR pCmd, pQD pTable)
  1068. {
  1069. UINT i;
  1070. if (!pCmd)
  1071. return NULL;
  1072. for (i = 0; pTable[i].pHandler != NULL; i++) {
  1073. if (QDMatch(pCmd, pTable[i].pName))
  1074. return &(pTable[i]);
  1075. }
  1076. return NULL;
  1077. }
  1078. #define MAX_DEBUG_QUERY_COMMAND_LENGTH 100
  1079. UCHAR DebugQueryCmdStr[MAX_DEBUG_QUERY_COMMAND_LENGTH+1] = "";
  1080. UINT DebugQueryCmdStrLen = MAX_DEBUG_QUERY_COMMAND_LENGTH;
  1081. void DQparse ( PUCHAR pCmd, pQD pqt )
  1082. {
  1083. UCHAR c;
  1084. PUCHAR pCmdName;
  1085. pQD pq;
  1086. pCmdName = GetArg(&pCmd);
  1087. if ( (pq = LookUpQD(pCmdName, pqt)) ) {
  1088. (*pq->pHandler)(pCmd);
  1089. } else {
  1090. DbgPrint("====== DPLAY Debugging VXD (DPLAY.VXD) ======\n\n");
  1091. DbgPrint(" t <addr> - dump this pointer\n");
  1092. DbgPrint(" p <addr> - dump player\n");
  1093. DbgPrint(" pl <addr> - dump player list\n");
  1094. DbgPrint(" g <addr> - dump group\n");
  1095. DbgPrint(" gl <addr> - dump group list\n");
  1096. DbgPrint(" sd <addr> - dump session desc\n");
  1097. DbgPrint(" psp <addr> - dump SENDPARMS\n");
  1098. DbgPrint(" cl <addr-this> - dump context list off of this\n");
  1099. DbgPrint(" cp <addr-this> - dump context pool off of this\n");
  1100. DbgPrint(" L <record> - dump log starting at record#\n");
  1101. DbgPrint(" LL <numrecords> - dump the last numrecords\n");
  1102. DbgPrint(" LV <level> - set log debug level (<=)\n");
  1103. DbgPrint(" LE <level> - set log debug level (equal only)\n");
  1104. DbgPrint(" ps <addr> - dump protocol session\n");
  1105. DbgPrint(" ss <addr> - dump protocol send\n");
  1106. DbgPrint(" pr <addr> - dump protocol receive\n");
  1107. DbgPrint("\n");
  1108. }
  1109. }
  1110. VOID DQTrace(PUCHAR pArgs)
  1111. {
  1112. DQparse(pArgs, TraceDispatch);
  1113. }
  1114. VOID DQTraceRequests(PUCHAR pArgs)
  1115. {
  1116. DQparse(pArgs, TraceRequestDispatch);
  1117. }
  1118. void Debug_Query ( PUCHAR pCmd )
  1119. {
  1120. DQparse(pCmd, QueryDispatch);
  1121. }