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.

7045 lines
242 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1994 - 2001
  6. //
  7. // File: rpcdbg.cxx
  8. //
  9. //--------------------------------------------------------------------------
  10. /*++
  11. Module Name:
  12. rpcdbg.cxx
  13. Abstract:
  14. Author:
  15. Jeff Roberts (jroberts) 13-May-1996
  16. Revision History:
  17. 13-May-1996 jroberts Created this module.
  18. Mazhar Mohammed (mazharm) 3-20-97 - changed it all for async RPC,
  19. added some cool stuff
  20. single dll for ntsd and kd
  21. KamenM Dec 99 Added debugging support and multiple
  22. ntsd-through-kd sessions support
  23. GrigoriK Mar 2001 Added support for type info.
  24. --*/
  25. #define KDEXT_64BIT
  26. #include <stddef.h>
  27. #include <limits.h>
  28. #define DG_LOGGING
  29. #define private public
  30. #define protected public
  31. #include <sysinc.h>
  32. #include <wincrypt.h>
  33. #include <rpc.h>
  34. #include <rpcndr.h>
  35. #include <ndrp.h>
  36. #include <wdbgexts.h>
  37. #include <rpcdcep.h>
  38. #include <rpcerrp.h>
  39. #define SECURITY_WIN32
  40. #include <rpcssp.h>
  41. #include <authz.h>
  42. #include <align.h>
  43. #include <util.hxx>
  44. #include <rpcuuid.hxx>
  45. #include <interlck.hxx>
  46. #include <mutex.hxx>
  47. #include <CompFlag.hxx>
  48. #include <sdict.hxx>
  49. #include <sdict2.hxx>
  50. #include <rpctrans.hxx>
  51. #include <CellDef.hxx>
  52. #include <CellHeap.hxx>
  53. #include <EEInfo.h>
  54. #include <EEInfo.hxx>
  55. #include <SWMR.hxx>
  56. #include <bcache.hxx>
  57. #include <threads.hxx>
  58. #include <queue.hxx>
  59. #include <gc.hxx>
  60. #include <handle.hxx>
  61. #include <binding.hxx>
  62. #include <osfpcket.hxx>
  63. #include <bitset.hxx>
  64. #include <secclnt.hxx>
  65. #include <CompFlag.hxx>
  66. #include <ProtBind.hxx>
  67. #include <osfclnt.hxx>
  68. #include <hndlsvr.hxx>
  69. #include <osfsvr.hxx>
  70. #include <rpccfg.h>
  71. #include <epmap.h>
  72. #include <delaytab.hxx>
  73. #include <memory.hxx>
  74. #include <dgpkt.hxx>
  75. #include <locks.hxx>
  76. #include <dgclnt.hxx>
  77. #include <delaytab.hxx>
  78. #include <hashtabl.hxx>
  79. #include <dgsvr.hxx>
  80. #include <lpcpack.hxx>
  81. #include <lpcsvr.hxx>
  82. #include <lpcclnt.hxx>
  83. #include <ntverp.h>
  84. #include "rpcexts.hxx"
  85. HANDLE ProcessHandle = 0;
  86. BOOL fKD = 0;
  87. // is debuggee a CHK build?
  88. BOOL ChkTarget;
  89. EXT_API_VERSION ApiVersion = { VER_PRODUCTVERSION_W >> 8,
  90. VER_PRODUCTVERSION_W & 0xff,
  91. EXT_API_VERSION_NUMBER64, 0 };
  92. WINDBG_EXTENSION_APIS ExtensionApis;
  93. USHORT SavedMajorVersion;
  94. USHORT SavedMinorVersion;
  95. BOOL bDebuggingChecked;
  96. int AddressSize = 0;
  97. BOOL bUnextend = FALSE;
  98. VOID
  99. WinDbgExtensionDllInit(
  100. PWINDBG_EXTENSION_APIS64 lpExtensionApis,
  101. USHORT MajorVersion,
  102. USHORT MinorVersion
  103. )
  104. {
  105. KDDEBUGGER_DATA64 KdDebuggerData;
  106. ExtensionApis = *lpExtensionApis ;
  107. SavedMajorVersion = MajorVersion;
  108. SavedMinorVersion = MinorVersion;
  109. ChkTarget = SavedMajorVersion == 0x0c ? TRUE : FALSE;
  110. KdDebuggerData.Header.OwnerTag = KDBG_TAG;
  111. KdDebuggerData.Header.Size = sizeof( KdDebuggerData );
  112. if (Ioctl( IG_GET_DEBUGGER_DATA, &KdDebuggerData, sizeof( KdDebuggerData ) ))
  113. {
  114. fKD = 1;
  115. }
  116. if (IsPtr64())
  117. {
  118. AddressSize = 8;
  119. bUnextend = FALSE;
  120. }
  121. else
  122. {
  123. AddressSize = 4;
  124. bUnextend = TRUE;
  125. }
  126. }
  127. // By default we use the type information in extensins.
  128. // This flag can be reset with !rpcexts.typeinfo off which will
  129. // disable the use of type information. !typeinfo on will
  130. // enable it.
  131. BOOL fUseTypeInfo = TRUE;
  132. // If not set, the _NOSPEW macros will not print debugger spew.
  133. // It is set to FALSE after the spew is printed by one of thise macros.
  134. BOOL fSpew = TRUE;
  135. char *
  136. BoolString(
  137. BOOL Value
  138. )
  139. {
  140. switch (Value)
  141. {
  142. case TRUE: return "True";
  143. case FALSE: return "False";
  144. default: return "?????";
  145. }
  146. }
  147. ULONG GetTypeSize(PUCHAR TypeName)
  148. {
  149. SYM_DUMP_PARAM Sym = {
  150. sizeof (SYM_DUMP_PARAM),
  151. TypeName,
  152. DBG_DUMP_NO_PRINT, 0,
  153. NULL,
  154. NULL,
  155. NULL,
  156. NULL
  157. };
  158. return Ioctl(IG_GET_TYPE_SIZE, &Sym, Sym.size);
  159. }
  160. ULONG64 GetVar(PCSTR VarName) {
  161. ULONG64 Var = 0;
  162. ULONG64 VarAddr = GetExpression(VarName);
  163. if (!VarAddr)
  164. {
  165. dprintf("Failure to get address of %s\n", VarName);
  166. return NULL;
  167. }
  168. if (ReadPtrUnextend(VarAddr, &Var))
  169. return NULL;
  170. return Var;
  171. }
  172. void do_dcebinding (ULONG64 qwAddr);
  173. void do_dgep (ULONG64 qwAddr);
  174. void do_dgsc (ULONG64 qwAddr);
  175. void do_dgsn (ULONG64 qwAddr);
  176. void do_osfbh (ULONG64 qwAddr);
  177. void do_osfca (ULONG64 qwAddr);
  178. void do_osfcconn (ULONG64 qwAddr);
  179. void do_osfccall (ULONG64 qwAddr);
  180. void do_osfaddr (ULONG64 qwAddr);
  181. void do_osfsconn (ULONG64 qwAddr);
  182. void do_osfscall (ULONG64 qwAddr);
  183. void do_osfsa (ULONG64 qwAddr);
  184. void do_rpcsvr (ULONG64 qwAddr);
  185. void do_lpcaddr (ULONG64 qwAddr);
  186. void do_lpcsa (ULONG64 qwAddr);
  187. void do_lpcscall (ULONG64 qwAddr);
  188. void do_lpcccall (ULONG64 qwAddr);
  189. void do_lpcbh (ULONG64 qwAddr);
  190. void do_lpcca (ULONG64 qwAddr);
  191. void do_rpcmem (ULONG64 qwAddr, long lDisplay, long lVerbose);
  192. void do_rpcmsg (ULONG64 qwAddr);
  193. void do_pasync (ULONG64 qwAddr);
  194. void do_authinfo (ULONG64 qwAddr);
  195. void do_error (ULONG64 qwAddr);
  196. void do_dict (ULONG64 qwAddr);
  197. void do_dict2 (ULONG64 qwAddr);
  198. void do_queue (ULONG64 qwAddr);
  199. void do_stubmsg (ULONG64 qwAddr);
  200. void do_thread (ULONG64 qwAddr);
  201. void do_copacket (ULONG64 qwAddr);
  202. void do_obj (ULONG64 qwAddr);
  203. void do_transinfo (ULONG64 qwAddr);
  204. void do_lpcpacket (ULONG64 qwAddr);
  205. void do_IF (ULONG64 qwAddr);
  206. void do_assoctable (ULONG64 qwAddr);
  207. void do_eerecord (ULONG64 qwAddr);
  208. void do_eeinfo (ULONG64 qwAddr);
  209. void do_dgaddr (ULONG64 qwAddr);
  210. void do_dgca (ULONG64 qwAddr);
  211. void do_dgbh (ULONG64 qwAddr);
  212. void do_dgag (ULONG64 qwAddr);
  213. void do_dgcn (ULONG64 qwAddr);
  214. void do_typeinfo (ULONG64 qwAddr);
  215. void do_pipestate (ULONG64 qwAddr);
  216. void do_pipedesc (ULONG64 qwAddr);
  217. void do_pipearg (ULONG64 qwAddr);
  218. void do_pipemsg (ULONG64 qwAddr);
  219. void do_dgpe (ULONG64 qwAddr);
  220. void do_dgcc (ULONG64 qwAddr);
  221. void do_packet (ULONG64 qwAddr);
  222. void do_packet_header (ULONG64 qwAddr);
  223. void do_trans (ULONG64 qwAddr);
  224. void do_dgpkt (ULONG64 qwAddr);
  225. void do_dgpkthdr (ULONG64 qwAddr);
  226. void do_asyncdcom (ULONG64 qwAddr);
  227. void do_asyncmsg (ULONG64 qwAddr);
  228. void do_asyncrpc (ULONG64 qwAddr);
  229. void do_listcalls (ULONG64 qwAddr);
  230. MY_DECLARE_API( assoctable )
  231. MY_DECLARE_API( dgep )
  232. MY_DECLARE_API( dgca )
  233. MY_DECLARE_API( dgcn )
  234. MY_DECLARE_API( dgsn )
  235. MY_DECLARE_API( dgsc )
  236. MY_DECLARE_API( osfbh )
  237. MY_DECLARE_API( osfca )
  238. MY_DECLARE_API( osfaddr )
  239. MY_DECLARE_API( osfscall )
  240. MY_DECLARE_API( osfsconn )
  241. MY_DECLARE_API( dcebinding )
  242. MY_DECLARE_API( osfccall )
  243. MY_DECLARE_API( osfcconn )
  244. MY_DECLARE_API( osfsa )
  245. MY_DECLARE_API( rpcmsg )
  246. MY_DECLARE_API( lpcaddr )
  247. MY_DECLARE_API( lpcsa );
  248. MY_DECLARE_API( lpcscall );
  249. MY_DECLARE_API( lpcccall );
  250. MY_DECLARE_API( lpcbh );
  251. MY_DECLARE_API( lpcca );
  252. MY_DECLARE_API( pasync);
  253. MY_DECLARE_API( authinfo );
  254. MY_DECLARE_API( error );
  255. MY_DECLARE_API( dict );
  256. MY_DECLARE_API( dict2 );
  257. MY_DECLARE_API( queue );
  258. MY_DECLARE_API( stubmsg );
  259. MY_DECLARE_API( thread );
  260. MY_DECLARE_API( copacket );
  261. MY_DECLARE_API( obj );
  262. MY_DECLARE_API( transinfo );
  263. MY_DECLARE_API( lpcpacket );
  264. MY_DECLARE_API( IF );
  265. MY_DECLARE_API( eerecord );
  266. MY_DECLARE_API( eeinfo );
  267. MY_DECLARE_API( dgcc );
  268. MY_DECLARE_API( dgpe );
  269. MY_DECLARE_API( pipestate );
  270. MY_DECLARE_API( pipedesc );
  271. MY_DECLARE_API( pipearg );
  272. MY_DECLARE_API( pipemsg );
  273. MY_DECLARE_API( dgpkt );
  274. MY_DECLARE_API( dgpkthdr );
  275. MY_DECLARE_API( asyncdcom );
  276. MY_DECLARE_API( asyncmsg );
  277. MY_DECLARE_API( asyncrpc );
  278. // define our own operators new and delete, so that we do not have to include the crt
  279. void * __cdecl
  280. ::operator new(size_t dwBytes)
  281. {
  282. void *p;
  283. p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBytes);
  284. return (p);
  285. }
  286. void __cdecl
  287. ::operator delete (void *p)
  288. {
  289. HeapFree(GetProcessHeap(), 0, p);
  290. }
  291. // Returns 1 on failure.
  292. BOOL ReadPtrUnextend(ULONG64 Addr, PULONG64 pVal) {
  293. *pVal = 0;
  294. if (!ReadPointer(Addr, pVal))
  295. return 1;
  296. if (bUnextend)
  297. *pVal = (ULONG64) (ULONG) *pVal;
  298. return 0;
  299. }
  300. BOOL
  301. GetData(IN ULONG64 qwAddress, IN LPVOID ptr, IN ULONG size)
  302. {
  303. BOOL b;
  304. ULONG BytesRead = 0;
  305. b = ReadMemory(qwAddress, ptr, size, &BytesRead );
  306. if (!b || BytesRead != size )
  307. {
  308. return FALSE;
  309. }
  310. return TRUE;
  311. }
  312. #define MAX_MESSAGE_BLOCK_SIZE 1024
  313. #define BLOCK_SIZE 16
  314. RPC_CHAR *
  315. ReadProcessRpcChar(
  316. ULONG64 qwAddr
  317. )
  318. {
  319. char block[BLOCK_SIZE];
  320. RPC_CHAR *RpcBlock = (RPC_CHAR *)block;
  321. RPC_CHAR *RpcString = (RPC_CHAR *) new char[MAX_MESSAGE_BLOCK_SIZE];
  322. if (RpcString == NULL) {
  323. dprintf("couldn't allocate %d memory\n", MAX_MESSAGE_BLOCK_SIZE);
  324. return (NULL);
  325. }
  326. int length = 0;
  327. int i = 0;
  328. BOOL b;
  329. BOOL end = FALSE;
  330. if (qwAddr == NULL) {
  331. delete [] RpcString;
  332. return (NULL);
  333. }
  334. for (length = 0; length < MAX_MESSAGE_BLOCK_SIZE/2; ) {
  335. b = GetData(qwAddr, block, BLOCK_SIZE);
  336. if (b == FALSE) {
  337. dprintf("couldn't read address %I64xx\n", qwAddr);
  338. delete [] RpcString;
  339. return (NULL);
  340. }
  341. for (i = 0; i < BLOCK_SIZE/2; i++) {
  342. if (RpcBlock[i] == L'\0') {
  343. end = TRUE;
  344. }
  345. RpcString[length] = RpcBlock[i];
  346. length++;
  347. }
  348. if (end == TRUE) {
  349. break;
  350. }
  351. qwAddr += BLOCK_SIZE;
  352. }
  353. return (RpcString);
  354. }
  355. long
  356. myatol(char *string)
  357. {
  358. int i = 0;
  359. BOOL minus = FALSE;
  360. long number = 0;
  361. long tmpnumber = 0 ;
  362. long chknum = LONG_MAX;
  363. if (string[0] == '-') {
  364. minus = TRUE;
  365. i++;
  366. }
  367. else
  368. if (string[0] == '+') {
  369. i++;
  370. }
  371. for (; string[i] != '\0'; i++) {
  372. if ((string[i] >= '0')&&(string[i] <= '9')) {
  373. tmpnumber = string[i] - '0';
  374. if (number != 0)
  375. {
  376. chknum = LONG_MAX/number;
  377. }
  378. if (chknum > 11) {
  379. number = number*10 + tmpnumber;
  380. }
  381. }
  382. else
  383. return 0;
  384. }
  385. if (minus == TRUE) {
  386. number = 0 - number;
  387. }
  388. return number;
  389. }
  390. PCHAR
  391. MapSymbol(ULONG64 qwAddr)
  392. {
  393. static CHAR Name[256];
  394. ULONG64 Displacement;
  395. GetSymbol(qwAddr, Name, &Displacement);
  396. if (strcmp(Name, "") != 0) {
  397. if (Displacement)
  398. strcat(Name, "+");
  399. PCHAR p = strchr(Name, '\0');
  400. if (Displacement)
  401. _ui64toa(Displacement, p, 16);
  402. return(Name);
  403. }
  404. else {
  405. return NULL;
  406. }
  407. }
  408. // checks if the uuid is null, prints the uuid
  409. void
  410. PrintUuidLocal(UUID *Uuid)
  411. {
  412. unsigned long PAPI * Vector;
  413. Vector = (unsigned long PAPI *) Uuid;
  414. if ( (Vector[0] == 0)
  415. && (Vector[1] == 0)
  416. && (Vector[2] == 0)
  417. && (Vector[3] == 0))
  418. {
  419. dprintf("(Null Uuid)");
  420. }
  421. else
  422. {
  423. dprintf("%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
  424. Uuid->Data1, Uuid->Data2, Uuid->Data3, Uuid->Data4[0], Uuid->Data4[1],
  425. Uuid->Data4[2], Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
  426. Uuid->Data4[6], Uuid->Data4[7] );
  427. }
  428. return;
  429. }
  430. // prints the uuid at a given address within the process
  431. void
  432. PrintUuid(ULONG64 Uuid)
  433. {
  434. UUID UuidStore;
  435. GetData(Uuid, &UuidStore, sizeof(UUID));
  436. PrintUuidLocal(&UuidStore);
  437. }
  438. // Returns a string for the symbol that matches the value at
  439. // address dwAddr, or "".
  440. PCHAR SymbolAtAddress(ULONG64 Addr)
  441. {
  442. CHAR Symbol[128];
  443. ULONG64 Displacement = 0;
  444. static CHAR Name[256];
  445. ULONG64 Val;
  446. if (ReadPtrUnextend(Addr, &Val))
  447. return "";
  448. GetSymbol(Val, Symbol, &Displacement);
  449. if (strcmp(Symbol, "") != 0) {
  450. sprintf(Name, "%s+%x", Symbol, Displacement);
  451. return Name;
  452. }
  453. else
  454. return "";
  455. }
  456. // Returns a string for the symbol that matches the value at
  457. // address dwAddr, without the offset, or "".
  458. PCHAR SymbolAtAddressNoOffset(ULONG64 Addr)
  459. {
  460. CHAR Symbol[128];
  461. ULONG64 Displacement = 0;
  462. static CHAR Name[256];
  463. ULONG64 Val;
  464. if (ReadPtrUnextend(Addr, &Val))
  465. return "";
  466. GetSymbol(Val, Symbol, &Displacement);
  467. if (strcmp(Symbol, "") != 0) {
  468. strcpy(Name, Symbol);
  469. return Name;
  470. }
  471. else
  472. return "";
  473. }
  474. void
  475. do_securitycontext (
  476. ULONG64 qwAddr
  477. )
  478. {
  479. ULONG64 tmp1;
  480. ULONG tmp2;
  481. if (qwAddr == 0)
  482. {
  483. return;
  484. }
  485. do_authinfo(qwAddr);
  486. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, AuthContextId,
  487. " AuthContextId ", tmp1);
  488. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, Flags,
  489. " Flags ", tmp1);
  490. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, ContextAttributes,
  491. " ContextAttributes ", tmp1);
  492. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, fFullyConstructed,
  493. " fFullyConstructed ", tmp1);
  494. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, DontForgetToDelete,
  495. " DontForgetToDelete ", tmp1);
  496. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, fDatagram,
  497. " fDatagram ", tmp1);
  498. ULONG64 SecurityContext;
  499. GET_ADDRESS_OF(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, SecurityContext, SecurityContext, tmp2);
  500. ULONG64 dwUpper, dwLower;
  501. GET_MEMBER(SecurityContext, _SecHandle, RPCRT4!_SecHandle, dwUpper, dwUpper);
  502. GET_MEMBER(SecurityContext, _SecHandle, RPCRT4!_SecHandle, dwLower, dwLower);
  503. dprintf(
  504. " SecurityContext(0x%I64x, 0x%I64x) - 0x%I64x\n", dwUpper, dwLower, SecurityContext);
  505. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, MaxHeaderLength,
  506. " MaxHeaderLength ", tmp1);
  507. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, MaxSignatureLength,
  508. " MaxSignatureLength ", tmp1);
  509. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, cbBlockSize,
  510. " cbBlockSize ", tmp1);
  511. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, RpcSecurityInterface,
  512. " RpcSecurityInterface ", tmp1);
  513. PRINT_MEMBER_WITH_LABEL(qwAddr, SECURITY_CONTEXT, RPCRT4!SECURITY_CONTEXT, FailedContext,
  514. " FailedContext ", tmp1);
  515. }
  516. VOID
  517. do_sizes(
  518. )
  519. {
  520. PRINT_RPC_TYPE_SIZE(ASSOCIATION_HANDLE);
  521. dprintf("BIND_NAK_PICKLE_BUFFER_OFFSET - 0x%x\n", BIND_NAK_PICKLE_BUFFER_OFFSET);
  522. PRINT_RPC_TYPE_SIZE(BINDING_HANDLE);
  523. PRINT_RPC_TYPE_SIZE(BITSET);
  524. PRINT_RPC_TYPE_SIZE(CALL);
  525. PRINT_RPC_TYPE_SIZE(CCALL);
  526. PRINT_RPC_TYPE_SIZE(CLIENT_AUTH_INFO);
  527. PRINT_RPC_TYPE_SIZE(CLIENT_ID);
  528. PRINT_RPC_TYPE_SIZE(DCE_BINDING);
  529. PRINT_RPC_TYPE_SIZE(DCE_SECURITY_INFO);
  530. PRINT_RPC_TYPE_SIZE(EVENT);
  531. PRINT_RPC_TYPE_SIZE(GENERIC_OBJECT);
  532. PRINT_RPC_TYPE_SIZE(INTERLOCKED_INTEGER);
  533. PRINT_RPC_TYPE_SIZE(LOADABLE_TRANSPORT);
  534. PRINT_RPC_TYPE_SIZE(LRPC_ADDRESS);
  535. PRINT_RPC_TYPE_SIZE(LRPC_BIND_EXCHANGE);
  536. PRINT_RPC_TYPE_SIZE(LRPC_BINDING_HANDLE);
  537. PRINT_RPC_TYPE_SIZE(LRPC_CASSOCIATION);
  538. PRINT_RPC_TYPE_SIZE(LRPC_CCALL);
  539. PRINT_RPC_TYPE_SIZE(LRPC_MESSAGE);
  540. PRINT_RPC_TYPE_SIZE(LRPC_FAULT_MESSAGE);
  541. PRINT_RPC_TYPE_SIZE(LRPC_FAULT2_MESSAGE);
  542. PRINT_RPC_TYPE_SIZE(LRPC_RPC_HEADER);
  543. PRINT_RPC_TYPE_SIZE(LRPC_SASSOCIATION);
  544. PRINT_RPC_TYPE_SIZE(LRPC_SCALL);
  545. PRINT_RPC_TYPE_SIZE(LRPC_SERVER);
  546. dprintf("MAX_BIND_NAK - 0x%x\n", MAX_BIND_NAK);
  547. dprintf("MAXIMUM_FAULT_MESSAGE - 0x%x\n", MAXIMUM_FAULT_MESSAGE);
  548. dprintf("MAXIMUM_MESSAGE_BUFFER - 0x%x\n", MAXIMUM_MESSAGE_BUFFER);
  549. PRINT_RPC_TYPE_SIZE(MESSAGE_OBJECT);
  550. PRINT_RPC_TYPE_SIZE(MUTEX);
  551. PRINT_RPC_TYPE_SIZE(OSF_ADDRESS);
  552. PRINT_RPC_TYPE_SIZE(OSF_ASSOCIATION);
  553. PRINT_RPC_TYPE_SIZE(OSF_BINDING);
  554. PRINT_RPC_TYPE_SIZE(OSF_BINDING_HANDLE);
  555. PRINT_RPC_TYPE_SIZE(OSF_CASSOCIATION);
  556. PRINT_RPC_TYPE_SIZE(OSF_CCALL);
  557. PRINT_RPC_TYPE_SIZE(OSF_CCONNECTION);
  558. PRINT_RPC_TYPE_SIZE(OSF_SBINDING);
  559. PRINT_RPC_TYPE_SIZE(OSF_SCALL);
  560. PRINT_RPC_TYPE_SIZE(OSF_SCONNECTION);
  561. dprintf("PORT_MAXIMUM_MESSAGE_LENGTH - 0x%x\n", PORT_MAXIMUM_MESSAGE_LENGTH);
  562. PRINT_RPC_TYPE_SIZE(PORT_MESSAGE);
  563. PRINT_RPC_TYPE_SIZE(QUEUE);
  564. PRINT_RPC_TYPE_SIZE(RPC_ADDRESS);
  565. PRINT_RPC_TYPE_SIZE(RPC_APC_INFO);
  566. PRINT_RPC_TYPE_SIZE(RPC_CLIENT_INTERFACE);
  567. PRINT_RPC_TYPE_SIZE(RPC_CLIENT_PROCESS_IDENTIFIER);
  568. PRINT_RPC_TYPE_SIZE(rpcconn_alter_context);
  569. PRINT_RPC_TYPE_SIZE(rpcconn_alter_context_resp);
  570. PRINT_RPC_TYPE_SIZE(rpcconn_bind);
  571. PRINT_RPC_TYPE_SIZE(rpcconn_bind_ack);
  572. PRINT_RPC_TYPE_SIZE(rpcconn_common);
  573. PRINT_RPC_TYPE_SIZE(rpcconn_fault);
  574. PRINT_RPC_TYPE_SIZE(rpcconn_request);
  575. PRINT_RPC_TYPE_SIZE(rpcconn_response);
  576. PRINT_RPC_TYPE_SIZE(RPC_INTERFACE);
  577. PRINT_RPC_TYPE_SIZE(RPC_INTERFACE_MANAGER);
  578. #if DBG
  579. PRINT_RPC_TYPE_SIZE(RPC_MEMORY_BLOCK);
  580. #endif
  581. PRINT_RPC_TYPE_SIZE(RPC_MESSAGE);
  582. PRINT_RPC_TYPE_SIZE(RPC_SERVER);
  583. PRINT_RPC_TYPE_SIZE(RPC_SERVER_INTERFACE);
  584. PRINT_RPC_TYPE_SIZE(RPC_SYNTAX_IDENTIFIER);
  585. PRINT_RPC_TYPE_SIZE(RPC_UUID);
  586. PRINT_RPC_TYPE_SIZE(SCALL);
  587. PRINT_RPC_TYPE_SIZE(SECURITY_CONTEXT);
  588. PRINT_RPC_TYPE_SIZE(sec_trailer);
  589. PRINT_RPC_TYPE_SIZE(SIMPLE_DICT);
  590. PRINT_RPC_TYPE_SIZE(SIMPLE_DICT2);
  591. PRINT_RPC_TYPE_SIZE(THREAD);
  592. PRINT_RPC_TYPE_SIZE(TRANS_INFO);
  593. }
  594. DECLARE_API( sizes )
  595. {
  596. do_sizes();
  597. }
  598. char *
  599. GetError (DWORD dwError)
  600. {
  601. DWORD dwFlag = FORMAT_MESSAGE_FROM_SYSTEM;
  602. static CHAR szErrorMessage[1024];
  603. static HANDLE hSource = NULL;
  604. if ((dwError >= 2100) && (dwError < 6000))
  605. {
  606. if (hSource == NULL)
  607. {
  608. hSource = LoadLibrary("netmsg.dll");
  609. }
  610. if (hSource == NULL)
  611. {
  612. sprintf (szErrorMessage,
  613. "Unable to load netmsg.dll. Error %d occured.\n",
  614. dwError);
  615. return(szErrorMessage);
  616. }
  617. dwFlag = FORMAT_MESSAGE_FROM_HMODULE;
  618. }
  619. if (!FormatMessage (dwFlag,
  620. hSource,
  621. dwError,
  622. 0,
  623. szErrorMessage,
  624. 1024,
  625. NULL))
  626. {
  627. sprintf (szErrorMessage,
  628. "An unknown error occured: 0x%x \n",
  629. dwError);
  630. }
  631. return(szErrorMessage);
  632. }
  633. VOID
  634. do_error (
  635. ULONG64 Error
  636. )
  637. {
  638. dprintf("%x: %s\n", (unsigned long)Error, GetError((unsigned long) Error));
  639. }
  640. VOID
  641. do_IF (
  642. ULONG64 rpcif
  643. )
  644. {
  645. ULONG64 tmp0;
  646. ULONG64 tmp1;
  647. ULONG tmp2;
  648. dprintf("RPC_INTERFACE at 0x%I64x\n\n", rpcif);
  649. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, Server, tmp0);
  650. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, NullManagerEpv, tmp0);
  651. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, NullManagerFlag, tmp0);
  652. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, ManagerCount, tmp0);
  653. GET_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, NullManagerActiveCallCount, tmp0, tmp2);
  654. PRINT_MEMBER_WITH_LABEL(tmp0, INTERLOCKED_INTEGER, RPCRT4!INTERLOCKED_INTEGER, Integer, "NullManagerActiveCallCount", tmp1);
  655. GET_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, AutoListenCallCount, tmp0, tmp2);
  656. PRINT_MEMBER_WITH_LABEL(tmp0, INTERLOCKED_INTEGER, RPCRT4!INTERLOCKED_INTEGER, Integer, "AutoListenCallCount", tmp1);
  657. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, Flags, tmp0);
  658. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, MaxCalls, tmp0);
  659. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, CallbackFn, tmp0);
  660. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, PipeInterfaceFlag, tmp0);
  661. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, fReplace, tmp0);
  662. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, fBindingsExported, tmp0);
  663. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, UuidVector, tmp0);
  664. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, SequenceNumber, tmp0);
  665. #if DBG
  666. PRINT_MEMBER(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, Strict, tmp0);
  667. #endif
  668. PRINT_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, RpcInterfaceInformation, tmp2);
  669. PRINT_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, InterfaceManagerDictionary, tmp2);
  670. PRINT_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, Annotation, tmp2);
  671. PRINT_ADDRESS_OF(rpcif, RPC_INTERFACE, RPCRT4!RPC_INTERFACE, NsEntries, tmp2);
  672. }
  673. VOID
  674. do_obj (
  675. ULONG64 qwAddr
  676. )
  677. {
  678. BOOL b;
  679. ULONG64 MagicValue;
  680. ULONG64 ObjectType;
  681. if (ReadPtrUnextend(qwAddr+AddressSize, &MagicValue)) {
  682. dprintf("Bad or deleted object at %p\n", qwAddr);
  683. return;
  684. }
  685. if(ReadPtrUnextend(qwAddr+AddressSize+4, &ObjectType)) {
  686. dprintf("Bad or deleted object at %p\n", qwAddr);
  687. return;
  688. }
  689. if ((ULONG)MagicValue != MAGICLONG) {
  690. dprintf("Bad or deleted object at %p\n", qwAddr);
  691. return;
  692. }
  693. switch (((ULONG)ObjectType) & (~OBJECT_DELETED))
  694. {
  695. case DG_CALLBACK_TYPE:
  696. dprintf("this is a DG_CLIENT_CALLBACK object\n");
  697. break;
  698. case DG_CCALL_TYPE:
  699. {
  700. dprintf("Dumping DG_CCALL...\n");
  701. do_dgcc(qwAddr);
  702. break;
  703. }
  704. case DG_SCALL_TYPE:
  705. {
  706. dprintf("Dumping DG_SCALL...\n");
  707. do_dgsc(qwAddr);
  708. break;
  709. }
  710. case DG_BINDING_HANDLE_TYPE:
  711. {
  712. dprintf("dumping DG_BINDING_HANDLE...\n");
  713. do_dgbh(qwAddr);
  714. break;
  715. }
  716. case DG_CCONNECTION_TYPE:
  717. {
  718. dprintf("Dumping DG_CCONNECTION...\n");
  719. do_dgcn(qwAddr);
  720. break;
  721. }
  722. case DG_SCONNECTION_TYPE:
  723. {
  724. dprintf("Dumping DG_SCONNECTION...\n");
  725. do_dgsn(qwAddr);
  726. break;
  727. }
  728. case DG_ADDRESS_TYPE:
  729. {
  730. dprintf("dumping DG_ADDRESS\n");
  731. do_dgaddr(qwAddr);
  732. break;
  733. }
  734. case DG_CASSOCIATION_TYPE:
  735. {
  736. dprintf("a DG_CASSOCIATION\n");
  737. do_dgca(qwAddr);
  738. break;
  739. }
  740. case DG_SASSOCIATION_TYPE:
  741. {
  742. dprintf("a datagram ASSOCIATION_GROUP\n");
  743. do_dgag(qwAddr);
  744. break;
  745. }
  746. case OSF_BINDING_HANDLE_TYPE:
  747. dprintf("Dumping OSF_BINDING_HANDLE...\n");
  748. do_osfbh(qwAddr);
  749. break;
  750. case OSF_CCALL_TYPE:
  751. dprintf("Dumping OSF_CCALL...\n");
  752. do_osfccall(qwAddr);
  753. break;
  754. case OSF_SCALL_TYPE:
  755. dprintf("Dumping OSF_SCALL...\n");
  756. do_osfscall(qwAddr);
  757. break;
  758. case OSF_CCONNECTION_TYPE:
  759. dprintf("Dumping OSF_CCONNECTION...\n");
  760. do_osfcconn(qwAddr);
  761. break;
  762. case OSF_SCONNECTION_TYPE:
  763. dprintf("Dumping OSF_SCONNECTION...\n");
  764. do_osfsconn(qwAddr);
  765. break;
  766. case OSF_CASSOCIATION_TYPE:
  767. dprintf("Dumping OSF_CASSOCIATION...\n");
  768. do_osfca(qwAddr);
  769. break;
  770. case OSF_ASSOCIATION_TYPE:
  771. dprintf("Dumping OSF_ASSOCIATION...\n");
  772. do_osfsa(qwAddr);
  773. break;
  774. case OSF_ADDRESS_TYPE:
  775. dprintf("Dumping OSF_ADDRESS...\n");
  776. do_osfaddr(qwAddr);
  777. break;
  778. case LRPC_CCALL_TYPE:
  779. dprintf("Dumping LRPC_CCALL ...\n");
  780. do_lpcccall(qwAddr);
  781. break;
  782. case LRPC_SCALL_TYPE:
  783. dprintf("Dumping LRPC_SCALL ...\n");
  784. do_lpcscall(qwAddr);
  785. break;
  786. case LRPC_CASSOCIATION_TYPE:
  787. dprintf("Dumping LRPC_CASSOCIATION...\n");
  788. do_lpcca(qwAddr);
  789. break;
  790. case LRPC_SASSOCIATION_TYPE:
  791. dprintf("Dumping LRPC_SASSOCIATION...\n");
  792. do_lpcsa(qwAddr);
  793. break;
  794. case LRPC_BINDING_HANDLE_TYPE:
  795. dprintf("Dumping LRPC_BINDING_HANDLE...\n");
  796. do_lpcbh(qwAddr);
  797. break;
  798. case LRPC_ADDRESS_TYPE:
  799. dprintf("Dumping LRPC_ADDRESS...\n");
  800. do_lpcaddr(qwAddr);
  801. break;
  802. default:
  803. dprintf("The RPC object type is 0x%lx and I don't recognize it.\n", (ObjectType) & ~(OBJECT_DELETED));
  804. }
  805. }
  806. void
  807. do_secinfo (
  808. )
  809. {
  810. ULONG64 List;
  811. ULONG64 ProviderList;
  812. int NumberOfPackages;
  813. int LoadedProviders;
  814. int AvailableProviders;
  815. int i, Index;
  816. BOOL b;
  817. ULONG64 qwAddr;
  818. ULONG tmp;
  819. LoadedProviders = (int) GetVar("RPCRT4!LoadedProviders");
  820. dprintf("LoadedProviders = %d\n", LoadedProviders);
  821. AvailableProviders = (int) GetVar("RPCRT4!AvailableProviders");
  822. dprintf("AvailableProviders = %d\n", AvailableProviders);
  823. ProviderList = GetVar("RPCRT4!ProviderList");
  824. dprintf("ProviderList = 0x%I64x\n", ProviderList);
  825. List = ProviderList;
  826. for (i = 0; i < LoadedProviders; i ++)
  827. {
  828. ULONG64 Count;
  829. ULONG64 SecurityPackages;
  830. GET_MEMBER(List, SECURITY_PROVIDER_INFO, RPCRT4!SECURITY_PROVIDER_INFO, Count, Count);
  831. NumberOfPackages = (int)Count;
  832. GET_MEMBER(List, SECURITY_PROVIDER_INFO, RPCRT4!SECURITY_PROVIDER_INFO, SecurityPackages, SecurityPackages);
  833. dprintf("Provider: %d\n", i);
  834. for (Index = 0;Index < NumberOfPackages;Index++)
  835. {
  836. ULONG64 SecurityPackageInfo = SecurityPackages + Index * AddressSize;
  837. ULONG64 wRPCID;
  838. ULONG64 PackageInfoAddr;
  839. GET_ADDRESS_OF(SecurityPackageInfo, SECURITY_PACKAGE_INFO, RPCRT4!SECURITY_PACKAGE_INFO, PackageInfo, PackageInfoAddr, tmp);
  840. GET_MEMBER(PackageInfoAddr, _SecPkgInfoA, RPCRT4!_SecPkgInfoA, wRPCID, wRPCID);
  841. dprintf("PackageId :%d\n", (ULONG) wRPCID);
  842. }
  843. dprintf("\n");
  844. List+=GET_TYPE_SIZE(SECURITY_PROVIDER_INFO, RPCRT4!SECURITY_PROVIDER_INFO);
  845. } //For over all packages in one provider(dll)
  846. }
  847. DECLARE_API( secinfo )
  848. {
  849. do_secinfo();
  850. }
  851. VOID
  852. do_authinfo(
  853. ULONG64 authInfo
  854. )
  855. {
  856. RPC_CHAR *ServerPrincipalName;
  857. ULONG64 tmp1;
  858. ULONG tmp2;
  859. if (authInfo == 0)
  860. {
  861. return;
  862. }
  863. ULONG64 ServerPrincipalNameAddr;
  864. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, ServerPrincipalName, ServerPrincipalNameAddr);
  865. ServerPrincipalName = ReadProcessRpcChar(ServerPrincipalNameAddr);
  866. if (ServerPrincipalName) {
  867. dprintf(" ServerPrincipalName - %ws (Address: 0x%I64x)\n", ServerPrincipalName, ServerPrincipalNameAddr);
  868. delete ServerPrincipalName;
  869. }
  870. ULONG64 AuthenticationLevel;
  871. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, AuthenticationLevel, AuthenticationLevel);
  872. switch ((ULONG)AuthenticationLevel) {
  873. case RPC_C_AUTHN_LEVEL_DEFAULT:
  874. dprintf(" AuthenticationLevel - default\n");
  875. break;
  876. case RPC_C_AUTHN_LEVEL_NONE:
  877. dprintf(" AuthenticationLevel - none\n");
  878. break;
  879. case RPC_C_AUTHN_LEVEL_CONNECT:
  880. dprintf(" AuthenticationLevel - connect\n");
  881. break;
  882. case RPC_C_AUTHN_LEVEL_CALL:
  883. dprintf(" AuthenticationLevel - call\n");
  884. break;
  885. case RPC_C_AUTHN_LEVEL_PKT:
  886. dprintf(" AuthenticationLevel - pkt\n");
  887. break;
  888. case RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:
  889. dprintf(" AuthenticationLevel - pkt integrity\n");
  890. break;
  891. case RPC_C_AUTHN_LEVEL_PKT_PRIVACY:
  892. dprintf(" AuthenticationLevel - pkt privacy\n");
  893. break;
  894. default:
  895. dprintf(" AuthenticationLevel - %ul\n", (ULONG)AuthenticationLevel);
  896. break;
  897. }
  898. ULONG64 AuthenticationService;
  899. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, AuthenticationService, AuthenticationService);
  900. switch ((ULONG)AuthenticationService) {
  901. case RPC_C_AUTHN_NONE:
  902. dprintf(" AuthenticationService - none\n");
  903. break;
  904. case RPC_C_AUTHN_DCE_PRIVATE:
  905. dprintf(" AuthenticationService - DCE private\n");
  906. break;
  907. case RPC_C_AUTHN_DCE_PUBLIC:
  908. dprintf(" AuthenticationService - DCE public\n");
  909. break;
  910. case RPC_C_AUTHN_DEC_PUBLIC:
  911. dprintf(" AuthenticationService - DEC public\n");
  912. break;
  913. case RPC_C_AUTHN_WINNT:
  914. dprintf(" AuthenticationService - WINNT\n");
  915. break;
  916. case RPC_C_AUTHN_DEFAULT:
  917. dprintf(" AuthenticationService - default\n");
  918. break;
  919. default:
  920. dprintf(" AuthenticationService - %ul\n", (ULONG)AuthenticationService);
  921. break;
  922. }
  923. ULONG64 AuthIdentity;
  924. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, AuthIdentity, AuthIdentity);
  925. dprintf(" AuthIdentity - %08x\n", (ULONG)AuthIdentity);
  926. ULONG64 AuthorizationService;
  927. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, AuthorizationService, AuthorizationService);
  928. switch ((ULONG)AuthorizationService) {
  929. case RPC_C_AUTHZ_NONE:
  930. dprintf(" AuthorizationService - none\n");
  931. break;
  932. case RPC_C_AUTHZ_NAME:
  933. dprintf(" AuthorizationService - name\n");
  934. break;
  935. case RPC_C_AUTHZ_DCE:
  936. dprintf(" AuthorizationService - DCE\n");
  937. break;
  938. default:
  939. dprintf(" AuthorizationService - %ul\n", (ULONG)AuthorizationService);
  940. break;
  941. }
  942. ULONG64 IdentityTracking;
  943. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, IdentityTracking, IdentityTracking);
  944. switch ((ULONG)IdentityTracking)
  945. {
  946. case RPC_C_QOS_IDENTITY_STATIC:
  947. dprintf(" IdentityTracking - Static\n");
  948. break;
  949. case RPC_C_QOS_IDENTITY_DYNAMIC:
  950. dprintf(" IdentityTracking - Dynamic\n");
  951. break;
  952. default:
  953. dprintf(" IdentityTracking - %08x\n", (ULONG)IdentityTracking);
  954. break;
  955. }
  956. ULONG64 ImpersonationType;
  957. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, ImpersonationType, ImpersonationType);
  958. switch ((ULONG)ImpersonationType)
  959. {
  960. case RPC_C_IMP_LEVEL_ANONYMOUS:
  961. dprintf(" ImpersonationType - Anonymous\n");
  962. break;
  963. case RPC_C_IMP_LEVEL_IDENTIFY:
  964. dprintf(" ImpersonationType - Identify\n");
  965. break;
  966. case RPC_C_IMP_LEVEL_IMPERSONATE:
  967. dprintf(" ImpersonationType - Impersonate\n");
  968. break;
  969. case RPC_C_IMP_LEVEL_DELEGATE:
  970. dprintf(" ImpersonationType - Delegate\n");
  971. break;
  972. default:
  973. dprintf(" ImpersonationType - %08x\n", (ULONG)ImpersonationType);
  974. break;
  975. }
  976. ULONG64 Capabilities;
  977. GET_MEMBER(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, Capabilities, Capabilities);
  978. switch ((ULONG)Capabilities)
  979. {
  980. case RPC_C_QOS_CAPABILITIES_DEFAULT:
  981. dprintf(" Capabilities - Default\n");
  982. break;
  983. case RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH:
  984. dprintf(" Capabilities - Mutual Auth\n");
  985. break;
  986. default:
  987. dprintf(" Capabilities - %08x\n", (ULONG)Capabilities);
  988. break;
  989. }
  990. ULONG64 ModifiedId, LowPart, HighPart;
  991. GET_ADDRESS_OF(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, ModifiedId, ModifiedId, tmp2);
  992. GET_MEMBER(ModifiedId, _LUID, RPCRT4!_LUID, LowPart, LowPart);
  993. GET_MEMBER(ModifiedId, _LUID, RPCRT4!_LUID, HighPart, HighPart);
  994. dprintf(" ModifiedId - %08x, %08x\n", (ULONG)LowPart, (ULONG)HighPart);
  995. PRINT_MEMBER_WITH_LABEL(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, DefaultLogonId, " DefaultLogonId ", tmp1);
  996. PRINT_MEMBER_WITH_LABEL(authInfo, CLIENT_AUTH_INFO, RPCRT4!CLIENT_AUTH_INFO, Credentials, " Credentials ", tmp1);
  997. if (ServerPrincipalName) {
  998. delete[] ServerPrincipalName;
  999. }
  1000. }
  1001. void do_dict (
  1002. ULONG64 qwAddr
  1003. )
  1004. {
  1005. ULONG64 tmp1;
  1006. ULONG tmp2;
  1007. ULONG64 cDictSize;
  1008. ULONG64 cDictSlots;
  1009. GET_MEMBER(qwAddr, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, cDictSize, cDictSize);
  1010. GET_MEMBER(qwAddr, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, cDictSlots, cDictSlots);
  1011. if ((ULONG)cDictSize > (ULONG)cDictSlots)
  1012. {
  1013. dprintf("Bad dictionary\t\t- %I64p\n", qwAddr);
  1014. return;
  1015. }
  1016. ULONG64 DictSlots;
  1017. GET_MEMBER(qwAddr, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, DictSlots, DictSlots);
  1018. dprintf("\n");
  1019. dprintf("Printing %d items in dictionary: %I64p with %d slots\n\n", (ULONG)cDictSize, qwAddr, (ULONG)cDictSlots);
  1020. int i;
  1021. for (i = 0; i < MIN((int)cDictSize, MAX_ITEMS_IN_DICTIONARY); i++) {
  1022. ULONG64 DictSlot;
  1023. if (!ReadPtrUnextend(DictSlots + i * AddressSize, &DictSlot)) {
  1024. dprintf ("(%d): 0x%I64x\n", i, DictSlot);
  1025. }
  1026. else {
  1027. dprintf ("Could not read dict entry at 0x%I64x\n", DictSlots + i * AddressSize);
  1028. }
  1029. dprintf("\n");
  1030. }
  1031. }
  1032. void do_dict2 (
  1033. ULONG64 qwAddr
  1034. )
  1035. {
  1036. ULONG64 tmp1;
  1037. ULONG tmp2;
  1038. ULONG64 DictKeys;
  1039. ULONG64 DictItems;
  1040. GET_MEMBER(qwAddr, SIMPLE_DICT2, RPCRT4!SIMPLE_DICT2, DictKeys, DictKeys);
  1041. GET_MEMBER(qwAddr, SIMPLE_DICT2, RPCRT4!SIMPLE_DICT2, DictItems, DictItems);
  1042. ULONG64 cDictSlots;
  1043. GET_MEMBER(qwAddr, SIMPLE_DICT2, RPCRT4!SIMPLE_DICT2, cDictSlots, cDictSlots);
  1044. dprintf("\n");
  1045. dprintf("Printing dictionary at %I64p with %d slots\n\n", qwAddr, (ULONG) cDictSlots);
  1046. int i;
  1047. for (i = 0; i < MIN((int)cDictSlots, MAX_ITEMS_IN_DICTIONARY); i++)
  1048. {
  1049. ULONG64 DictKey;
  1050. if (!ReadPtrUnextend(DictKeys + i * AddressSize, &DictKey))
  1051. {
  1052. if (DictKey != 0)
  1053. {
  1054. ULONG64 DictItem;
  1055. if (!ReadPtrUnextend(DictItems + i * AddressSize, &DictItem))
  1056. {
  1057. dprintf ("(Key: 0x%I64p): 0x%I64p\n", DictKey, DictItem);
  1058. dprintf("\n");
  1059. }
  1060. }
  1061. }
  1062. }
  1063. }
  1064. void
  1065. do_queue (
  1066. ULONG64 qwAddr
  1067. )
  1068. {
  1069. ULONG64 tmp1;
  1070. ULONG tmp2;
  1071. int i;
  1072. ULONG64 EndOfQueue;
  1073. ULONG64 QueueSlots;
  1074. GET_MEMBER(qwAddr, QUEUE, RPCRT4!QUEUE, EndOfQueue, EndOfQueue);
  1075. GET_MEMBER(qwAddr, QUEUE, RPCRT4!QUEUE, QueueSlots, QueueSlots);
  1076. dprintf("\n");
  1077. dprintf("Printing %d items in queue at %I64p\n", (ULONG)EndOfQueue, qwAddr);
  1078. dprintf("TAIL:\n");
  1079. for (i = 0; i < (int)EndOfQueue; i++)
  1080. {
  1081. ULONG64 QueueSlot;
  1082. if (!ReadPtrUnextend(QueueSlots + i * AddressSize, &QueueSlot))
  1083. {
  1084. ULONG64 Buffer;
  1085. GET_MEMBER(QueueSlot, QUEUE_ITEM, RPCRT4!QUEUE_ITEM, Buffer, Buffer);
  1086. dprintf ("(%d): %I64p\n", i, Buffer);
  1087. dprintf("\n");
  1088. }
  1089. }
  1090. dprintf("HEAD:\n");
  1091. }
  1092. void do_thread (
  1093. ULONG64 Addr
  1094. )
  1095. {
  1096. ULONG64 RpcThread;
  1097. ULONG64 tmp;
  1098. ULONG offset;
  1099. GET_MEMBER(Addr, TEB, TEB, ReservedForNtRpc, RpcThread);
  1100. dprintf("RPC TLS at 0x%I64x\n\n", RpcThread);
  1101. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, HandleToThread, tmp);
  1102. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, SavedProcedure, tmp);
  1103. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, SavedParameter, tmp);
  1104. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, ActiveCall, tmp);
  1105. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, Context, tmp);
  1106. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, CancelTimeout, tmp);
  1107. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, SecurityContext, tmp);
  1108. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, ExtendedStatus, tmp);
  1109. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, ThreadEEInfo, tmp);
  1110. GET_OFFSET_OF(THREAD, RPCRT4!THREAD, ThreadEvent, &offset);
  1111. dprintf("ThreadEvent at - 0x%I64x\n", RpcThread + offset);
  1112. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, Flags, tmp);
  1113. GET_OFFSET_OF(THREAD, RPCRT4!THREAD, BufferCache, &offset);
  1114. dprintf("buffer cache array at - 0x%I64x\n", RpcThread + offset);
  1115. PRINT_MEMBER(RpcThread, THREAD, RPCRT4!THREAD, fAsync, tmp);
  1116. dprintf("\n");
  1117. }
  1118. char *osf_ptype[] =
  1119. {
  1120. "rpc_request",
  1121. "bad packet",
  1122. "rpc_response",
  1123. "rpc_fault",
  1124. "bad packet",
  1125. "bad packet",
  1126. "bad packet",
  1127. "bad packet",
  1128. "bad packet",
  1129. "bad packet",
  1130. "bad packet",
  1131. "rpc_bind",
  1132. "rpc_bind_ack",
  1133. "rpc_bind_nak",
  1134. "rpc_alter_context",
  1135. "rpc_alter_context_resp",
  1136. "rpc_auth_3",
  1137. "rpc_shutdown",
  1138. "rpc_cancel",
  1139. "rpc_orphaned"
  1140. };
  1141. void do_copacket (
  1142. ULONG64 qwAddr
  1143. )
  1144. {
  1145. ULONG64 tmp1;
  1146. ULONG tmp2;
  1147. ULONG64 StubData;
  1148. //
  1149. // Dump the common header first
  1150. //
  1151. dprintf("\n");
  1152. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, rpc_vers, tmp1);
  1153. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, rpc_vers_minor, tmp1);
  1154. ULONG64 PTYPE;
  1155. GET_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, PTYPE, PTYPE);
  1156. dprintf ("PTYPE - 0x%x, %s\n",
  1157. (ULONG)PTYPE, osf_ptype[(ULONG)PTYPE]);
  1158. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, pfc_flags, tmp1);
  1159. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, drep, tmp1);
  1160. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, frag_length, tmp1);
  1161. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, auth_length, tmp1);
  1162. PRINT_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, call_id, tmp1);
  1163. //
  1164. // Dump the packet specific stuff
  1165. //
  1166. switch ((ULONG)PTYPE)
  1167. {
  1168. case rpc_request:
  1169. PRINT_MEMBER(qwAddr, rpcconn_request, RPCRT4!rpcconn_request, alloc_hint, tmp1);
  1170. PRINT_MEMBER(qwAddr, rpcconn_request, RPCRT4!rpcconn_request, p_cont_id, tmp1);
  1171. PRINT_MEMBER(qwAddr, rpcconn_request, RPCRT4!rpcconn_request, opnum, tmp1);
  1172. ULONG64 pfc_flags;
  1173. GET_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, pfc_flags, pfc_flags);
  1174. if ((ULONG)pfc_flags & PFC_OBJECT_UUID)
  1175. {
  1176. dprintf("UUID -\n");
  1177. ULONG64 UUID = qwAddr;
  1178. UUID += GET_TYPE_SIZE(rpcconn_common, RPCRT4!rpcconn_common);
  1179. PrintUuid(UUID);
  1180. dprintf("\n");
  1181. StubData = qwAddr;
  1182. StubData += GET_TYPE_SIZE(rpcconn_request, RPCRT4!rpcconn_request);
  1183. StubData += GET_TYPE_SIZE(UUID, RPCRT4!UUID);
  1184. dprintf ("Stub Data - 0x%I64x\n", StubData);
  1185. }
  1186. else
  1187. {
  1188. StubData = qwAddr;
  1189. StubData += GET_TYPE_SIZE(rpcconn_request, RPCRT4!rpcconn_request);
  1190. dprintf ("Stub Data - 0x%I64x\n", StubData);
  1191. }
  1192. break;
  1193. case rpc_response:
  1194. PRINT_MEMBER(qwAddr, rpcconn_response, RPCRT4!rpcconn_response, alloc_hint, tmp1);
  1195. PRINT_MEMBER(qwAddr, rpcconn_response, RPCRT4!rpcconn_response, p_cont_id, tmp1);
  1196. PRINT_MEMBER(qwAddr, rpcconn_response, RPCRT4!rpcconn_response, alert_count, tmp1);
  1197. PRINT_MEMBER(qwAddr, rpcconn_response, RPCRT4!rpcconn_response, reserved, tmp1);
  1198. StubData = qwAddr;
  1199. StubData += GET_TYPE_SIZE(rpcconn_response, RPCRT4!rpcconn_response);
  1200. dprintf ("Stub Data - 0x%I64x\n", StubData);
  1201. break;
  1202. case rpc_fault:
  1203. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, alloc_hint, tmp1);
  1204. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, p_cont_id, tmp1);
  1205. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, alert_count, tmp1);
  1206. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, reserved, tmp1);
  1207. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, status, tmp1);
  1208. PRINT_MEMBER(qwAddr, rpcconn_fault, RPCRT4!rpcconn_fault, reserved2, tmp1);
  1209. break;
  1210. case rpc_bind:
  1211. case rpc_alter_context:
  1212. PRINT_MEMBER(qwAddr, rpcconn_bind, RPCRT4!rpcconn_bind, max_xmit_frag, tmp1);
  1213. PRINT_MEMBER(qwAddr, rpcconn_bind, RPCRT4!rpcconn_bind, max_recv_frag, tmp1);
  1214. PRINT_MEMBER(qwAddr, rpcconn_bind, RPCRT4!rpcconn_bind, assoc_group_id, tmp1);
  1215. break;
  1216. case rpc_bind_ack:
  1217. PRINT_MEMBER(qwAddr, rpcconn_bind_ack, RPCRT4!rpcconn_bind_ack, max_xmit_frag, tmp1);
  1218. PRINT_MEMBER(qwAddr, rpcconn_bind_ack, RPCRT4!rpcconn_bind_ack, max_recv_frag, tmp1);
  1219. PRINT_MEMBER(qwAddr, rpcconn_bind_ack, RPCRT4!rpcconn_bind_ack, assoc_group_id, tmp1);
  1220. PRINT_MEMBER(qwAddr, rpcconn_bind_ack, RPCRT4!rpcconn_bind_ack, sec_addr_length, tmp1);
  1221. break;
  1222. case rpc_bind_nak:
  1223. PRINT_MEMBER(qwAddr, rpcconn_bind_nak, RPCRT4!rpcconn_bind_nak, provider_reject_reason, tmp1);
  1224. PRINT_MEMBER(qwAddr, rpcconn_bind_nak, RPCRT4!rpcconn_bind_nak, versions, tmp1);
  1225. break;
  1226. case rpc_alter_context_resp:
  1227. PRINT_MEMBER(qwAddr, rpcconn_alter_context_resp, RPCRT4!rpcconn_alter_context_resp, max_xmit_frag, tmp1);
  1228. PRINT_MEMBER(qwAddr, rpcconn_alter_context_resp, RPCRT4!rpcconn_alter_context_resp, max_recv_frag, tmp1);
  1229. PRINT_MEMBER(qwAddr, rpcconn_alter_context_resp, RPCRT4!rpcconn_alter_context_resp, assoc_group_id, tmp1);
  1230. PRINT_MEMBER(qwAddr, rpcconn_alter_context_resp, RPCRT4!rpcconn_alter_context_resp, sec_addr_length, tmp1);
  1231. PRINT_MEMBER(qwAddr, rpcconn_alter_context_resp, RPCRT4!rpcconn_alter_context_resp, pad, tmp1);
  1232. break;
  1233. case rpc_auth_3:
  1234. case rpc_shutdown:
  1235. case rpc_cancel:
  1236. case rpc_orphaned:
  1237. break;
  1238. default:
  1239. dprintf ("Bad Packet\n");
  1240. break;
  1241. }
  1242. //
  1243. // Dump the security trailer
  1244. //
  1245. ULONG64 auth_length;
  1246. ULONG64 frag_length;
  1247. GET_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, auth_length, auth_length);
  1248. GET_MEMBER(qwAddr, rpcconn_common, RPCRT4!rpcconn_common, frag_length, frag_length);
  1249. if ((ULONG)auth_length)
  1250. {
  1251. ULONG64 SecurityTrailer = qwAddr;
  1252. SecurityTrailer += frag_length-auth_length-GET_TYPE_SIZE(sec_trailer, RPCRT4!sec_trailer);
  1253. dprintf("\nSecurity trailer: 0x%I64x\n", SecurityTrailer);
  1254. PRINT_MEMBER(SecurityTrailer, sec_trailer, RPCRT4!sec_trailer, auth_type, tmp1);
  1255. PRINT_MEMBER(SecurityTrailer, sec_trailer, RPCRT4!sec_trailer, auth_level, tmp1);
  1256. PRINT_MEMBER(SecurityTrailer, sec_trailer, RPCRT4!sec_trailer, auth_pad_length, tmp1);
  1257. PRINT_MEMBER(SecurityTrailer, sec_trailer, RPCRT4!sec_trailer, auth_reserved, tmp1);
  1258. PRINT_MEMBER(SecurityTrailer, sec_trailer, RPCRT4!sec_trailer, auth_context_id, tmp1);
  1259. dprintf ("trailer - 0x%I64x\n", SecurityTrailer+1);
  1260. }
  1261. }
  1262. char *lpc_ptype[] =
  1263. {
  1264. "LRPC_MSG_BIND",
  1265. "LRPC_MSG_REQUEST",
  1266. "LRPC_MSG_RESPONSE",
  1267. "LRPC_MSG_CALLBACK",
  1268. "LRPC_MSG_FAULT",
  1269. "LRPC_MSG_CLOSE",
  1270. "LRPC_MSG_ACK",
  1271. "LRPC_BIND_ACK",
  1272. "LRPC_MSG_COPY",
  1273. "LRPC_MSG_PUSH",
  1274. "LRPC_MSG_CANCEL",
  1275. "LRPC_MSG_BIND_BACK",
  1276. "LRPC_ASYNC_REQUEST",
  1277. "LRPC_PARTIAL_REQUEST",
  1278. "LRPC_CLIENT_SEND_MORE",
  1279. "LRPC_SERVER_SEND_MORE",
  1280. "LRPC_MSG_FAULT2"
  1281. };
  1282. VOID
  1283. do_lpcpacket(
  1284. ULONG64 qwAddr
  1285. )
  1286. {
  1287. if (fUseTypeInfo) {
  1288. ULONG64 LpcHeader;
  1289. ULONG64 RpcHeader;
  1290. ULONG64 Buffer;
  1291. ULONG64 tmp1;
  1292. ULONG tmp2;
  1293. GET_ADDRESS_OF(qwAddr, LRPC_RPC_MESSAGE, RPCRT4!LRPC_RPC_MESSAGE, LpcHeader, LpcHeader, tmp2);
  1294. GET_ADDRESS_OF(qwAddr, LRPC_RPC_MESSAGE, RPCRT4!LRPC_RPC_MESSAGE, RpcHeader, RpcHeader, tmp2);
  1295. dprintf("\n");
  1296. //
  1297. // dump the LPC header
  1298. //
  1299. PRINT_ADDRESS_OF_WITH_LABEL(LpcHeader, _PORT_MESSAGE, RPCRT4!_PORT_MESSAGE, u1, "&u1\t\t\t", tmp2);
  1300. PRINT_ADDRESS_OF_WITH_LABEL(LpcHeader, _PORT_MESSAGE, RPCRT4!_PORT_MESSAGE, u2, "&u2\t\t\t", tmp2);
  1301. PRINT_ADDRESS_OF_WITH_LABEL(LpcHeader, _PORT_MESSAGE, RPCRT4!_PORT_MESSAGE, ClientId, "&CLIENT_ID\t\t", tmp2);
  1302. PRINT_MEMBER_WITH_LABEL(LpcHeader, _PORT_MESSAGE, RPCRT4!_PORT_MESSAGE, MessageId, "MessageId\t\t", tmp1);
  1303. PRINT_MEMBER_WITH_LABEL(LpcHeader, _PORT_MESSAGE, RPCRT4!_PORT_MESSAGE, CallbackId, "CallbackId\t\t", tmp1);
  1304. //
  1305. // dump the LRPC header
  1306. //
  1307. ULONG64 MessageType;
  1308. GET_MEMBER(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, MessageType, MessageType);
  1309. dprintf("MessageType\t\t - %s\n", lpc_ptype[(long)MessageType]);
  1310. PRINT_MEMBER_WITH_LABEL(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, PresentContext, "PresentationContext\t", tmp1);
  1311. PRINT_MEMBER_WITH_LABEL(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, Flags, "Flags\t\t\t", tmp1);
  1312. PRINT_MEMBER_WITH_LABEL(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, ProcedureNumber, "ProcedureNumber\t\t", tmp1);
  1313. PRINT_MEMBER_WITH_LABEL(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, CallId, "CallId\t\t\t", tmp1);
  1314. ULONG64 ObjectUuid;
  1315. GET_ADDRESS_OF(RpcHeader, _LRPC_RPC_HEADER, RPCRT4!_LRPC_RPC_HEADER, ObjectUuid, ObjectUuid, tmp2);
  1316. dprintf("ObjectUuid\t\t - ");
  1317. PrintUuid(ObjectUuid);
  1318. dprintf("\n\n");
  1319. }
  1320. else {
  1321. BOOL b;
  1322. char block[sizeof(LRPC_RPC_MESSAGE)];
  1323. LRPC_RPC_MESSAGE *m = (LRPC_RPC_MESSAGE *)block;
  1324. b = GetData(qwAddr, block, sizeof(LRPC_RPC_MESSAGE));
  1325. if ( !b ) {
  1326. dprintf("couldn't read address %p\n", qwAddr);
  1327. return;
  1328. }
  1329. dprintf("\n");
  1330. //
  1331. // dump the LPC header
  1332. //
  1333. dprintf("DataLength\t\t- 0x%x\n", (long) m->LpcHeader.u1.s1.DataLength);
  1334. dprintf("TotalLength\t\t- 0x%x\n", (long) m->LpcHeader.u1.s1.TotalLength);
  1335. dprintf("Type\t\t\t- 0x%x\n", (long) m->LpcHeader.u2.s2.Type);
  1336. dprintf("DataInfoOffset\t\t- 0x%x\n", (long) m->LpcHeader.u2.s2.DataInfoOffset);
  1337. dprintf("CLIENT_ID: \t\t- Process(0x%x), Thread(0x%x)\n",
  1338. m->LpcHeader.ClientId.UniqueProcess, m->LpcHeader.ClientId.UniqueThread);
  1339. dprintf("MessageId\t\t- 0x%x\n", m->LpcHeader.MessageId);
  1340. dprintf("CallbackId\t\t- 0x%x\n", m->LpcHeader.CallbackId);
  1341. //
  1342. // dump the LRPC header
  1343. //
  1344. dprintf("MessageType\t\t- %s\n", lpc_ptype[(long) m->RpcHeader.MessageType]);
  1345. dprintf("PresentationContext\t- 0x%x\n", (long) m->RpcHeader.PresentContext);
  1346. dprintf("Flags\t\t\t- 0x%x\n", (unsigned long) m->RpcHeader.Flags);
  1347. dprintf("ProcedureNumber\t\t- 0x%x\n", (long) m->RpcHeader.ProcedureNumber);
  1348. dprintf("CallId\t\t\t- 0x%x\n", (long) m->RpcHeader.CallId);
  1349. dprintf("ObjectUuid\t\t- ");
  1350. PrintUuidLocal((UUID *) &(m->RpcHeader.ObjectUuid));
  1351. dprintf("\nStubData\t\t- 0x%x\n", m+1);
  1352. dprintf("\n");
  1353. }
  1354. }
  1355. VOID
  1356. do_bh(
  1357. ULONG64 qwAddr
  1358. )
  1359. {
  1360. RPC_CHAR *EntryName;
  1361. ULONG64 tmp1;
  1362. ULONG tmp2;
  1363. ULONG64 EntryNameAddr;
  1364. ULONG64 ObjectUuidAddr;
  1365. GET_ADDRESS_OF(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, EntryName, EntryNameAddr, tmp2);
  1366. GET_ADDRESS_OF(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, ObjectUuid, ObjectUuidAddr, tmp2);
  1367. dprintf("\n");
  1368. PRINT_MEMBER(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, Timeout, tmp1);
  1369. dprintf("ObjectUuid\t\t- ");
  1370. PrintUuid(ObjectUuidAddr); dprintf("\n");
  1371. PRINT_MEMBER(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, NullObjectUuidFlag, tmp1);
  1372. PRINT_MEMBER(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, EntryNameSyntax, tmp1);
  1373. EntryName = ReadProcessRpcChar(EntryNameAddr);
  1374. if (EntryName) {
  1375. dprintf("EntryName\t\t- %ws (Address: 0x%x)\n", EntryName ? EntryName : L"(null)", EntryNameAddr);
  1376. delete EntryName;
  1377. }
  1378. PRINT_MEMBER(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, EpLookupHandle, tmp1);
  1379. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, BindingMutex, "&BindingMutex(MUTEX)", tmp2);
  1380. PRINT_MEMBER(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, pvTransportOptions, tmp1);
  1381. PRINT_ADDRESS_OF(qwAddr, BINDING_HANDLE, RPCRT4!BINDING_HANDLE, ClientAuthInfo, tmp2);
  1382. do_authinfo(qwAddr+tmp2);
  1383. }
  1384. VOID
  1385. do_osfbh(
  1386. ULONG64 qwAddr
  1387. )
  1388. {
  1389. BOOL b;
  1390. ULONG64 tmp1;
  1391. ULONG tmp2;
  1392. do_bh(qwAddr);
  1393. PRINT_MEMBER(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, Association, tmp1);
  1394. PRINT_MEMBER(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, DceBinding, tmp1);
  1395. do_dcebinding(tmp1);
  1396. PRINT_MEMBER(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, TransInfo, tmp1);
  1397. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, RecursiveCalls, "&RecursiveCalls(OSF_ACTIVE_ENTRY_DICT)", tmp2);
  1398. PRINT_MEMBER(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, ReferenceCount, tmp1);
  1399. PRINT_MEMBER(qwAddr, OSF_BINDING_HANDLE, RPCRT4!OSF_BINDING_HANDLE, pToken, tmp1);
  1400. dprintf("\n");
  1401. }
  1402. VOID
  1403. do_osfca(
  1404. ULONG64 qwAddr
  1405. )
  1406. {
  1407. BOOL b;
  1408. ULONG64 tmp1;
  1409. ULONG tmp2;
  1410. dprintf("\n");
  1411. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, DceBinding, "DceBinding(DCE_BINDING)", tmp1);
  1412. do_dcebinding(tmp1);
  1413. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, BindHandleCount, tmp1);
  1414. PRINT_ADDRESS_OF(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, Bindings, tmp2);
  1415. PRINT_ADDRESS_OF(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, ActiveConnections, tmp2);
  1416. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, AssocGroupId, tmp1);
  1417. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, TransInfo, tmp1);
  1418. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, SecondaryEndpoint, tmp1);
  1419. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, Key, tmp1);
  1420. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, OpenConnectionCount, tmp1);
  1421. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, CallIdCounter, tmp1);
  1422. PRINT_ADDRESS_OF(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, AssociationMutex, tmp2);
  1423. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, AssociationValid, tmp1);
  1424. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, FailureCount, tmp1);
  1425. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, fMultiplex, tmp1);
  1426. PRINT_MEMBER(qwAddr, OSF_CASSOCIATION, RPCRT4!OSF_CASSOCIATION, SavedDrep, tmp1);
  1427. dprintf("\n");
  1428. }
  1429. VOID
  1430. do_dcebinding(
  1431. ULONG64 qwAddr
  1432. )
  1433. {
  1434. RPC_STATUS RpcStatus;
  1435. BOOL b;
  1436. ULONG tmp2;
  1437. ULONG64 RpcProtocolSequenceAddr;
  1438. ULONG64 NetworkAddressAddr;
  1439. ULONG64 EndpointAddr;
  1440. ULONG64 OptionsAddr;
  1441. ULONG64 ObjectUuidAddr;
  1442. RPC_CHAR *RpcProtocolSequence;
  1443. RPC_CHAR *NetworkAddress;
  1444. RPC_CHAR *Endpoint;
  1445. RPC_CHAR *Options;
  1446. GET_MEMBER(qwAddr, DCE_BINDING, RPCRT4!DCE_BINDING, RpcProtocolSequence, RpcProtocolSequenceAddr);
  1447. GET_MEMBER(qwAddr, DCE_BINDING, RPCRT4!DCE_BINDING, NetworkAddress, NetworkAddressAddr);
  1448. GET_MEMBER(qwAddr, DCE_BINDING, RPCRT4!DCE_BINDING, Endpoint, EndpointAddr);
  1449. GET_MEMBER(qwAddr, DCE_BINDING, RPCRT4!DCE_BINDING, Options, OptionsAddr);
  1450. GET_ADDRESS_OF(qwAddr, DCE_BINDING, RPCRT4!DCE_BINDING, ObjectUuid, ObjectUuidAddr, tmp2);
  1451. dprintf("\tObjectUuid:\t");
  1452. PrintUuid(ObjectUuidAddr); dprintf("\n");
  1453. RpcProtocolSequence = ReadProcessRpcChar( RpcProtocolSequenceAddr);
  1454. if (RpcProtocolSequence) {
  1455. dprintf("\tprotseq: \t\"%ws\"\t(Address: %p)\n", RpcProtocolSequence, RpcProtocolSequenceAddr);
  1456. delete RpcProtocolSequence;
  1457. }
  1458. NetworkAddress = ReadProcessRpcChar( NetworkAddressAddr);
  1459. if (NetworkAddress) {
  1460. dprintf("\tNetworkAddress:\t\"%ws\"\t(Address: %p)\n", NetworkAddress, NetworkAddressAddr);
  1461. delete NetworkAddress;
  1462. }
  1463. Endpoint = ReadProcessRpcChar( EndpointAddr);
  1464. if (Endpoint) {
  1465. dprintf("\tEndpoint:\t\"%ws\" \t(Address: %p)\n", Endpoint, EndpointAddr);
  1466. delete Endpoint;
  1467. }
  1468. Options = ReadProcessRpcChar( OptionsAddr);
  1469. if (Options) {
  1470. dprintf("\tOptions:\t\"%ws\" \t(Address: %p)\n", Options, OptionsAddr);
  1471. delete Options;
  1472. }
  1473. dprintf("\n");
  1474. }
  1475. VOID
  1476. do_osfcconn(
  1477. ULONG64 qwAddr
  1478. )
  1479. {
  1480. ULONG64 tmp1;
  1481. ULONG tmp2;
  1482. dprintf("\n");
  1483. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, Association, "pAssociation(OSF_CASSOCIATION)\t\t", tmp1);
  1484. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, CurrentCall, "CurrentCall (OSF_CCALL)\t\t\t", tmp1);
  1485. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ConnectionKey, "ConnectionKey\t\t\t\t", tmp1);
  1486. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, State, "State\t\t\t\t\t", tmp1);
  1487. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, MaxFrag, "MaxFrag\t\t\t\t\t", tmp1);
  1488. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ThreadId, "ThreadId\t\t\t\t", tmp1);
  1489. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, CachedCCall, "CachedCCall\t\t\t\t", tmp1);
  1490. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, CachedCCallAvailable, "CachedCCallAvailable\t\t\t", tmp1);
  1491. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, MaxSavedHeaderSize, "MaxSavedHeaderSize\t\t\t", tmp1);
  1492. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, SavedHeaderSize, "SavedHeaderSize\t\t\t\t", tmp1);
  1493. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, SavedHeader, "SavedHeader\t\t\t\t", tmp1);
  1494. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, AdditionalLegNeeded, "AdditionalLegNeeded\t\t\t", tmp1);
  1495. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, LastTimeUsed, "LastTimeUsed\t\t\t\t", tmp1);
  1496. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, TokenLength, "TokenLength\t\t\t\t", tmp1);
  1497. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, AdditionalSpaceForSecurity, "AdditionalSpaceForSecurity\t\t", tmp1);
  1498. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, fIdle, "fIdle\t\t\t\t\t", tmp1);
  1499. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, fExclusive, "fExclusive\t\t\t\t", tmp1);
  1500. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, fConnectionAborted, "fConnectionAborted\t\t\t", tmp1);
  1501. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, RefCount, "RefCount\t\t\t\t", tmp1);
  1502. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, Bindings, "&Bindings(BITSET)\t\t\t", tmp2);
  1503. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, CallQueue, "&CallQueue\t\t\t\t", tmp2);
  1504. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ConnMutex, "&ConnMutex\t\t\t\t", tmp2);
  1505. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ActiveCalls, "&ActiveCalls\t\t\t\t", tmp2);
  1506. ULONG64 ClientSecurityContext;
  1507. GET_ADDRESS_OF(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ClientSecurityContext, ClientSecurityContext, tmp2);
  1508. dprintf("&ClientSecurityContext(CSECURITY_CONTEXT)- 0x%I64x\n", ClientSecurityContext);
  1509. do_securitycontext(ClientSecurityContext);
  1510. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ClientInfo, "ClientInfo (RPC_CONNECTION_TRANSPORT)\t", tmp1);
  1511. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ComTimeout, "ComTimeout\t\t\t\t", tmp1);
  1512. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, u, "ConnSendContext\t\t\t\t", tmp1);
  1513. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, DceSecurityInfo, "&DceSecurityInfo(DCE_SECURITY_INFO)\t", tmp2);
  1514. ULONG64 DceSecurityInfo;
  1515. GET_ADDRESS_OF(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, DceSecurityInfo, DceSecurityInfo, tmp2);
  1516. PRINT_MEMBER_WITH_LABEL(DceSecurityInfo, _DCE_SECURITY_INFO, RPCRT4!_DCE_SECURITY_INFO, SendSequenceNumber, " SendSequenceNumber\t\t", tmp1);
  1517. PRINT_MEMBER_WITH_LABEL(DceSecurityInfo, _DCE_SECURITY_INFO, RPCRT4!_DCE_SECURITY_INFO, ReceiveSequenceNumber, " ReceiveSequenceNumber\t", tmp1);
  1518. ULONG64 AssociationUuid;
  1519. GET_ADDRESS_OF(DceSecurityInfo, _DCE_SECURITY_INFO, RPCRT4!_DCE_SECURITY_INFO, AssociationUuid, AssociationUuid, tmp2);
  1520. dprintf(" AssociationUuid\t\t - ");
  1521. PrintUuid(AssociationUuid);
  1522. dprintf("\n");
  1523. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, BufferToFree, "BufferToFree\t\t\t", tmp1);
  1524. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION, ConnectionReady, "ConnectionReady\t\t\t", tmp1);
  1525. dprintf("\n");
  1526. ULONG64 TransConnection = qwAddr;
  1527. TransConnection += GET_TYPE_SIZE(OSF_CCONNECTION, RPCRT4!OSF_CCONNECTION);
  1528. dprintf("TransConnection\t\t\t - 0x%I64x\n", TransConnection);
  1529. do_trans(TransConnection);
  1530. }
  1531. struct CallStateMap {
  1532. OSF_CCALL_STATE State;
  1533. char *StateString;
  1534. };
  1535. struct CallStateMap CCall_States[] =
  1536. {
  1537. NeedOpenAndBind, "NeedOpenAndBind",
  1538. NeedAlterContext, "NeedAlterContext",
  1539. WaitingForAlterContext, "WaitingForAlterContext",
  1540. SendingFirstBuffer, "SendingFirstBuffer",
  1541. SendingMoreData, "SendingMoreData",
  1542. WaitingForReply, "WaitingForReply",
  1543. InCallbackRequest, "InCallbackRequest",
  1544. InCallbackReply, "InCallbackReply",
  1545. Receiving, "Receiving",
  1546. Aborted, "Aborted",
  1547. Complete, "Complete",
  1548. };
  1549. char *
  1550. GetCallState (
  1551. OSF_CCALL_STATE State
  1552. )
  1553. {
  1554. int i;
  1555. for (i = 0; i < sizeof(CCall_States)/sizeof(CallStateMap); i++)
  1556. {
  1557. if (State == CCall_States[i].State)
  1558. {
  1559. return CCall_States[i].StateString;
  1560. }
  1561. }
  1562. return "Unknown State";
  1563. }
  1564. VOID
  1565. do_osfccall(
  1566. ULONG64 qwAddr
  1567. )
  1568. {
  1569. ULONG64 tmp1;
  1570. ULONG tmp2;
  1571. dprintf("\n");
  1572. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, AsyncStatus, "AsyncStatus\t\t", tmp1);
  1573. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CachedAPCInfo, "pCachedAPCInfo\t\t", tmp2);
  1574. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CachedAPCInfoAvailable, "CachedAPCInfoAvailable\t", tmp1);
  1575. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, pAsync, "pAsync\t\t\t", tmp1);
  1576. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CallingThread, "CallingThread\t\t", tmp1);
  1577. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, NotificationIssued, "NotificationIssued\t", tmp1);
  1578. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, Connection, "Connection\t\t", tmp1);
  1579. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, BindingHandle, "BindingHandle\t\t", tmp1);
  1580. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, Bindings, "Binding\t\t\t", tmp1);
  1581. ULONG64 CurrentState;
  1582. GET_MEMBER(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CurrentState, CurrentState);
  1583. dprintf("CurrentState\t\t - 0x%x, %s\n",
  1584. (ULONG)CurrentState, GetCallState((OSF_CCALL_STATE)CurrentState));
  1585. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CurrentBuffer, "CurrentBuffer\t\t", tmp1);
  1586. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CurrentOffset, "CurrentOffset\t\t", tmp1);
  1587. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CurrentBufferLength, "CurrentBufferLength\t", tmp1);
  1588. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CallId, "CallId\t\t\t", tmp1);
  1589. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, RcvBufferLength, "RcvBufferLength\t\t", tmp1);
  1590. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, FirstSend, "FirstSend\t\t", tmp1);
  1591. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, DispatchTableCallback, "DispatchTableCallback\t", tmp1);
  1592. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, MaximumFragmentLength, "MaximumFragmentLength\t", tmp1);
  1593. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, MaxSecuritySize, "MaxSecuritySize\t\t", tmp1);
  1594. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, MaxDataLength, "MaxDataLength\t\t", tmp1);
  1595. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, ReservedForSecurity, "ReservedForSecurity\t", tmp1);
  1596. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, SecBufferLength, "SecBufferLength\t\t", tmp1);
  1597. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, HeaderSize, "HeaderSize\t\t", tmp1);
  1598. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, SavedHeaderSize, "SavedHeaderSize\t\t", tmp1);
  1599. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, SavedHeader, "SavedHeader\t\t", tmp1);
  1600. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, LastBuffer, "LastBuffer\t\t", tmp1);
  1601. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, ProcNum, "ProcNum\t\t\t", tmp1);
  1602. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, SyncEvent, "SyncEvent\t\t", tmp1);
  1603. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, ActualBufferLength, "ActualBufferLength\t", tmp1);
  1604. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, NeededLength, "NeededLength\t\t", tmp1);
  1605. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CallSendContext, "CallSendContext\t\t", tmp1);
  1606. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, RefCount, "RefCount\t\t", tmp1);
  1607. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, RecursiveCallsKey, "RecursiveCallsKeyF\t", tmp1);
  1608. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CallStack, "CallStack\t\t", tmp1);
  1609. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, fCallCancelled, "fCallCancelled\t\t", tmp1);
  1610. ULONG64 CancelState;
  1611. GET_MEMBER(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CancelState, CancelState);
  1612. switch ((ULONG)CancelState)
  1613. {
  1614. case CANCEL_NOTREGISTERED:
  1615. dprintf("fEnableCancels\t\t - CANCEL_NOTREGISTERED\n");
  1616. break;
  1617. case CANCEL_INFINITE:
  1618. dprintf("fEnableCancels\t\t - CANCEL_INFINITE\n");
  1619. break;
  1620. case CANCEL_NOTINFINITE:
  1621. dprintf("fEnableCancels\t\t - CANCEL_NOTINFINITE\n");
  1622. break;
  1623. }
  1624. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, CallMutex, "&CallMutex\t\t", tmp2);
  1625. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, BufferQueue, "&BufferQueue\t\t", tmp2);
  1626. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, InReply, "InReply\t\t\t", tmp1);
  1627. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, fChoked, "fChoked\t\t\t", tmp1);
  1628. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_CCALL, RPCRT4!OSF_CCALL, fPeerChoked, "fPeerChoked\t\t", tmp1);
  1629. dprintf("\n");
  1630. }
  1631. VOID
  1632. do_rpcaddr(
  1633. ULONG64 qwAddr
  1634. )
  1635. {
  1636. RPC_CHAR *Endpoint;
  1637. RPC_CHAR *RpcProtocolSequence;
  1638. ULONG64 EndpointAddr;
  1639. ULONG64 RpcProtocolSequenceAddr;
  1640. ULONG64 tmp1;
  1641. ULONG tmp2;
  1642. dprintf("\n");
  1643. GET_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, Endpoint, EndpointAddr);
  1644. GET_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, RpcProtocolSequence, RpcProtocolSequenceAddr);
  1645. Endpoint = ReadProcessRpcChar(EndpointAddr);
  1646. if (Endpoint != NULL) {
  1647. dprintf("Endpoint - \"%ws\"\n", Endpoint);
  1648. delete Endpoint;
  1649. }
  1650. RpcProtocolSequence = ReadProcessRpcChar(RpcProtocolSequenceAddr);
  1651. if (RpcProtocolSequence != NULL) {
  1652. dprintf("RpcProtocolSequence - \"%ws\"\n", RpcProtocolSequence);
  1653. delete RpcProtocolSequence;
  1654. }
  1655. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, StaticEndpointFlag, tmp1);
  1656. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, ActiveCallCount, tmp1);
  1657. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, EndpointFlags, tmp1);
  1658. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, NICFlags, tmp1);
  1659. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, Server, tmp1);
  1660. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, AddressMutex, "AddressMutex at", tmp2);
  1661. PRINT_MEMBER(qwAddr, RPC_ADDRESS, RPCRT4!RPC_ADDRESS, DictKey, tmp1);
  1662. delete Endpoint;
  1663. delete RpcProtocolSequence;
  1664. }
  1665. VOID
  1666. do_osfaddr(
  1667. ULONG64 qwAddr
  1668. )
  1669. {
  1670. ULONG64 tmp1;
  1671. ULONG tmp2;
  1672. ULONG64 TransAddr = qwAddr;
  1673. do_rpcaddr(qwAddr);
  1674. dprintf("\n");
  1675. PRINT_ADDRESS_OF(qwAddr, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, Associations, tmp2);
  1676. PRINT_MEMBER(qwAddr, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, SetupAddressOccurred, tmp1);
  1677. PRINT_MEMBER(qwAddr, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, TransInfo, tmp1);
  1678. PRINT_MEMBER(qwAddr, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, ServerInfo, tmp1);
  1679. PRINT_MEMBER(qwAddr, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, ServerListeningFlag, tmp1);
  1680. TransAddr += GET_TYPE_SIZE(OSF_ADDRESS, RPCRT4!OSF_ADDRESS);
  1681. dprintf("\n");
  1682. dprintf("TransAddr 0x%I64x\n", TransAddr);
  1683. do_trans(TransAddr);
  1684. }
  1685. VOID
  1686. do_osfsconn(
  1687. ULONG64 qwAddr
  1688. )
  1689. {
  1690. ULONG64 tmp1;
  1691. ULONG tmp2;
  1692. dprintf("\n");
  1693. ULONG64 AuthInfo;
  1694. GET_ADDRESS_OF(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, AuthInfo, AuthInfo, tmp2);
  1695. dprintf("&AuthInfo(CLIENT_AUTH_INFO)\t - 0x%p\n", AuthInfo);
  1696. do_authinfo(AuthInfo );
  1697. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, Association, "Association(OSF_ASSOCIATION)\t", tmp1);
  1698. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, Address, "Address(OSF_ADDRESS)\t\t", tmp1);
  1699. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, MaxFrag, "MaxFrag\t\t\t\t", tmp1);
  1700. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, DataRep, "DataRep\t\t\t\t", tmp1);
  1701. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, AuthContextId, "AuthContextId\t\t\t", tmp1);
  1702. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, SecurityContextAltered, "SecurityContextAltered\t\t", tmp1);
  1703. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, RpcSecurityBeingUsed, "RpcSecurityBeingUsed\t\t", tmp1);
  1704. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, CurrentSecurityContext, "pCurrentSecurityContext(SSECURITY_CONTEXT)", tmp1);
  1705. do_authinfo(tmp1);
  1706. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, SecurityContextDict, "&SecurityContextDict(SSECURITY_CONTEXT_DICT)", tmp2);
  1707. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, AdditionalSpaceForSecurity, "AdditionalSpaceForSecurity\t", tmp1);
  1708. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, SavedHeaderSize, "SavedHeaderSize\t\t\t", tmp1);
  1709. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, SavedHeader, "pSavedHeader(VOID)\t\t", tmp1);
  1710. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, CurrentCallId, "CurrentCallId\t\t\t", tmp1);
  1711. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, CachedSCallAvailable, "CachedSCallAvailable\t\t", tmp1);
  1712. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, AuthContinueNeeded, "AuthContinueNeeded\t\t", tmp1);
  1713. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, InitSecurityInfo, "&InitSecurityInfo\t\t", tmp2);
  1714. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, CallDict, "&CallDict\t\t\t", tmp2);
  1715. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, Bindings, "&Bindings(OSF_SBINDING_DICT)\t", tmp2);
  1716. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, ConnMutex, "&ConnMutex\t\t\t", tmp2);
  1717. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, CachedSCall, "CachedSCall\t\t\t", tmp1);
  1718. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, ServerInfo, "ServerInfo\t\t\t", tmp1);
  1719. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, ConnectionClosedFlag, "ConnectionClosedFlag\t\t", tmp1);
  1720. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, DceSecurityInfo, "&DceSecurityInfo\t\t", tmp2);
  1721. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, fExclusive, "fExclusive\t\t\t", tmp1);
  1722. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, fDontFlush, "fDontFlush\t\t\t", tmp1);
  1723. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION, fFirstCall, "fFirstCall\t\t\t", tmp1);
  1724. dprintf("\n");
  1725. ULONG64 TransConnection = qwAddr;
  1726. TransConnection += GET_TYPE_SIZE(OSF_SCONNECTION, RPCRT4!OSF_SCONNECTION);
  1727. dprintf("TransConnection\t\t\t - 0x%I64x\n", TransConnection);
  1728. do_trans(TransConnection);
  1729. }
  1730. char *SCall_States[] =
  1731. {
  1732. "NewRequest",
  1733. "CallCancelled",
  1734. "CallAborted",
  1735. "CallCompleted",
  1736. "ReceivedCallback",
  1737. "ReceivedCallbackReply",
  1738. "ReceivedFault"
  1739. };
  1740. VOID
  1741. do_osfscall(
  1742. ULONG64 qwAddr
  1743. )
  1744. {
  1745. ULONG64 tmp1;
  1746. ULONG tmp2;
  1747. dprintf("\n");
  1748. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, AsyncStatus, "AsyncStatus\t\t", tmp1);
  1749. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CachedAPCInfo, "pCachedAPCInfo\t\t", tmp2);
  1750. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CachedAPCInfoAvailable, "CachedAPCInfoAvailable\t", tmp1);
  1751. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, pAsync, "pAsync\t\t\t", tmp1);
  1752. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CallingThread, "CallingThread\t\t", tmp1);
  1753. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, NotificationIssued, "NotificationIssued\t", tmp1);
  1754. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CurrentBinding, "CurrentBinding\t\t", tmp1);
  1755. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, Connection, "Connection\t\t", tmp1);
  1756. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, Address, "Address\t\t\t", tmp1);
  1757. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CallId, "CallId\t\t\t", tmp1);
  1758. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CallStack, "CallStack\t\t", tmp1);
  1759. ULONG64 ObjectUuid;
  1760. GET_ADDRESS_OF(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, ObjectUuid, ObjectUuid, tmp2);
  1761. dprintf("ObjectUuid\t\t - ");
  1762. PrintUuid(ObjectUuid); dprintf("\n");
  1763. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, ObjectUuidSpecified, "ObjectUuidSpecified\t", tmp1);
  1764. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CurrentBuffer, "CurrentBuffer\t\t", tmp1);
  1765. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CurrentBufferLength, "CurrentBufferLength\t", tmp1);
  1766. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CurrentOffset, "CurrentOffset\t\t", tmp1);
  1767. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, FirstFrag, "FirstFrag\t\t", tmp1);
  1768. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, FirstSend, "FirstSend\t\t", tmp1);
  1769. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fPipeCall, "fPipeCall\t\t", tmp1);
  1770. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fCallDispatched, "fCallDispatched\t\t", tmp1);
  1771. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, DispatchBuffer, "DispatchBuffer\t\t", tmp1);
  1772. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, LastBuffer, "LastBuffer\t\t", tmp1);
  1773. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, SendContext, "SendContext\t\t", tmp1);
  1774. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, DispatchBufferOffset, "DispatchBufferOffset\t", tmp1);
  1775. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, ProcNum, "ProcNum\t\t\t", tmp1);
  1776. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, AllocHint, "AllocHint\t\t", tmp1);
  1777. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, SavedHeaderSize, "SavedHeaderSize\t\t", tmp1);
  1778. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, SavedHeader, "SavedHeader\t\t", tmp1);
  1779. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, RcvBufferLength, "RcvBufferLength\t\t", tmp1);
  1780. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, NeededLength, "NeededLength\t\t", tmp1);
  1781. ULONG64 CurrentState;
  1782. GET_MEMBER(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CurrentState, CurrentState);
  1783. dprintf("CurrentState\t\t - 0x%x, %s\n", (ULONG)CurrentState, SCall_States[(ULONG)CurrentState]);
  1784. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CallMutex, "&CallMutex\t\t", tmp2);
  1785. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, SyncEvent, "&SyncEvent\t\t", tmp2);
  1786. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, BufferQueue, "&BufferQueue\t\t", tmp2);
  1787. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, Thread, "Thread\t\t\t", tmp1);
  1788. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CallOrphaned, "CallOrphaned\t\t", tmp1);
  1789. ULONG64 RefCount;
  1790. GET_MEMBER(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, RefCount, RefCount);
  1791. dprintf("RefCount\t\t - 0x%x\n", (ULONG)RefCount);
  1792. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, MaxSecuritySize, "MaxSecuritySize\t\t", tmp1);
  1793. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, FirstCallRpcMessage, "&FirstCallRpcMessage\t", tmp2);
  1794. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, FirstCallRuntimeInfo, "&FirstCallRuntimeInfo\t", tmp2);
  1795. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, MaximumFragmentLength, "MaximumFragmentLength\t", tmp1);
  1796. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, ActualBufferLength, "ActualBufferLength\t", tmp1);
  1797. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fChoked, "fChoked\t\t\t", tmp1);
  1798. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fPeerChoked, "fPeerChoked\t\t", tmp1);
  1799. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, DispatchFlags, "DispatchFlags\t\t", tmp1);
  1800. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fSecurityFailure, "fSecurityFailure\t", tmp1);
  1801. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, CancelPending, "CancelPending\t\t", tmp1);
  1802. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_SCALL, RPCRT4!OSF_SCALL, fChoked, "fChoked\t\t\t", tmp1);
  1803. dprintf("\n");
  1804. }
  1805. VOID
  1806. do_osfsa(
  1807. ULONG64 qwAddr
  1808. )
  1809. {
  1810. ULONG64 tmp1;
  1811. ULONG tmp2;
  1812. dprintf("\n");
  1813. PRINT_MEMBER(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, CtxCollection, tmp1);
  1814. PRINT_MEMBER(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, AssociationID, tmp1);
  1815. PRINT_MEMBER(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, ConnectionCount, tmp1);
  1816. PRINT_MEMBER(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, AssociationGroupId, tmp1);
  1817. PRINT_MEMBER(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, AssociationDictKey, tmp1);
  1818. PRINT_MEMBER_WITH_LABEL(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, Address, "pAddress(OSF_ADDRESS)", tmp1);
  1819. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, OSF_ASSOCIATION, RPCRT4!OSF_ASSOCIATION, ClientProcess, "&ClientProcess(RPC_CLIENT_PROCESS_IDENTIFIER)", tmp2);
  1820. dprintf("\n");
  1821. }
  1822. DECLARE_API( rpcsvr )
  1823. {
  1824. ULONG64 qwAddr;
  1825. BOOL fArgSpecified = FALSE;
  1826. ULONG64 ServerAddress;
  1827. LPSTR lpArgumentString = (LPSTR)args;
  1828. if (0 == strtok(lpArgumentString))
  1829. {
  1830. lpArgumentString = "rpcrt4!GlobalRpcServer";
  1831. fArgSpecified = TRUE;
  1832. }
  1833. qwAddr = GetExpression(lpArgumentString);
  1834. if ( !qwAddr )
  1835. {
  1836. dprintf("Error: can't evaluate '%s'\n", lpArgumentString);
  1837. return;
  1838. }
  1839. if (fArgSpecified)
  1840. {
  1841. if (ReadPtrUnextend(qwAddr, &ServerAddress))
  1842. {
  1843. dprintf("couldn't read memory at address 0x%I64x\n", qwAddr);
  1844. return;
  1845. }
  1846. }
  1847. else
  1848. ServerAddress = qwAddr;
  1849. do_rpcsvr(ServerAddress);
  1850. }
  1851. VOID
  1852. do_rpcsvr(
  1853. ULONG64 qwAddr
  1854. )
  1855. {
  1856. ULONG64 tmp0;
  1857. ULONG64 tmp1;
  1858. ULONG tmp2;
  1859. dprintf("\n");
  1860. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, pRpcForwardFunction, "pRpcForwardFunction(RPC_FORWARD_FUNCTION)", tmp1);
  1861. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, RpcInterfaceDictionary, "&RpcInterfaceDictionary(RPC_SIMPLE_DICT)", tmp2);
  1862. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ServerMutex, "&ServerMutex(MUTEX)", tmp2);
  1863. GET_ADDRESS_OF(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, AvailableCallCount, tmp1, tmp2);
  1864. PRINT_MEMBER_WITH_LABEL(tmp1, INTERLOCKED_INTEGER, RPCRT4!INTERLOCKED_INTEGER, Integer, "AvailableCallCount", tmp0);
  1865. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ServerListeningFlag, tmp1);
  1866. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, RpcAddressDictionary, "&RpcAddressDictionary(RPC_SIMPLE_DICT)", tmp2);
  1867. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ListeningThreadFlag, tmp1);
  1868. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, StopListeningEvent, "&StopListeningEvent(EVENT)", tmp2);
  1869. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, MaximumConcurrentCalls, tmp1);
  1870. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, MinimumCallThreads, tmp1);
  1871. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, IncomingRpcCount, tmp1);
  1872. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, OutgoingRpcCount, tmp1);
  1873. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ReceivedPacketCount, tmp1);
  1874. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, SentPacketCount, tmp1);
  1875. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, AuthenticationDictionary, "&AuthenticationDictionary(RPC_SIMPLE_DICT)", tmp2);
  1876. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, WaitingThreadFlag, tmp1);
  1877. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ThreadCache, tmp1);
  1878. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, ThreadCacheMutex, "&ThreadCacheMutex(MUTEX)", tmp2);
  1879. PRINT_MEMBER(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, fAccountForMaxCalls, tmp1);
  1880. dprintf("\n");
  1881. }
  1882. struct SizeTable {
  1883. int Size;
  1884. int Count;
  1885. };
  1886. struct SizeTable *Stats = NULL;
  1887. int MaxSize = 1048*10;
  1888. int CurrentSize = 0;
  1889. void
  1890. AddToStats (
  1891. int Size
  1892. )
  1893. {
  1894. int i;
  1895. for (i = 0; i < CurrentSize; i++)
  1896. {
  1897. if (Stats[i].Size == Size)
  1898. {
  1899. Stats[i].Count++;
  1900. return;
  1901. }
  1902. }
  1903. Stats[CurrentSize].Size = Size;
  1904. Stats[CurrentSize].Count = 1;
  1905. CurrentSize++;
  1906. }
  1907. int __cdecl compare( const void *arg1, const void *arg2 )
  1908. {
  1909. return ((struct SizeTable *) arg2)->Count - ((struct SizeTable *) arg1)->Count;
  1910. }
  1911. void
  1912. PrintStats (
  1913. )
  1914. {
  1915. int i;
  1916. int Total = 0;
  1917. qsort(&Stats[0], CurrentSize, sizeof(SizeTable), compare);
  1918. dprintf("\n\nSummary:\n");
  1919. for (i = 0; i < CurrentSize; i++)
  1920. {
  1921. dprintf("Size: %08x Count: %d\n",
  1922. Stats[i].Size,
  1923. Stats[i].Count
  1924. );
  1925. Total += Stats[i].Count;
  1926. }
  1927. dprintf("Total Count: %d\n", Total);
  1928. }
  1929. VOID
  1930. do_rpcmem(
  1931. ULONG64 qwAddr,
  1932. long Count,
  1933. long Verbose,
  1934. BOOL Summary,
  1935. long Size
  1936. )
  1937. {
  1938. BOOL b;
  1939. BOOL forwards = TRUE;
  1940. BOOL doAll = FALSE;
  1941. DWORD t;
  1942. ULONG64 tmp1;
  1943. ULONG tmp2;
  1944. unsigned Data[16];
  1945. unsigned char RearGuardBlock[4];
  1946. #if DBG
  1947. if (Count < 0) {
  1948. forwards = FALSE;
  1949. }
  1950. else
  1951. if (Count == 0) {
  1952. doAll = TRUE;
  1953. }
  1954. if (Stats == NULL)
  1955. {
  1956. Stats = (struct SizeTable *) RpcpFarAllocate(MaxSize * sizeof(struct SizeTable));
  1957. if (Stats == NULL)
  1958. {
  1959. return;
  1960. }
  1961. }
  1962. RpcpMemorySet(Stats, 0, MaxSize);
  1963. dprintf("\n");
  1964. do
  1965. {
  1966. if ((CheckControlC)())
  1967. {
  1968. return;
  1969. }
  1970. ULONG64 size;
  1971. GET_MEMBER(qwAddr, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, size, size);
  1972. AddToStats((int)size);
  1973. if ((Size == 0 || Size == (long) size) && !Summary)
  1974. {
  1975. ULONG64 rearguard;
  1976. GET_ADDRESS_OF(qwAddr, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, rearguard, rearguard, tmp2);
  1977. dprintf("-------- size (%08x) block: 0x%I64x contains: %s",
  1978. (ULONG)size,
  1979. qwAddr,
  1980. SymbolAtAddressNoOffset(rearguard)
  1981. );
  1982. if (Verbose)
  1983. {
  1984. b = GetData(rearguard,
  1985. Data,
  1986. min((ULONG)size, sizeof(Data)));
  1987. if ( !b )
  1988. {
  1989. dprintf("can't read block data at 0x%I64x\n", rearguard);
  1990. return;
  1991. }
  1992. for (t = 0; t < min(((ULONG)size)/4, sizeof(Data)/4); t++)
  1993. {
  1994. if (t % 4 == 0)
  1995. {
  1996. dprintf("\n%I64p ",
  1997. rearguard + t*4);
  1998. }
  1999. dprintf("%08x ", Data[t]);
  2000. }
  2001. }
  2002. dprintf("\n");
  2003. }
  2004. ULONG64 frontguardAddr;
  2005. ULONG64 rearguardAddr;
  2006. GET_ADDRESS_OF(qwAddr, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, frontguard, frontguardAddr, tmp2);
  2007. GET_ADDRESS_OF(qwAddr+size, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, rearguard, rearguardAddr, tmp2);
  2008. unsigned char frontguardVal[4];
  2009. unsigned char rearguardVal[4];
  2010. GetData(frontguardAddr, frontguardVal, sizeof(frontguardVal));
  2011. GetData(rearguardAddr, rearguardVal, sizeof(rearguardVal));
  2012. if ( (frontguardVal[0] != RPC_GUARD) ||
  2013. (frontguardVal[1] != RPC_GUARD) ||
  2014. (frontguardVal[2] != RPC_GUARD) ||
  2015. (frontguardVal[3] != RPC_GUARD) )
  2016. {
  2017. dprintf(" RPC: BAD FRONTGUARD %x-%x-%x-%x\n", frontguardVal[0], frontguardVal[1], frontguardVal[2], frontguardVal[3]);
  2018. }
  2019. if ( (rearguardVal[0] != RPC_GUARD) ||
  2020. (rearguardVal[1] != RPC_GUARD) ||
  2021. (rearguardVal[2] != RPC_GUARD) ||
  2022. (rearguardVal[3] != RPC_GUARD) )
  2023. {
  2024. dprintf(" RPC: BAD REARGUARD %x-%x-%x-%x\n", rearguardVal[0], rearguardVal[1], rearguardVal[2], rearguardVal[3]);
  2025. }
  2026. ULONG64 next;
  2027. ULONG64 previous;
  2028. GET_MEMBER(qwAddr, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, next, next);
  2029. GET_MEMBER(qwAddr, RPC_MEMORY_BLOCK, RPCRT4!RPC_MEMORY_BLOCK, previous, previous);
  2030. if (forwards == TRUE)
  2031. {
  2032. qwAddr = next;
  2033. Count--;
  2034. }
  2035. else
  2036. {
  2037. qwAddr = previous;
  2038. Count++;
  2039. }
  2040. }
  2041. while (qwAddr && (Count || doAll) );
  2042. PrintStats();
  2043. #endif
  2044. dprintf("\n");
  2045. }
  2046. VOID
  2047. do_rpcmsg(
  2048. ULONG64 qwAddr
  2049. )
  2050. {
  2051. ULONG64 tmp1;
  2052. dprintf("\n");
  2053. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, Handle, "Handle(RPC_BINDING_HANDLE) ", tmp1);
  2054. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, DataRepresentation, "DataRepresentation ", tmp1);
  2055. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, Buffer, "pBuffer(void) ", tmp1);
  2056. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, BufferLength, "BufferLength ", tmp1);
  2057. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, ProcNum, "ProcNum ", tmp1);
  2058. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, TransferSyntax, "TransferSyntax(RPC_SYNTAX_IDENTIFIER) ", tmp1);
  2059. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, RpcInterfaceInformation, "pRpcInterfaceInformation(void) ", tmp1);
  2060. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, ReservedForRuntime, "pReservedForRuntime(void) ", tmp1);
  2061. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, ManagerEpv, "pManagerEpv(RPC_MGR_EPV) ", tmp1);
  2062. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, ImportContext, "pImportContext(void) ", tmp1);
  2063. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_MESSAGE, RPCRT4!RPC_MESSAGE, RpcFlags, "RpcFlags ", tmp1);
  2064. dprintf("\n");
  2065. }
  2066. VOID
  2067. do_transinfo(
  2068. ULONG64 qwAddr
  2069. )
  2070. {
  2071. ULONG64 tmp1;
  2072. ULONG tmp2;
  2073. ULONG64 LoadableTrans;
  2074. GET_MEMBER(qwAddr, TRANS_INFO, RPCRT4!TRANS_INFO, LoadableTrans, LoadableTrans);
  2075. dprintf("\n");
  2076. PRINT_MEMBER(qwAddr, TRANS_INFO, RPCRT4!TRANS_INFO, pTransportInterface, tmp1);
  2077. PRINT_MEMBER(qwAddr, TRANS_INFO, RPCRT4!TRANS_INFO, LoadableTrans, tmp1);
  2078. PRINT_MEMBER(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, ThreadsStarted, tmp1);
  2079. PRINT_MEMBER(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, NumThreads, tmp1);
  2080. PRINT_MEMBER(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, ProcessCallsFunc, tmp1);
  2081. PRINT_MEMBER(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, LoadedDll, tmp1);
  2082. PRINT_ADDRESS_OF(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, ProtseqDict, tmp2);
  2083. PRINT_ADDRESS_OF(LoadableTrans, LOADABLE_TRANSPORT, RPCRT4!LOADABLE_TRANSPORT, DllName, tmp2);
  2084. PRINT_MEMBER(qwAddr, TRANS_INFO, RPCRT4!TRANS_INFO, RpcProtocolSequence, tmp1);
  2085. dprintf("\n");
  2086. }
  2087. DECLARE_API( help )
  2088. {
  2089. LPSTR lpArgumentString = (LPSTR)args;
  2090. if (lpArgumentString[0] == '\0') {
  2091. dprintf( "\n");
  2092. dprintf( "rpcdbg help:\n\n");
  2093. dprintf( "\n");
  2094. dprintf( "!obj <address> - Dumps an RPC object \n");
  2095. dprintf( "\n");
  2096. dprintf( "!sizes - Prints sizes of the data structures\n");
  2097. dprintf( "!error - Translates and error value into the error message\n");
  2098. dprintf( "!symbol (<address>|<symbol name>) - Returns symbol name/address\n");
  2099. dprintf( "!rpcheap [-a <address>][-d <num display>] - Dumps RPC_MEMORY_BLOCK linked list\n");
  2100. dprintf( "\n");
  2101. dprintf( "!pasync <address> - Dumps RPC_ASYNC_STATE\n");
  2102. dprintf( "!rpcmsg <address> - Dumps RPC_MESSAGE\n");
  2103. dprintf( "!stubmsg <address> - Dumps MIDL_STUB_MESSAGE\n");
  2104. dprintf( "!authinfo <address> - Dumps CLIENT_AUTH_INFO\n");
  2105. dprintf( "!rpcsvr <address> - Dumps RPC_SERVER \n");
  2106. dprintf( "!secinfo - Dumps security provider/package info\n");
  2107. dprintf( "!dict <address> - Dumps SDICT \n");
  2108. dprintf( "!dict2 <address> - Dumps SDICT2 \n");
  2109. dprintf( "!queue <address> - Dumps QUEUE \n");
  2110. dprintf( "!thread <teb> - Dumps THREAD \n");
  2111. dprintf( "!copacket <address> - Dumps CO packet \n");
  2112. dprintf( "!lpcpacket <address> - Dumps LRPC packet \n");
  2113. dprintf( "!transinfo <address> - Dumps TRANS_INFO \n");
  2114. dprintf( "\n");
  2115. dprintf( "!scan [options] - Dumps the event log, add '-?' for help\n");
  2116. dprintf( "!dgcc <address> - Dumps DG_CCALL \n");
  2117. dprintf( "!dgsc <address> - Dumps DG_SCALL \n");
  2118. dprintf( "!dgpe <address> - Dumps DG_PACKET_ENGINE\n");
  2119. dprintf( "!dgpkt <address> - Dumps DG_PACKET \n");
  2120. dprintf( "!dgpkthdr <address> - Dumps dg packet header (NCA_PACKET_HEADER)\n");
  2121. dprintf( "!dgep <address> - Dumps DG_ENDPOINT \n");
  2122. dprintf( "\n");
  2123. dprintf( "!asyncmsg <address> - Dumps NDR_ASYNC_MESSAGE\n");
  2124. dprintf( "!asyncrpc <address> - Dumps RPC_ASYNC_STATE\n");
  2125. dprintf( "!asyncdcom <address> - Dumps CAsyncManager\n");
  2126. dprintf( "\n");
  2127. dprintf( "!pipemsg <address> - Dumps NDR_PIPE_MESSAGE\n");
  2128. dprintf( "!pipedesc <address> - Dumps NDR_PIPE_DESC\n");
  2129. dprintf( "!pipestate <address> - Dumps NDR_PIPE_STATE\n");
  2130. dprintf( "\n");
  2131. dprintf( "!trans <address> - Dumps most NT RPC transport objects\n");
  2132. dprintf( "!overlap <address> - Dumps object associated with OVERLAPPED pointer\n");
  2133. dprintf( "!wsaddr <address> - Dumps sockaddr structure\n");
  2134. dprintf( "!protocols <address> - Dumps PnP protocols map & related objects\n");
  2135. dprintf( "\n");
  2136. dprintf( "!rpctime - Displays current system time\n");
  2137. dprintf( "!getcallinfo [options] - Searches the system for call info, add '-?' for help\n");
  2138. dprintf( "!getendpointinfo [options] - Searches the system for endpoint info, add '-?' for help\n");
  2139. dprintf( "!getdbgcell <processID> <cellID1>.<cellID2> - Gets info for the specified cell\n");
  2140. dprintf( "!getthreadinfo [options] - Searches the system for thread info, add '-?' for help\n");
  2141. dprintf( "!getclientcallinfo [options] - Searches the system for client call info, add '-?' for help\n");
  2142. dprintf( "!checkrpcsym - Checks whether RPC symbols are correct\n");
  2143. dprintf( "!rpcreadstack - Reads an RPC client side stack and retrieves the call info\n");
  2144. dprintf( "!rpcverbosestack - toggles the state of the verbose spew when reading the stack\n");
  2145. dprintf( "!eerecord - prints an extended error info record\n");
  2146. dprintf( "!eeinfo - prints the extended error info chain\n");
  2147. dprintf( "!typeinfo - turns on/off the use of type information\n");
  2148. dprintf( "!stackmatch start_addr [depth] matches stack symbols and target addresses\n");
  2149. dprintf( "!listcalls <address> - Dumps addresses, associations, and calls active within the RPC_SERVER at address\n");
  2150. dprintf( "!rpcverifier - Dumps the RPC verifier settings\n\n");
  2151. }
  2152. }
  2153. void do_symbol(ULONG64 qwAddr)
  2154. {
  2155. CHAR Symbol[128];
  2156. ULONG64 Displacement = 0;
  2157. GetSymbol(qwAddr, Symbol, &Displacement);
  2158. dprintf("%I64x %s+%I64x\n", qwAddr, Symbol, Displacement);
  2159. }
  2160. DECLARE_API( symbol )
  2161. {
  2162. ULONG64 qwAddr;
  2163. LPSTR lpArgumentString = (LPSTR)args;
  2164. qwAddr = GetExpression(lpArgumentString);
  2165. if ( !qwAddr )
  2166. {
  2167. return;
  2168. }
  2169. do_symbol(qwAddr);
  2170. }
  2171. #define MAX_ARGS 4
  2172. DECLARE_API( rpcheap )
  2173. {
  2174. ULONG64 qwAddr = 0;
  2175. ULONG64 dwTmpAddr = 0;
  2176. long lDisplay = 0;
  2177. long lVerbose = 1;
  2178. BOOL Summary = 0;
  2179. int argc = 0;
  2180. int i;
  2181. long lSize = 0;
  2182. CurrentSize = 0;
  2183. char **argv = new char*[MAX_ARGS];
  2184. if (argv == NULL)
  2185. return;
  2186. LPSTR lpArgumentString = (LPSTR)args;
  2187. //#ifdef DEBUGRPC
  2188. for (i = 0; ; ) {
  2189. while (lpArgumentString[i] == ' ') {
  2190. lpArgumentString[i] = '\0';
  2191. i++;
  2192. }
  2193. if (lpArgumentString[i] == '\0') {
  2194. break;
  2195. }
  2196. argv[argc] = &(lpArgumentString[i]);
  2197. argc++;
  2198. if (argc > MAX_ARGS) {
  2199. dprintf("\nToo many arguments. Extra args ignored.\n\n");
  2200. break;
  2201. }
  2202. while ((lpArgumentString[i] != ' ')&&
  2203. (lpArgumentString[i] != '\0')) {
  2204. i++;
  2205. }
  2206. }
  2207. for (i = 0; i < argc; i++) {
  2208. if ((*argv[i] == '-') || (*argv[i] == '/') || (*argv[i] == '+')) {
  2209. switch (*(argv[i]+1)) {
  2210. case 'A':
  2211. case 'a':
  2212. qwAddr = GetExpression(argv[++i]);
  2213. if (!qwAddr) {
  2214. dprintf("Error: Failure to get address of RPC memory list\n");
  2215. return;
  2216. }
  2217. break;
  2218. case 'D':
  2219. case 'd':
  2220. lDisplay = (long)myatol(argv[++i]);
  2221. break;
  2222. case 's':
  2223. Summary = 1;
  2224. break;
  2225. case 'z':
  2226. lSize = (long) GetExpression(argv[++i]);
  2227. break;
  2228. case 'q':
  2229. case 'Q':
  2230. lVerbose = FALSE;
  2231. break;
  2232. case '?':
  2233. default:
  2234. dprintf("rpcheap \n");
  2235. dprintf(" -a <address> (default:starts at head of linked list)\n");
  2236. dprintf(" -d <number of mem blks to display> (default: to end)\n");
  2237. dprintf(" -s display summary only (default: full dump)\n");
  2238. dprintf(" -z <size> display blocks of size <size> only (default: all)\n");
  2239. dprintf(" -q quiet (default: verbose)\n");
  2240. break;
  2241. }
  2242. }
  2243. else {
  2244. dprintf("rpcheap \n");
  2245. dprintf(" -a <address> (default:starts at head of linked list)\n");
  2246. dprintf(" -d <number of mem blks to display> (default: to end)\n");
  2247. }
  2248. }
  2249. if (!qwAddr) {
  2250. dwTmpAddr = GetExpression("rpcrt4!AllocatedBlocks");
  2251. dprintf("Address of AllocatedBlocks - 0x%I64x\n", dwTmpAddr);
  2252. if (!ReadPtrUnextend(dwTmpAddr, &qwAddr))
  2253. dprintf("Contents of AllocatedBlocks - 0x%I64x\n", qwAddr);
  2254. }
  2255. do_rpcmem(qwAddr, lDisplay, lVerbose, Summary, lSize);
  2256. //#else // DEBUGRPC
  2257. //dprintf("This extension command is not supported on a free build!\n");
  2258. //#endif // DEBUGRPC
  2259. if (argv) {
  2260. delete[] argv;
  2261. }
  2262. return;
  2263. }
  2264. VOID
  2265. do_lpcaddr(
  2266. ULONG64 qwAddr
  2267. )
  2268. {
  2269. ULONG64 tmp1;
  2270. ULONG tmp2;
  2271. do_rpcaddr( qwAddr );
  2272. dprintf("\n");
  2273. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, LpcAddressPort, "LpcAddressPort(HANDLE)\t\t", tmp1);
  2274. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, CallThreadCount, "CallThreadCount\t\t\t", tmp1);
  2275. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, MinimumCallThreads, "MinimumCallThreads\t\t", tmp1);
  2276. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, AssociationDictionary, "&Associations(LRPC_ASSOCIATION_DICT)", tmp2);
  2277. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, AssociationCount, "AssociationCount\t\t", tmp1);
  2278. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, ServerListeningFlag, "ServerListeningFlag\t\t", tmp1);
  2279. dprintf("\n");
  2280. }
  2281. VOID
  2282. do_lpcsa(
  2283. ULONG64 qwAddr
  2284. )
  2285. {
  2286. ULONG64 tmp1;
  2287. ULONG tmp2;
  2288. dprintf("\n");
  2289. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, AssociationReferenceCount, "AssociationReferenceCount\t", tmp1);
  2290. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, DictionaryKey, "DictionaryKey\t\t\t", tmp1);
  2291. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, LpcServerPort, "LpcServerPort(HANDLE)\t\t", tmp1);
  2292. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, LpcReplyPort, "LpcReplyPort\t\t\t", tmp1);
  2293. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, Address, "Address\t\t\t\t", tmp1);
  2294. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, Bindings, "&Bindings(LRPC_SBINDING_DICT)\t", tmp2);
  2295. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, Aborted, "Aborted\t\t\t\t", tmp1);
  2296. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, Deleted, "Deleted\t\t\t\t", tmp1);
  2297. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, CachedSCall, "CachedSCall\t\t\t", tmp1);
  2298. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, CachedSCallAvailable, "CachedSCallAvailable\t\t", tmp1);
  2299. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, Buffers, "&Buffers(LRPC_CLIENT_BUFFER_DICT)", tmp2);
  2300. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, AssociationMutex, "&AssociationMutex\t\t", tmp2);
  2301. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, FreeSCallQueue, "&FreeSCallQueue\t\t\t", tmp2);
  2302. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, ClientThreadDict, "&ClientThreadDict\t\t", tmp2);
  2303. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, SContextDict, "&SContextDict\t\t\t", tmp2);
  2304. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SASSOCIATION, RPCRT4!LRPC_SASSOCIATION, SCallDict, "&SCallDict\t\t\t", tmp2);
  2305. dprintf("\n");
  2306. }
  2307. VOID
  2308. do_lpcscall(
  2309. ULONG64 qwAddr
  2310. )
  2311. {
  2312. ULONG64 tmp1;
  2313. ULONG tmp2;
  2314. dprintf("\n");
  2315. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, AsyncStatus, "AsyncStatus\t\t\t", tmp1);
  2316. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CachedAPCInfo, "pCachedAPCInfo\t\t\t", tmp2);
  2317. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CachedAPCInfoAvailable, "CachedAPCInfoAvailable\t\t", tmp1);
  2318. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, pAsync, "pAsync\t\t\t\t", tmp1);
  2319. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CallingThread, "CallingThread\t\t\t", tmp1);
  2320. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, NotificationIssued, "NotificationIssued\t\t", tmp1);
  2321. ULONG64 AuthInfo;
  2322. GET_ADDRESS_OF(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, AuthInfo, AuthInfo, tmp2);
  2323. dprintf("&ClientAuthInfo\t\t\t - 0x%I64x\n", AuthInfo);
  2324. do_authinfo(AuthInfo );
  2325. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, ActiveContextHandles, "&ActiveContextHandles(ServerContextHandle_DICT)\t", tmp2);
  2326. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, DispatchBuffer, "DispatchBuffer\t\t\t", tmp1);
  2327. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, Association, "pAssociation(LRPC_ASSOCIATION)\t", tmp1);
  2328. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, LrpcRequestMessage, "pLrpcMessage(LRPC_MESSAGE)\t", tmp1);
  2329. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, LrpcReplyMessage, "pLrpcReplyMessage(LRPC_MESSAGE)\t", tmp1);
  2330. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, SBinding, "pSBinding(LRPC_SBINDING)\t", tmp1);
  2331. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, ObjectUuidFlag, "ObjectUuidFlag\t\t\t", tmp1);
  2332. ULONG64 ObjectUuid;
  2333. GET_ADDRESS_OF(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, ObjectUuid, ObjectUuid, tmp2);
  2334. dprintf("ObjectUuid\t\t\t - ");
  2335. PrintUuid(ObjectUuid); dprintf("\n");
  2336. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CallId, "CallId\t\t\t\t", tmp1);
  2337. ULONG64 ClientId;
  2338. GET_ADDRESS_OF(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, ClientId, ClientId, tmp2);
  2339. PRINT_MEMBER_WITH_LABEL(ClientId, CLIENT_ID, RPCRT4!CLIENT_ID, UniqueProcess, "ClientId.UniqueProcess(CLIENT_ID.HANDLE)", tmp1);
  2340. PRINT_MEMBER_WITH_LABEL(ClientId, CLIENT_ID, RPCRT4!CLIENT_ID, UniqueThread, "ClientId.UniqueThread (CLIENT_ID.HANDLE)", tmp1);
  2341. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, MessageId, "MessageId\t\t\t", tmp1);
  2342. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, PushedResponse, "pPushedResponse(VOID)\t\t", tmp1);
  2343. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CurrentBufferLength, "CurrentBuffferLength\t\t", tmp1);
  2344. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, BufferComplete, "BufferComplete\t\t\t", tmp1);
  2345. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, Flags, "Flags\t\t\t\t", tmp1);
  2346. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, FirstSend, "FirstSend\t\t\t", tmp1);
  2347. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, PipeSendCalled, "PipeSendCalled\t\t\t", tmp1);
  2348. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, Deleted, "Deleted\t\t\t\t", tmp1);
  2349. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, ReceiveEvent, "ReceiveEvent\t\t\t", tmp1);
  2350. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CallMutex, "CallMutex\t\t\t", tmp1);
  2351. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, RcvBufferLength, "RcvBufferLength\t\t\t", tmp1);
  2352. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, AsyncReply, "AsyncReply\t\t\t", tmp1);
  2353. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, NextSCall, "NextSCall\t\t\t", tmp1);
  2354. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, NeededLength, "NeededLength\t\t\t", tmp1);
  2355. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, fSyncDispatch, "fSyncDispatch\t\t\t", tmp1);
  2356. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, Choked, "Choked\t\t\t\t", tmp1);
  2357. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, CancelPending, "CancelPending\t\t\t", tmp1);
  2358. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, RefCount, "RefCount\t\t\t", tmp1);
  2359. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, BufferQueue, "&BufferQueue\t\t\t", tmp2);
  2360. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_SCALL, RPCRT4!LRPC_SCALL, SContext, "SContext\t\t\t", tmp1);
  2361. dprintf("\n");
  2362. }
  2363. VOID
  2364. do_lpcbh(
  2365. ULONG64 qwAddr
  2366. )
  2367. {
  2368. ULONG64 tmp0;
  2369. ULONG tmp1;
  2370. do_bh(qwAddr);
  2371. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, CurrentAssociation, "pCurrentAssociation(LRPC_CASSOCIATION)", tmp0);
  2372. PRINT_ADDRESS_OF(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, SecAssociation, tmp1);
  2373. PRINT_MEMBER(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, DceBinding, tmp0);
  2374. GET_ADDRESS_OF(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, DceBinding, tmp0, tmp1);
  2375. do_dcebinding(tmp0);
  2376. PRINT_MEMBER(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, BindingReferenceCount, tmp0);
  2377. PRINT_ADDRESS_OF(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, RecursiveCalls, tmp1);
  2378. PRINT_MEMBER(qwAddr, LRPC_BINDING_HANDLE, RPCRT4!LRPC_BINDING_HANDLE, AuthInfoInitialized, tmp0);
  2379. }
  2380. VOID
  2381. do_lpcca(
  2382. ULONG64 qwAddr
  2383. )
  2384. {
  2385. dprintf("\n");
  2386. ULONG64 tmp1;
  2387. ULONG tmp2;
  2388. ULONG64 DceBinding;
  2389. GET_MEMBER(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, DceBinding, DceBinding);
  2390. dprintf("pDceBinding(DCE_BINDING)\t- 0x%I64x\n", DceBinding);
  2391. do_dcebinding(DceBinding);
  2392. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, AssociationDictKey, "AssociationDictKey\t\t", tmp1);
  2393. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, Bindings, "&Bindings(LRPC_BINDING_DICT)\t", tmp2);
  2394. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, FreeCCalls, "&FreeCCalls\t\t\t", tmp2);
  2395. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, ActiveCCalls, "&ActiveCCalls\t\t\t", tmp2);
  2396. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, LpcClientPort, "LpcClientPort\t\t\t", tmp1);
  2397. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, LpcReceivePort, "LpcReceivePort\t\t\t", tmp1);
  2398. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, AssociationMutex, "&AssociationMutex(MUTEX)\t", tmp2);
  2399. ULONG64 AssocAuthInfo;
  2400. GET_ADDRESS_OF(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, AssocAuthInfo, AssocAuthInfo, tmp2);
  2401. do_authinfo(AssocAuthInfo);
  2402. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, BackConnectionCreated, "BackConnectionCreated\t\t", tmp1);
  2403. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, CachedCCall, "pCachedCCall(LRPC_CCALL)\t", tmp1);
  2404. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, CachedCCallFlag, "CachedCCallFlag\t\t\t", tmp1);
  2405. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, CallIdCounter, "CallIdCounter\t\t\t", tmp1);
  2406. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, SecurityContextDict, "&SecurityContextDict\t\t", tmp2);
  2407. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, LastSecContextTrimmingTimestamp, "Timestamp\t\t\t", tmp1);
  2408. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CASSOCIATION, RPCRT4!LRPC_CASSOCIATION, BindingHandleReferenceCount, "BindingHAndleReferenceCount\t", tmp1);
  2409. dprintf("\n");
  2410. }
  2411. VOID
  2412. do_lpcccall(
  2413. ULONG64 qwAddr
  2414. )
  2415. {
  2416. ULONG64 tmp1;
  2417. ULONG tmp2;
  2418. dprintf("\n");
  2419. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, AsyncStatus, "AsyncStatus\t\t\t", tmp1);
  2420. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CachedAPCInfo, "pCachedAPCInfo\t\t\t", tmp2);
  2421. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CachedAPCInfoAvailable, "CachedAPCInfoAvailable\t\t", tmp1);
  2422. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, pAsync, "pAsync\t\t\t\t", tmp1);
  2423. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallingThread, "CallingThread\t\t\t", tmp1);
  2424. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, NotificationIssued, "NotificationIssued\t\t", tmp1);
  2425. ULONG64 AuthInfo;
  2426. GET_ADDRESS_OF(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, AuthInfo, AuthInfo, tmp2);
  2427. dprintf("AuthInfo\t\t\t- 0x%I64x\n", AuthInfo);
  2428. do_authinfo(AuthInfo);
  2429. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CurrentBindingHandle, "pCurrentBindingHandle(LRPC_BINDING_HANDLE)", tmp1);
  2430. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, Association, "pAssociation(LRPC_CASSOCIATION)\t", tmp1);
  2431. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, LrpcMessage, "pLrpcMessage(LRPC_MESSAGE)\t", tmp1);
  2432. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, RpcReplyMessage, "RpcReplyMessage\t\t\t", tmp1);
  2433. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, LpcReplyMessage, "LpcReplyMessage\t\t\t", tmp1);
  2434. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, RcvBufferLength, "RcvBufferLength\t\t\t", tmp1);
  2435. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, Choked, "Choked\t\t\t\t", tmp1);
  2436. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, RecursiveCallsKey, "RecursiveCallsKey\t\t", tmp1);
  2437. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, FreeCallKey, "FreeCallKey\t\t\t", tmp1);
  2438. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallId, "CallId\t\t\t", tmp1);
  2439. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, MessageId, "MessageId\t\t\t", tmp1);
  2440. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallbackId, "CallbackId\t\t\t", tmp1);
  2441. ULONG64 ClientId;
  2442. GET_ADDRESS_OF(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, ClientId, ClientId, tmp2);
  2443. PRINT_MEMBER_WITH_LABEL(ClientId, CLIENT_ID, RPCRT4!CLIENT_ID, UniqueProcess, "ClientId.UniqueProcess(CLIENT_ID.HANDLE)", tmp1);
  2444. PRINT_MEMBER_WITH_LABEL(ClientId, CLIENT_ID, RPCRT4!CLIENT_ID, UniqueThread, "ClientId.UniqueThread (CLIENT_ID.HANDLE)", tmp1);
  2445. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, DataInfoOffset, "DataInfoOffset\t\t\t", tmp1);
  2446. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallAbortedFlag, "CallAbortedFlag\t\t\t", tmp1);
  2447. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, Thread, "Thread(THREAD_IDENTIFIER)\t", tmp1);
  2448. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, Binding, "Binding(LRPC_BINDING)", tmp1);
  2449. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, RecursionCount, "RecursionCount\t\t\t", tmp1);
  2450. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, SyncEvent, "SyncEvent\t\t\t", tmp2);
  2451. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, MsgFlags, "MsgFlags\t\t\t", tmp1);
  2452. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallMutex, "CallMutex\t\t\t", tmp2);
  2453. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CallStack, "CallStack\t\t\t", tmp1);
  2454. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CachedLrpcMessage, "CachedLrpcMessage\t\t", tmp1);
  2455. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, FirstFrag, "FirstFrag\t\t\t", tmp1);
  2456. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CurrentBufferLength, "CurrentBufferLength\t\t", tmp1);
  2457. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, NeededLength, "NeededLength\t\t\t", tmp1);
  2458. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, BufferQueue, "BufferQueue\t\t\t", tmp2);
  2459. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, fSendComplete, "fSendcomplete\t\t\t", tmp1);
  2460. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, CurrentSecurityContext, "CurrentSecurityContext\t\t", tmp1);
  2461. PRINT_MEMBER_WITH_LABEL(qwAddr, LRPC_CCALL, RPCRT4!LRPC_CCALL, EEInfo, "Extended Error Info\t\t", tmp1);
  2462. dprintf("\n");
  2463. }
  2464. VOID
  2465. do_pasync(
  2466. ULONG64 qwAddr
  2467. )
  2468. {
  2469. ULONG64 tmp1;
  2470. ULONG tmp2;
  2471. dprintf("\n");
  2472. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Size, "Size\t\t\t", tmp1);
  2473. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Signature, "Signature\t\t", tmp1);
  2474. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Lock, "Lock\t\t\t", tmp1);
  2475. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Flags, "Flags\t\t\t", tmp1);
  2476. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, StubInfo, "StubInfo\t\t", tmp1);
  2477. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, UserInfo, "UserInfo\t\t", tmp1);
  2478. PRINT_MEMBER_WITH_LABEL(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, RuntimeInfo, "RuntimeInfo\t\t", tmp1);
  2479. ULONG64 Event;
  2480. GET_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Event, Event);
  2481. dprintf("Event\t\t\t - ");
  2482. switch ((ULONG)Event)
  2483. {
  2484. case RpcCallComplete:
  2485. dprintf("RpcCallComplete\n");
  2486. break;
  2487. case RpcSendComplete:
  2488. dprintf("RpcSendComplete\n");
  2489. break;
  2490. case RpcReceiveComplete:
  2491. dprintf("RpcReceiveComplete\n");
  2492. break;
  2493. default:
  2494. dprintf("(unknown) 0x%I64x\n", Event);
  2495. break;
  2496. }
  2497. ULONG64 NotificationType;
  2498. GET_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, NotificationType, NotificationType);
  2499. dprintf("NotificationType\t - ");
  2500. BOOL b;
  2501. char block[sizeof(RPC_ASYNC_STATE)];
  2502. PRPC_ASYNC_STATE pa = (PRPC_ASYNC_STATE)block;
  2503. if (!fUseTypeInfo) {
  2504. b = GetData(qwAddr, block, sizeof(RPC_ASYNC_STATE));
  2505. if ( !b ) {
  2506. dprintf("can't read %p\n", qwAddr);
  2507. return;
  2508. }
  2509. }
  2510. switch ((ULONG)NotificationType)
  2511. {
  2512. case RpcNotificationTypeNone:
  2513. dprintf("RpcNotificationTypeNone\n");
  2514. break;
  2515. case RpcNotificationTypeEvent:
  2516. dprintf("RpcNotificationTypeEvent\n");
  2517. if (!fUseTypeInfo)
  2518. dprintf("\thEvent\t\t - 0x%p\n", pa->u.hEvent);
  2519. break;
  2520. case RpcNotificationTypeApc:
  2521. dprintf("RpcNotificationTypeApc\n");
  2522. if (!fUseTypeInfo) {
  2523. dprintf("\tNotificationRoutine\t - 0x%p\n", pa->u.APC.NotificationRoutine);
  2524. dprintf("\thThread\t\t\t - 0x%p\n", pa->u.APC.hThread);
  2525. }
  2526. break;
  2527. case RpcNotificationTypeIoc:
  2528. dprintf("RpcNotificationTypeIoc\n");
  2529. if (!fUseTypeInfo) {
  2530. dprintf("\thIOPort\t\t\t - 0x%p\n", pa->u.IOC.hIOPort);
  2531. dprintf("\tdwNumberOfBytesTransferred - 0x%x\n",
  2532. pa->u.IOC.dwNumberOfBytesTransferred);
  2533. dprintf("\tdwCompletionKey\t\t - 0x%p\n", pa->u.IOC.dwCompletionKey);
  2534. dprintf("\tlpOverlapped\t\t - 0x%x\n", pa->u.IOC.lpOverlapped);
  2535. }
  2536. break;
  2537. case RpcNotificationTypeHwnd:
  2538. dprintf("RpcNotificationTypeHwnd\n");
  2539. if (!fUseTypeInfo) {
  2540. dprintf("\thWnd\t\t - 0x%p\n", pa->u.HWND.hWnd);
  2541. dprintf("\tMsg\t\t - 0x%x\n", pa->u.HWND.Msg);
  2542. }
  2543. break;
  2544. case RpcNotificationTypeCallback:
  2545. dprintf("RpcNotificationTypeCallback\n");
  2546. if (!fUseTypeInfo) {
  2547. dprintf("NotificationRoutine\t - 0x%p\n", pa->u.NotificationRoutine);
  2548. }
  2549. break;
  2550. default:
  2551. dprintf("Bad notification type\n");
  2552. }
  2553. dprintf("\n");
  2554. }
  2555. char *
  2556. ReceiveStates[] =
  2557. {
  2558. "START",
  2559. "COPY_PIPE_ELEM",
  2560. "RETURN_PARTIAL",
  2561. "READ_PARTIAL"
  2562. };
  2563. void
  2564. do_stubmsg(
  2565. ULONG64 msg
  2566. )
  2567. {
  2568. ULONG64 tmp0;
  2569. dprintf("MIDL_STUB_MESSAGE at 0x%I64x\n\n", msg);
  2570. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, Buffer, tmp0);
  2571. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, BufferStart, tmp0);
  2572. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, BufferEnd, tmp0);
  2573. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, BufferMark, tmp0);
  2574. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, MemorySize, tmp0);
  2575. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, Memory, tmp0);
  2576. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, BufferLength, tmp0);
  2577. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, pAllocAllNodesContext, tmp0);
  2578. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, RpcMsg, tmp0);
  2579. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, SavedHandle, tmp0);
  2580. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, StubDesc, tmp0);
  2581. PRINT_MEMBER_BOOLEAN(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, IsClient, tmp0);
  2582. PRINT_MEMBER_BOOLEAN(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, ReuseBuffer, tmp0);
  2583. PRINT_MEMBER_BOOLEAN(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, IgnoreEmbeddedPointers, tmp0);
  2584. PRINT_MEMBER_BOOLEAN(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, fBufferValid, tmp0);
  2585. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, MaxCount, tmp0);
  2586. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, ActualCount, tmp0);
  2587. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, Offset, tmp0);
  2588. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, StackTop, tmp0);
  2589. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, pPresentedType, tmp0);
  2590. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, pTransmitType, tmp0);
  2591. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, pRpcChannelBuffer, tmp0);
  2592. PRINT_MEMBER(msg, MIDL_STUB_MESSAGE, RPCRT4!MIDL_STUB_MESSAGE, pAsyncMsg, tmp0);
  2593. }
  2594. VOID
  2595. do_dgaddr(
  2596. ULONG64 qwAddr
  2597. )
  2598. {
  2599. ULONG64 tmp0;
  2600. ULONG tmp1;
  2601. dprintf("DG_ADDRESS at 0x%I64x\n\n", qwAddr);
  2602. do_rpcaddr(qwAddr);
  2603. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, TransInfo, tmp0);
  2604. PRINT_MEMBER_SYMBOL(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, TransInfo, tmp0);
  2605. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, ActiveCallCount, tmp0);
  2606. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, CachedConnections, tmp0);
  2607. dprintf("\nendpoint data:\n");
  2608. GET_ADDRESS_OF(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, Endpoint, tmp0, tmp1);
  2609. do_dgep(tmp0);
  2610. dprintf("\nobsolete data:\n");
  2611. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, TotalThreadsThisEndpoint, tmp0);
  2612. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, ThreadsReceivingThisEndpoint, tmp0);
  2613. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, MinimumCallThreads, tmp0);
  2614. PRINT_MEMBER(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, MaximumConcurrentCalls, tmp0);
  2615. PRINT_ADDRESS_OF(qwAddr, DG_ADDRESS, RPCRT4!DG_ADDRESS, ScavengerTimer, tmp1);
  2616. }
  2617. VOID
  2618. do_dgbh(
  2619. ULONG64 qwAddr
  2620. )
  2621. {
  2622. ULONG64 tmp1;
  2623. ULONG tmp2;
  2624. do_bh(qwAddr);
  2625. dprintf("DCE_BINDING:\n");
  2626. ULONG64 pDceBinding;
  2627. GET_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, pDceBinding, pDceBinding);
  2628. do_dcebinding(pDceBinding);
  2629. PRINT_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, EndpointFlags, tmp1);
  2630. PRINT_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, Association, tmp1);
  2631. PRINT_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, ReferenceCount, tmp1);
  2632. PRINT_MEMBER_BOOLEAN(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, fDynamicEndpoint, tmp1);
  2633. PRINT_MEMBER_BOOLEAN(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, fContextHandle, tmp1);
  2634. PRINT_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, TransportObject, tmp1);
  2635. PRINT_MEMBER(qwAddr, DG_BINDING_HANDLE, RPCRT4!DG_BINDING_HANDLE, TransportInterface, tmp1);
  2636. }
  2637. VOID
  2638. do_dgpe(
  2639. ULONG64 qwAddr
  2640. )
  2641. {
  2642. DG_PACKET_ENGINE *dgpe;
  2643. char block[sizeof(DG_PACKET_ENGINE)];
  2644. dgpe = (DG_PACKET_ENGINE *) block;
  2645. ULONG64 tmp1;
  2646. ULONG tmp;
  2647. if (!fUseTypeInfo) {
  2648. GetData(qwAddr, block, sizeof(DG_PACKET_ENGINE));
  2649. }
  2650. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SequenceNumber, tmp1);
  2651. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, ReferenceCount, tmp1);
  2652. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, PacketType,tmp1);
  2653. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, ActivityHint, tmp1);
  2654. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, TimeoutCount, tmp1);
  2655. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, CurrentPduSize, tmp1);
  2656. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, MaxFragmentSize, tmp1);
  2657. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SecurityTrailerSize, tmp1);
  2658. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, pSavedPacket, tmp1);
  2659. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SourceEndpoint, tmp1);
  2660. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, RemoteAddress, tmp1);
  2661. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, BaseConnection, tmp1);
  2662. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, pReceivedPackets, tmp1);
  2663. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, ReceiveFragmentBase, tmp1);
  2664. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, LastReceiveBuffer, tmp1);
  2665. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, pLastConsecutivePacket, tmp1);
  2666. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, LastReceiveBufferLength, tmp1);
  2667. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, ConsecutiveDataBytes, tmp1);
  2668. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, fReceivedAllFragments, tmp1);
  2669. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, Buffer, tmp1);
  2670. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SendWindowBase, tmp1);
  2671. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, FinalSendFrag, tmp1);
  2672. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, BufferLength, tmp1);
  2673. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SendWindowBits, tmp1);
  2674. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, FackSerialNumber, tmp1);
  2675. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, BufferFlags,tmp1);
  2676. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SendWindowSize, tmp1);
  2677. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, fRetransmitted, tmp1);
  2678. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, FirstUnsentOffset, tmp1);
  2679. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SendBurstLength, tmp1);
  2680. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, QueuedBufferHead, tmp1);
  2681. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, FirstUnsentFragment, tmp1);
  2682. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, QueuedBufferTail, tmp1);
  2683. PRINT_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, RingBufferBase, tmp1);
  2684. if (!fUseTypeInfo) {
  2685. dprintf(" Frag Offset Length Serial # | Frag Offset Length Serial #\n"
  2686. " ---- -------- ------ -------- | ---- -------- ------ --------\n"
  2687. );
  2688. }
  2689. ULONG64 RingBufferBase;
  2690. ULONG64 SendWindowBase;
  2691. GET_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, RingBufferBase, RingBufferBase);
  2692. GET_MEMBER(qwAddr, DG_PACKET_ENGINE, RPCRT4!DG_PACKET_ENGINE, SendWindowBase, SendWindowBase);
  2693. unsigned short i;
  2694. for (i=1; i <= MAX_WINDOW_SIZE/2; ++i)
  2695. {
  2696. unsigned Index1 = (i + (ULONG)RingBufferBase) % MAX_WINDOW_SIZE;
  2697. unsigned Frag1 = (ULONG)SendWindowBase+i;
  2698. if (Frag1 >= MAX_WINDOW_SIZE)
  2699. {
  2700. Frag1 -= MAX_WINDOW_SIZE;
  2701. }
  2702. if (!fUseTypeInfo) {
  2703. dprintf(" %4x: %8lx %5hx %4hx |",
  2704. Frag1,
  2705. dgpe->FragmentRingBuffer[Index1].Offset,
  2706. dgpe->FragmentRingBuffer[Index1].Length,
  2707. dgpe->FragmentRingBuffer[Index1].SerialNumber
  2708. );
  2709. }
  2710. unsigned Index2 = (i+MAX_WINDOW_SIZE/2 + (ULONG)RingBufferBase) % MAX_WINDOW_SIZE;
  2711. unsigned Frag2 = (ULONG)SendWindowBase+i+MAX_WINDOW_SIZE/2;
  2712. if (Frag2 >= MAX_WINDOW_SIZE)
  2713. {
  2714. Frag2 -= MAX_WINDOW_SIZE;
  2715. }
  2716. if (!fUseTypeInfo) {
  2717. dprintf(" %4x: %8lx %5hx %4hx \n",
  2718. Frag2,
  2719. dgpe->FragmentRingBuffer[Index2].Offset,
  2720. dgpe->FragmentRingBuffer[Index2].Length,
  2721. dgpe->FragmentRingBuffer[Index2].SerialNumber
  2722. );
  2723. }
  2724. }
  2725. dprintf("\n");
  2726. }
  2727. char *
  2728. ClientState(
  2729. DG_CCALL::DG_CLIENT_STATE State
  2730. )
  2731. {
  2732. switch (State)
  2733. {
  2734. case DG_CCALL::CallInit: return "init";
  2735. case DG_CCALL::CallQuiescent: return "quiescent";
  2736. case DG_CCALL::CallSend: return "sending";
  2737. case DG_CCALL::CallSendReceive: return "sendreceive";
  2738. case DG_CCALL::CallReceive: return "receiving";
  2739. case DG_CCALL::CallCancellingSend:return "cancel send";
  2740. case DG_CCALL::CallComplete: return "complete";
  2741. default:
  2742. {
  2743. static char scratch[40];
  2744. sprintf(scratch, "0x%lx", State);
  2745. return scratch;
  2746. }
  2747. }
  2748. }
  2749. char *
  2750. ServerState(
  2751. DG_SCALL::CALL_STATE State
  2752. )
  2753. {
  2754. switch (State)
  2755. {
  2756. case DG_SCALL::CallInit: return "init";
  2757. case DG_SCALL::CallBeforeDispatch: return "receiving";
  2758. case DG_SCALL::CallDispatched: return "dispatched";
  2759. case DG_SCALL::CallAfterDispatch: return "after stub";
  2760. case DG_SCALL::CallSendingResponse: return "sending";
  2761. case DG_SCALL::CallComplete: return "complete";
  2762. default:
  2763. {
  2764. static char scratch[40];
  2765. sprintf(scratch, "0x%lx", State);
  2766. return scratch;
  2767. }
  2768. }
  2769. }
  2770. char *
  2771. PipeOp(
  2772. PENDING_OPERATION Op
  2773. )
  2774. {
  2775. switch (Op)
  2776. {
  2777. case PWT_NONE: return "none";
  2778. case PWT_RECEIVE: return "receive";
  2779. case PWT_SEND: return "send";
  2780. case PWT_SEND_RECEIVE: return "send/recv";
  2781. default:
  2782. {
  2783. static char scratch[40];
  2784. sprintf(scratch, "0x%lx", Op);
  2785. return scratch;
  2786. }
  2787. }
  2788. }
  2789. VOID
  2790. do_dgcc(
  2791. ULONG64 dgcc
  2792. )
  2793. {
  2794. ULONG64 State, PreviousState;
  2795. ULONG64 tmp1;
  2796. ULONG tmp2;
  2797. dprintf("\n");
  2798. GET_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, State, State);
  2799. GET_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, PreviousState, PreviousState);
  2800. dprintf("state %-14s prev %-14s\n\n",
  2801. ClientState((DG_CCALL::DG_CLIENT_STATE)State),
  2802. ClientState((DG_CCALL::DG_CLIENT_STATE)PreviousState));
  2803. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, TimeStamp, tmp1);
  2804. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, TimeoutLimit, tmp1);
  2805. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, LastReceiveTime, tmp1);
  2806. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, AsyncStatus, tmp1);
  2807. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, CancelTime, tmp1);
  2808. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, EEInfo, tmp1);
  2809. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, ReceiveTimeout, tmp1);
  2810. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, WorkingCount, tmp1);
  2811. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, UnansweredRequestCount, tmp1);
  2812. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, PipeReceiveSize, tmp1);
  2813. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, Previous, tmp1);
  2814. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, Next, tmp1);
  2815. PRINT_MEMBER(dgcc, DG_CCALL, RPCRT4!DG_CCALL, pAsync, tmp1);
  2816. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, StaticArgsSent, tmp1);
  2817. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, DelayedSendPending, tmp1);
  2818. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, AllArgsSent, tmp1);
  2819. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, LastSendTimedOut, tmp1);
  2820. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, CancelComplete, tmp1);
  2821. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, ForceAck, tmp1);
  2822. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, CancelPending, tmp1);
  2823. PRINT_MEMBER_BOOLEAN(dgcc, DG_CCALL, RPCRT4!DG_CCALL, AutoReconnectOk, tmp1);
  2824. dprintf("\n");
  2825. ULONG64 ActivityHint;
  2826. GET_ADDRESS_OF(dgcc, DG_CCALL, RPCRT4!DG_CCALL, ActivityHint, ActivityHint, tmp2);
  2827. do_dgpe(ActivityHint-AddressSize);
  2828. }
  2829. VOID
  2830. do_dgep(
  2831. ULONG64 ep
  2832. )
  2833. {
  2834. ULONG64 tmp0;
  2835. ULONG tmp1;
  2836. ULONG64 Stats;
  2837. PRINT_MEMBER_BOOLEAN(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, Async, tmp0);
  2838. PRINT_MEMBER(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, TimeStamp, tmp0);
  2839. PRINT_MEMBER(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, Next, tmp0);
  2840. PRINT_MEMBER(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, NumberOfCalls, tmp0);
  2841. PRINT_MEMBER(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, TransportInterface, tmp0);
  2842. PRINT_MEMBER_SYMBOL(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, TransportInterface, tmp0);
  2843. GET_ADDRESS_OF(ep, DG_ENDPOINT, RPCRT4!DG_ENDPOINT, Stats, Stats, tmp1);
  2844. PRINT_MEMBER(Stats, DG_ENDPOINT_STATS, RPCRT4!DG_ENDPOINT_STATS, PreferredPduSize, tmp0);
  2845. PRINT_MEMBER(Stats, DG_ENDPOINT_STATS, RPCRT4!DG_ENDPOINT_STATS, MaxPduSize, tmp0);
  2846. PRINT_MEMBER(Stats, DG_ENDPOINT_STATS, RPCRT4!DG_ENDPOINT_STATS, MaxPacketSize, tmp0);
  2847. PRINT_MEMBER(Stats, DG_ENDPOINT_STATS, RPCRT4!DG_ENDPOINT_STATS, ReceiveBufferSize, tmp0);
  2848. }
  2849. VOID
  2850. do_dgccn(
  2851. ULONG64 qwAddr
  2852. )
  2853. {
  2854. ULONG64 tmp1;
  2855. ULONG tmp2;
  2856. dprintf("\nbase:\n");
  2857. ULONG64 ActivityNode;
  2858. GET_ADDRESS_OF(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, ActivityNode, ActivityNode, tmp2);
  2859. ULONG64 Uuid;
  2860. ULONG64 pPrev, pNext;
  2861. GET_ADDRESS_OF(ActivityNode, UUID_HASH_TABLE_NODE, RPCRT4!UUID_HASH_TABLE_NODE, Uuid, Uuid, tmp2);
  2862. GET_MEMBER(ActivityNode, UUID_HASH_TABLE_NODE, RPCRT4!UUID_HASH_TABLE_NODE, pPrev, pPrev);
  2863. GET_MEMBER(ActivityNode, UUID_HASH_TABLE_NODE, RPCRT4!UUID_HASH_TABLE_NODE, pNext, pNext);
  2864. dprintf(" activity ID "); PrintUuid(Uuid);
  2865. dprintf(" next %I64x prev %I64x\n", pNext, pPrev );
  2866. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, TimeStamp, tmp1);
  2867. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, TransportInterface, tmp1);
  2868. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, ActiveSecurityContext, tmp1);
  2869. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, ReferenceCount, tmp1);
  2870. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, TransportInterface, tmp1);
  2871. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, LowestActiveSequence, tmp1);
  2872. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, LowestUnusedSequence, tmp1);
  2873. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, CurrentPduSize, tmp1);
  2874. PRINT_MEMBER(qwAddr, DG_COMMON_CONNECTION, RPCRT4!DG_COMMON_CONNECTION, RemoteWindowSize, tmp1);
  2875. }
  2876. VOID
  2877. do_dgcn(
  2878. ULONG64 qwAddr
  2879. )
  2880. {
  2881. ULONG64 tmp1;
  2882. ULONG tmp2;
  2883. do_dgccn(qwAddr);
  2884. dprintf("\nclient:\n");
  2885. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, ActiveCallHead, tmp1);
  2886. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, CurrentCall, tmp1);
  2887. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, ActiveCallTail, tmp1);
  2888. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, CachedCalls, tmp1);
  2889. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, CachedCallCount, tmp1);
  2890. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, ThreadId, tmp1);
  2891. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, BindingHandle, tmp1);
  2892. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, ServerResponded, tmp1);
  2893. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, CallbackCompleted, tmp1);
  2894. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, fServerSupportsAsync, tmp1);
  2895. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, fSecurePacketReceived, tmp1);
  2896. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, fBusy, tmp1);
  2897. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, InConnectionTable, tmp1);
  2898. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, AckPending, tmp1);
  2899. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, AckOrphaned, tmp1);
  2900. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, PossiblyRunDown, tmp1);
  2901. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, fAutoReconnect,tmp1);
  2902. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, Association, tmp1);
  2903. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, AssociationKey, tmp1);
  2904. PRINT_ADDRESS_OF(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, AuthInfo, tmp2);
  2905. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, SecurityContextId, tmp1);
  2906. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, TimeStamp, tmp1);
  2907. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, LastScavengeTime, tmp1);
  2908. PRINT_ADDRESS_OF(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, DelayedAckTimer, tmp2);
  2909. PRINT_MEMBER(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, Next, tmp1);
  2910. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, fError, tmp1);
  2911. PRINT_ADDRESS_OF(qwAddr, DG_CCONNECTION, RPCRT4!DG_CCONNECTION, Mutex, tmp2);
  2912. }
  2913. char *
  2914. CallbackState(
  2915. DG_SCONNECTION::CALLBACK_STATE State
  2916. )
  2917. {
  2918. switch (State)
  2919. {
  2920. case DG_SCONNECTION::NoCallbackAttempted: return "NoCallbackAttempted";
  2921. case DG_SCONNECTION::SetupInProgress: return "SetupInProgress";
  2922. case DG_SCONNECTION::MsConvWayAuthInProgress:return "MsConvWayAuthInProgress";
  2923. case DG_SCONNECTION:: ConvWayAuthInProgress:return " ConvWayAuthInProgress";
  2924. case DG_SCONNECTION::MsConvWay2InProgress: return "MsConvWay2InProgress";
  2925. case DG_SCONNECTION:: ConvWay2InProgress: return " ConvWay2InProgress";
  2926. case DG_SCONNECTION:: ConvWayInProgress: return " ConvWayInProgress";
  2927. case DG_SCONNECTION::CallbackSucceeded: return "CallbackSucceeded";
  2928. case DG_SCONNECTION::CallbackFailed: return "CallbackFailed";
  2929. default:
  2930. {
  2931. static char scratch[40];
  2932. sprintf(scratch, "0x%lx", State);
  2933. return scratch;
  2934. }
  2935. }
  2936. }
  2937. VOID
  2938. do_dgsn(
  2939. ULONG64 qwAddr
  2940. )
  2941. {
  2942. ULONG64 tmp1;
  2943. ULONG tmp2;
  2944. do_dgccn(qwAddr);
  2945. dprintf("\nserver:\n");
  2946. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, ActiveCalls, tmp1);
  2947. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, CurrentCall, tmp1);
  2948. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, CachedCalls, tmp1);
  2949. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, pAddress, tmp1);
  2950. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, LastInterface, tmp1);
  2951. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, pAssocGroup, tmp1);
  2952. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, Next, tmp1);
  2953. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, ActivityHint, tmp1);
  2954. PRINT_ADDRESS_OF(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, AuthInfo, tmp2);
  2955. PRINT_MEMBER(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, MaxKeySeq, tmp1);
  2956. PRINT_ADDRESS_OF(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, SecurityContextDict, tmp2);
  2957. PRINT_ADDRESS_OF(qwAddr, DG_SCONNECTION, RPCRT4!DG_SCONNECTION, Callback, tmp2);
  2958. if (!fUseTypeInfo) {
  2959. uchar buff[sizeof(DG_SCONNECTION)];
  2960. GetData(qwAddr, buff, sizeof(DG_SCONNECTION));
  2961. DG_SCONNECTION * cn = (DG_SCONNECTION *) buff;
  2962. dprintf( "\n"
  2963. " status %-8lx binding %p datarep %-8lx \n"
  2964. " scall %p client seq %-8lx \n"
  2965. "\n"
  2966. " token buffer %p token len %-8lx async state offset %x \n"
  2967. " response buf %p response len %-8lx ThirdLegNeeded %s\n"
  2968. " sec cxt %p credentials %p ksno %-8lx \n"
  2969. " data index %-8lx \n",
  2970. cn->Callback.Status, cn->Callback.Binding, cn->Callback.DataRep,
  2971. cn->Callback.Call, cn->Callback.ClientSequence,
  2972. cn->Callback.TokenBuffer, cn->Callback.TokenLength, offsetof(DG_SCONNECTION, Callback.AsyncState),
  2973. cn->Callback.ResponseBuffer, cn->Callback.ResponseLength, BoolString(cn->Callback.ThirdLegNeeded),
  2974. cn->Callback.SecurityContext, cn->Callback.Credentials, cn->Callback.KeySequence,
  2975. cn->Callback.DataIndex
  2976. );
  2977. }
  2978. }
  2979. VOID
  2980. do_dgca(
  2981. ULONG64 qwAddr
  2982. )
  2983. {
  2984. ULONG64 tmp1;
  2985. ULONG tmp2;
  2986. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ReferenceCount, tmp1);
  2987. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, BindingHandleReferences, tmp1);
  2988. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, InternalTableIndex, tmp1);
  2989. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, LastScavengeTime, tmp1);
  2990. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, CurrentPduSize, tmp1);
  2991. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, RemoteWindowSize, tmp1);
  2992. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, TransportInterface, tmp1);
  2993. dprintf("\n");
  2994. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ServerAddress, tmp1);
  2995. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ServerBootTime, tmp1);
  2996. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ServerDataRep, tmp1);
  2997. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, AssociationFlag, tmp1);
  2998. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, fServerSupportsAsync, tmp1);
  2999. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, fLoneBindingHandle, tmp1);
  3000. PRINT_MEMBER_BOOLEAN(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, fErrorFlag, tmp1);
  3001. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, LastReceiveTime, tmp1);
  3002. PRINT_ADDRESS_OF(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, Mutex, tmp2);
  3003. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ResolvedEndpoint, tmp1);
  3004. PRINT_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, KeepAliveHandle, tmp1);
  3005. PRINT_ADDRESS_OF(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, ActiveConnections, tmp2);
  3006. PRINT_ADDRESS_OF(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, InactiveConnections, tmp2);
  3007. PRINT_ADDRESS_OF(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, InterfaceAndObjectDict, tmp2);
  3008. ULONG64 pDceBinding;
  3009. GET_MEMBER(qwAddr, DG_CASSOCIATION, RPCRT4!DG_CASSOCIATION, pDceBinding, pDceBinding);
  3010. dprintf("DCE_BINDING:\n");
  3011. do_dcebinding(pDceBinding);
  3012. }
  3013. VOID
  3014. do_dgsc(
  3015. ULONG64 qwAddr
  3016. )
  3017. {
  3018. ULONG64 tmp1;
  3019. ULONG tmp2;
  3020. dprintf("\n");
  3021. ULONG64 State;
  3022. GET_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, State, State);
  3023. dprintf("state - %-14s\n", ServerState((DG_SCALL::CALL_STATE)State));
  3024. ULONG64 PreviousState;
  3025. GET_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, PreviousState, PreviousState);
  3026. dprintf("prev state - %-14s\n", ServerState((DG_SCALL::CALL_STATE)State));
  3027. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, TimeStamp, tmp1);
  3028. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, DispatchBuffer, tmp1);
  3029. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, AsyncStatus, tmp1);
  3030. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, pAsync, tmp1);
  3031. ULONG64 PipeWaitType;
  3032. GET_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, PipeWaitType, PipeWaitType);
  3033. dprintf("pipe op - %-10s\n", PipeOp((PENDING_OPERATION)PipeWaitType));
  3034. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, PipeWaitLength, tmp1);
  3035. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, PipeThreadId, tmp1);
  3036. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, Previous, tmp1);
  3037. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, Next, tmp1);
  3038. PRINT_MEMBER_BOOLEAN(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, CallInProgress, tmp1);
  3039. PRINT_MEMBER_BOOLEAN(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, CallWasForwarded, tmp1);
  3040. PRINT_MEMBER_BOOLEAN(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, KnowClientAddress, tmp1);
  3041. PRINT_MEMBER_BOOLEAN(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, TerminateWhenConvenient, tmp1);
  3042. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, AuthorizationService, tmp1);
  3043. PRINT_MEMBER(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, Privileges, tmp1);
  3044. dprintf("\n");
  3045. ULONG64 ActivityHint;
  3046. GET_ADDRESS_OF(qwAddr, DG_SCALL, RPCRT4!DG_SCALL, ActivityHint, ActivityHint, tmp2);
  3047. do_dgpe(ActivityHint-AddressSize);
  3048. }
  3049. VOID
  3050. do_dgag(
  3051. ULONG64 qwAddr
  3052. )
  3053. {
  3054. ULONG64 tmp1;
  3055. ULONG tmp2;
  3056. ULONG64 Node;
  3057. GET_ADDRESS_OF(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, Node, Node, tmp2);
  3058. ULONG64 Uuid;
  3059. GET_ADDRESS_OF(Node, UUID_HASH_TABLE_NODE, UUID_HASH_TABLE_NODE, Uuid, Uuid, tmp2);
  3060. dprintf("\n"
  3061. " CAG UUID: "); PrintUuid(Uuid);
  3062. ULONG64 ReferenceCount;
  3063. ULONG64 CurrentPduSize;
  3064. ULONG64 RemoteWindowSize;
  3065. ULONG64 AssociationID;
  3066. ULONG64 CtxCollection;
  3067. ULONG64 MutexAddr;
  3068. GET_MEMBER(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, ReferenceCount, ReferenceCount);
  3069. GET_MEMBER(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, CurrentPduSize, CurrentPduSize);
  3070. GET_MEMBER(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, RemoteWindowSize, RemoteWindowSize);
  3071. GET_MEMBER(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, AssociationID, AssociationID);
  3072. GET_MEMBER(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, CtxCollection, CtxCollection);
  3073. GET_ADDRESS_OF(qwAddr, ASSOCIATION_GROUP, RPCRT4!ASSOCIATION_GROUP, Mutex, MutexAddr, tmp2);
  3074. dprintf(" \n"
  3075. " refs: %8.8x mutex at %p \n"
  3076. " pdu length: %8.8x assoc ID: %x \n"
  3077. " send window %8.8x CtxColl : %I64p \n",
  3078. (ULONG)ReferenceCount, MutexAddr,
  3079. (ULONG)CurrentPduSize, (ULONG)AssociationID,
  3080. (ULONG)RemoteWindowSize, CtxCollection);
  3081. }
  3082. // Do some arm twisting to include pipendr.h and asyncndr.
  3083. #define _NEWINTRP_
  3084. typedef unsigned char uchar;
  3085. typedef unsigned short ushort;
  3086. typedef unsigned long ulong;
  3087. typedef unsigned int uint;
  3088. #include "..\..\ndr20\pipendr.h"
  3089. typedef void IAsyncManager;
  3090. #define MAX_CONTEXT_HNDL_NUMBER 8
  3091. #include "..\..\ndr20\mulsyntx.h"
  3092. #include "..\..\ndr20\asyncndr.h"
  3093. char *
  3094. PipeState(
  3095. int State
  3096. )
  3097. {
  3098. static char buf[40];
  3099. if (State <= 3)
  3100. {
  3101. return ReceiveStates[State];
  3102. }
  3103. sprintf(buf, "0x%x", State);
  3104. return buf;
  3105. }
  3106. char *
  3107. PipeFlags(
  3108. unsigned short Flags
  3109. )
  3110. {
  3111. static char buf[80];
  3112. buf[0] = 0;
  3113. if (Flags & NDR_IN_PIPE)
  3114. {
  3115. strcat(buf, "I ");
  3116. }
  3117. if (Flags & NDR_OUT_PIPE)
  3118. {
  3119. strcat(buf, "O ");
  3120. }
  3121. if (Flags & NDR_LAST_IN_PIPE)
  3122. {
  3123. strcat(buf, "LI ");
  3124. }
  3125. if (Flags & NDR_LAST_OUT_PIPE)
  3126. {
  3127. strcat(buf, "LO ");
  3128. }
  3129. if (Flags & NDR_OUT_ALLOCED)
  3130. {
  3131. strcat(buf, "ALLOC ");
  3132. }
  3133. if (Flags & 0xffe0)
  3134. {
  3135. char Excess[10];
  3136. sprintf(Excess, "%hx ", Flags & 0xffe0);
  3137. strcat(buf, Excess);
  3138. }
  3139. return buf;
  3140. }
  3141. char *
  3142. PipeStatusStrings[] =
  3143. {
  3144. "QUIET",
  3145. "IN",
  3146. "OUT",
  3147. "DRAIN"
  3148. };
  3149. char *
  3150. PipeStatus(
  3151. unsigned short Status
  3152. )
  3153. {
  3154. static char buf[40];
  3155. if (Status <= 3)
  3156. {
  3157. return PipeStatusStrings[Status];
  3158. }
  3159. sprintf(buf, "0x%x", Status);
  3160. return buf;
  3161. }
  3162. void
  3163. do_pipestate(
  3164. ULONG64 qwAddr
  3165. )
  3166. {
  3167. ULONG64 ElemsInChunk;
  3168. ULONG64 ElemAlign;
  3169. ULONG64 ElemWireSize;
  3170. ULONG64 ElemMemSize;
  3171. ULONG64 PartialBufferSize;
  3172. ULONG64 PartialElem;
  3173. ULONG64 PartialElemSize;
  3174. ULONG64 PartialOffset;
  3175. ULONG64 CurrentState;
  3176. ULONG64 EndOfPipe;
  3177. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, ElemsInChunk, ElemsInChunk);
  3178. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, ElemAlign, ElemAlign);
  3179. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, ElemWireSize, ElemWireSize);
  3180. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, ElemMemSize, ElemMemSize);
  3181. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, PartialBufferSize, PartialBufferSize);
  3182. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, PartialElem, PartialElem);
  3183. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, PartialElemSize, PartialElemSize);
  3184. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, PartialOffset, PartialOffset);
  3185. GET_MEMBER(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, CurrentState, CurrentState);
  3186. ULONG tmp2;
  3187. GET_ADDRESS_OF(qwAddr, NDR_PIPE_STATE, RPCRT4!NDR_PIPE_STATE, PartialOffset, EndOfPipe, tmp2);
  3188. EndOfPipe += 4;
  3189. dprintf("\n");
  3190. dprintf(" elems in chunk %8lx partial buf size %8lx state %s\n",
  3191. (ULONG)ElemsInChunk, (ULONG)PartialBufferSize, PipeState((ULONG)CurrentState) );
  3192. dprintf(" elem align %8lx partial element %8lx end of pipe bits %I64x\n",
  3193. (ULONG)ElemAlign, (ULONG)PartialElem, EndOfPipe );
  3194. dprintf(" elem wire size %8lx partial elem size %8lx \n",
  3195. (ULONG)ElemWireSize, (ULONG)PartialElemSize );
  3196. dprintf(" elem mem size %8lx partial offset %8lx \n",
  3197. (ULONG)ElemMemSize, (ULONG)PartialOffset );
  3198. }
  3199. void
  3200. do_pipedesc(
  3201. ULONG64 qwAddr
  3202. )
  3203. {
  3204. ULONG64 tmp1;
  3205. ULONG tmp2;
  3206. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, CurrentPipe, tmp1);
  3207. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, InPipes, tmp1);
  3208. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, OutPipes, tmp1);
  3209. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, TotalPipes, tmp1);
  3210. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, Flags, tmp1);
  3211. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, PipeVersion, tmp1);
  3212. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, pPipeMsg, tmp1);
  3213. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, DispatchBuffer, tmp1);
  3214. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, ChainingBuffer, tmp1);
  3215. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, DispatchBufferLength, tmp1);
  3216. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, ChainingBufferSize, tmp1);
  3217. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, LastPartialBuffer, tmp1);
  3218. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, BufferSave, tmp1);
  3219. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, LastPartialSize, tmp1);
  3220. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, LengthSave, tmp1);
  3221. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, LeftoverSize, tmp1);
  3222. PRINT_MEMBER(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, RuntimeState, tmp1);
  3223. PRINT_ADDRESS_OF(qwAddr, NDR_PIPE_DESC, RPCRT4!NDR_PIPE_DESC, Leftover, tmp2);
  3224. do_pipestate(tmp1);
  3225. }
  3226. void
  3227. do_pipearg(
  3228. ULONG64 qwAddr
  3229. )
  3230. {
  3231. ULONG64 tmp1;
  3232. dprintf("\n");
  3233. PRINT_MEMBER(qwAddr, GENERIC_PIPE_TYPE, RPCRT4!GENERIC_PIPE_TYPE, pfnPull, tmp1);
  3234. PRINT_MEMBER(qwAddr, GENERIC_PIPE_TYPE, RPCRT4!GENERIC_PIPE_TYPE, pfnPush, tmp1);
  3235. PRINT_MEMBER(qwAddr, GENERIC_PIPE_TYPE, RPCRT4!GENERIC_PIPE_TYPE, pfnAlloc, tmp1);
  3236. PRINT_MEMBER(qwAddr, GENERIC_PIPE_TYPE, RPCRT4!GENERIC_PIPE_TYPE, pState, tmp1);
  3237. }
  3238. void
  3239. do_pipemsg(
  3240. ULONG64 qwAddr
  3241. )
  3242. {
  3243. ULONG64 tmp1;
  3244. ULONG tmp2;
  3245. dprintf("\n");
  3246. PRINT_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, Signature, tmp1);
  3247. PRINT_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, PipeId, tmp1);
  3248. PRINT_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, pPipeObject, tmp1);
  3249. ULONG64 pPipeObject = tmp1;
  3250. PRINT_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, pStubMsg, tmp1);
  3251. PRINT_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, pTypeFormat, tmp1);
  3252. ULONG64 PipeStatusVal;
  3253. ULONG64 PipeFlagsVal;
  3254. GET_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, PipeStatus, PipeStatusVal);
  3255. GET_MEMBER(qwAddr, NDR_PIPE_MESSAGE, RPCRT4!NDR_PIPE_MESSAGE, PipeFlags, PipeFlagsVal);
  3256. dprintf("pipe status %5s\n", PipeStatus((unsigned short)PipeStatusVal));
  3257. dprintf("pipe flags %s\n", PipeFlags((unsigned short)PipeStatusVal));
  3258. do_pipearg(pPipeObject );
  3259. }
  3260. void
  3261. async_flags(
  3262. NDR_ASYNC_CALL_FLAGS flags
  3263. )
  3264. {
  3265. dprintf(" flags %4x: ", *(unsigned short *)&flags );
  3266. if ( flags.ValidCallPending )
  3267. dprintf(" call pending, " );
  3268. if ( flags.ErrorPending )
  3269. dprintf(" err pending, " );
  3270. if ( flags.BadStubData )
  3271. dprintf(" BSD, " );
  3272. if ( flags.RuntimeCleanedUp )
  3273. dprintf(" rt cleaned, " );
  3274. if ( flags.HandlelessObjCall )
  3275. dprintf(" autocomplete, " );
  3276. if ( flags.Unused )
  3277. dprintf(" Unused %4x ", flags.Unused );
  3278. dprintf("-\n" );
  3279. }
  3280. char * AsyncPhaseString[5] =
  3281. {
  3282. "zero",
  3283. "prep : initialized",
  3284. "set : (cl) after get buffer and ( cl | srv) register call",
  3285. "call : cl after marshaling, calling send",
  3286. "error : exception taken"
  3287. };
  3288. void
  3289. async_stub_phase(
  3290. unsigned short phase
  3291. )
  3292. {
  3293. dprintf(" phase %4x: ", phase );
  3294. if ( 0 <= phase && phase < 5 )
  3295. dprintf(" %s\n", AsyncPhaseString[ phase ] );
  3296. else
  3297. dprintf(" unknown??\n" );
  3298. }
  3299. typedef struct _NDR_ASYNC_OBJ_HANDLE
  3300. {
  3301. void * pIAMvtble;
  3302. void * pICMvtble;
  3303. NDR_ASYNC_MESSAGE * _pAsyncMsg;
  3304. unsigned long _Lock;
  3305. unsigned long _Signature;
  3306. GUID _iid;
  3307. void * _InnerUnknown;
  3308. unsigned long _iRef;
  3309. void * _pParent;
  3310. void * _pControl;
  3311. void * _pSyncInner;
  3312. unsigned long _fAutoComplete;
  3313. } NDR_ASYNC_OBJ_HANDLE;
  3314. void
  3315. do_asyncdcom(
  3316. ULONG64 qwAddr
  3317. )
  3318. {
  3319. if (fUseTypeInfo) {
  3320. dprintf("Can't dump NDR_ASYNC_OBJ_HANDLE when using type info\n");
  3321. }
  3322. else {
  3323. BOOL b;
  3324. char block[sizeof(NDR_ASYNC_OBJ_HANDLE)];
  3325. b = GetData(qwAddr, block, sizeof(block));
  3326. if ( !b ) {
  3327. dprintf("can't read %p\n", qwAddr);
  3328. return;
  3329. }
  3330. NDR_ASYNC_OBJ_HANDLE * msg = (NDR_ASYNC_OBJ_HANDLE *) block;
  3331. dprintf("\n");
  3332. dprintf(" pIAMvtble %p pICMvtble %p asyncmsg %p lock %8lx\n",
  3333. msg->pIAMvtble, msg->pICMvtble, msg->_pAsyncMsg, msg->_Lock );
  3334. dprintf(" innerpUnk %p iref %8lx pParent %p pControl %p\n",
  3335. msg->_InnerUnknown,msg->_iRef, msg->_pParent,msg->_pControl );
  3336. dprintf(" Signature %8lx iid ", msg->_Signature ); PrintUuidLocal( & msg->_iid );dprintf("\n");
  3337. dprintf(" innerSync %p autocompl %d\n",
  3338. msg->_pSyncInner,msg->_fAutoComplete );
  3339. }
  3340. }
  3341. void
  3342. do_asyncrpc(
  3343. ULONG64 qwAddr
  3344. )
  3345. {
  3346. ULONG64 tmp1;
  3347. dprintf("\n");
  3348. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Size, tmp1);
  3349. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Signature, tmp1);
  3350. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Lock, tmp1);
  3351. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, Flags, tmp1);
  3352. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, StubInfo, tmp1);
  3353. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, UserInfo, tmp1);
  3354. PRINT_MEMBER(qwAddr, RPC_ASYNC_STATE, RPCRT4!RPC_ASYNC_STATE, RuntimeInfo, tmp1);
  3355. }
  3356. void
  3357. do_asyncmsg(
  3358. ULONG64 qwAddr
  3359. )
  3360. {
  3361. ULONG64 tmp1;
  3362. ULONG tmp2;
  3363. dprintf("\n");
  3364. PRINT_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, Signature, tmp1);
  3365. PRINT_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, Version, tmp1);
  3366. PRINT_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, AsyncHandle, tmp1);
  3367. PRINT_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, ProcContext, tmp1);
  3368. ULONG64 Flags;
  3369. GET_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, Flags, Flags);
  3370. async_flags( *((NDR_ASYNC_CALL_FLAGS*)&Flags) );
  3371. ULONG64 StubPhase;
  3372. GET_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, StubPhase, StubPhase);
  3373. async_stub_phase( (unsigned short) StubPhase );
  3374. ULONG64 StubMsg;
  3375. GET_MEMBER(qwAddr, NDR_ASYNC_MESSAGE, RPCRT4!NDR_ASYNC_MESSAGE, StubMsg, StubMsg);
  3376. do_stubmsg( StubMsg );
  3377. }
  3378. //
  3379. // Datagram stuff
  3380. //
  3381. char * PacketFlagStrings[8] =
  3382. {
  3383. "forwarded ",
  3384. "lastfrag ",
  3385. "frag ",
  3386. "nofack ",
  3387. "maybe ",
  3388. "idem ",
  3389. "broadcast ",
  3390. "flags-0x80 "
  3391. };
  3392. char * PacketFlag2Strings[8] =
  3393. {
  3394. "fragmented ",
  3395. "cancel-pending ",
  3396. "flags2-0x04 ",
  3397. "flags2-0x08 ",
  3398. "flags2-0x10 ",
  3399. "flags2-0x20 ",
  3400. "flags2-0x40 ",
  3401. "flags2-0x80 "
  3402. };
  3403. char *
  3404. PrintPacketFlags(
  3405. unsigned char PacketFlags1,
  3406. unsigned char PacketFlags2
  3407. )
  3408. {
  3409. static char buf[160];
  3410. unsigned char Flags;
  3411. unsigned i;
  3412. buf[0] = 0;
  3413. Flags = PacketFlags1;
  3414. for (i=0; i < 8; i++)
  3415. {
  3416. if (Flags & 1)
  3417. {
  3418. strcat(buf, PacketFlagStrings[i]);
  3419. }
  3420. Flags >>= 1;
  3421. }
  3422. Flags = PacketFlags2;
  3423. for (i=0; i < 8; i++)
  3424. {
  3425. if (Flags & 1)
  3426. {
  3427. strcat(buf, PacketFlag2Strings[i]);
  3428. }
  3429. Flags >>= 1;
  3430. }
  3431. return buf;
  3432. }
  3433. char * PacketTypes[] =
  3434. {
  3435. "REQ ",
  3436. "PING",
  3437. "RESP",
  3438. "FLT ",
  3439. "WORK",
  3440. "NOCA",
  3441. "REJ ",
  3442. "ACK ",
  3443. "QUIT",
  3444. "FACK",
  3445. "QACK"
  3446. };
  3447. char *
  3448. PrintPacketType(
  3449. unsigned char PacketType
  3450. )
  3451. {
  3452. static char buf[40];
  3453. if (PacketType < sizeof(PacketTypes)/sizeof(PacketTypes[0]))
  3454. {
  3455. return PacketTypes[PacketType];
  3456. }
  3457. sprintf(buf, "illegal packet type %x ", PacketType);
  3458. return buf;
  3459. }
  3460. VOID
  3461. do_dgpkt(
  3462. ULONG64 p
  3463. )
  3464. {
  3465. ULONG64 tmp1;
  3466. ULONG tmp2;
  3467. dprintf("\n");
  3468. PRINT_MEMBER(p, DG_PACKET, RPCRT4!DG_PACKET, MaxDataLength, tmp1);
  3469. PRINT_MEMBER(p, DG_PACKET, RPCRT4!DG_PACKET, TimeReceived, tmp1);
  3470. PRINT_MEMBER(p, DG_PACKET, RPCRT4!DG_PACKET, DataLength, tmp1);
  3471. PRINT_MEMBER(p, DG_PACKET, RPCRT4!DG_PACKET, pNext, tmp1);
  3472. PRINT_MEMBER(p, DG_PACKET, RPCRT4!DG_PACKET, pPrevious, tmp1);
  3473. ULONG64 Header;
  3474. GET_ADDRESS_OF(p, DG_PACKET, RPCRT4!DG_PACKET, Header, Header, tmp2);
  3475. do_dgpkthdr(Header);
  3476. }
  3477. VOID
  3478. do_dgpkthdr(
  3479. ULONG64 h
  3480. )
  3481. {
  3482. ULONG64 tmp1;
  3483. ULONG tmp2;
  3484. dprintf("\n");
  3485. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, PacketType, tmp1);
  3486. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, RpcVersion, tmp1);
  3487. ULONG64 PacketFlags;
  3488. ULONG64 PacketFlags2;
  3489. GET_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, PacketFlags, PacketFlags);
  3490. GET_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, PacketFlags2, PacketFlags2);
  3491. dprintf("flags: %s\n", PrintPacketFlags((unsigned char)PacketFlags, (unsigned char)PacketFlags2));
  3492. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, FragmentNumber, tmp1);
  3493. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, PacketBodyLen, tmp1);
  3494. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, SerialLo, tmp1);
  3495. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, DataRep, tmp1);
  3496. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, ServerBootTime, tmp1);
  3497. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, AuthProto, tmp1);
  3498. dprintf(" activity ");
  3499. ULONG64 ActivityId;
  3500. GET_ADDRESS_OF(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, ActivityId, ActivityId, tmp2);
  3501. PrintUuid(ActivityId);
  3502. dprintf("\n");
  3503. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, ActivityHint, tmp1);
  3504. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, SequenceNumber, tmp1);
  3505. dprintf(" interface ");
  3506. ULONG64 InterfaceId;
  3507. GET_ADDRESS_OF(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, InterfaceId, InterfaceId, tmp2);
  3508. PrintUuid(InterfaceId);
  3509. dprintf("\n");
  3510. ULONG64 InterfaceVersion;
  3511. GET_ADDRESS_OF(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, InterfaceVersion, InterfaceVersion, tmp2);
  3512. PRINT_MEMBER(h, _RPC_VERSION, RPCRT4!_RPC_VERSION, MajorVersion, tmp1);
  3513. PRINT_MEMBER(h, _RPC_VERSION, RPCRT4!_RPC_VERSION, MinorVersion, tmp1);
  3514. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, InterfaceHint, tmp1);
  3515. PRINT_MEMBER(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, OperationNumber, tmp1);
  3516. PRINT_ADDRESS_OF(h, _NCA_PACKET_HEADER, RPCRT4!_NCA_PACKET_HEADER, ObjectId, tmp2);
  3517. dprintf("\n");
  3518. }
  3519. void
  3520. do_assoctable(
  3521. ULONG64 qwAddr
  3522. )
  3523. {
  3524. ULONG64 tmp1;
  3525. ULONG tmp2;
  3526. dprintf("DG_ASSOCIATION_TABLE at 0x%I64x:\n", qwAddr);
  3527. ULONG64 CasUuid;
  3528. ULONG64 fCasUuidReady;
  3529. GET_MEMBER(qwAddr, DG_ASSOCIATION_TABLE, RPCRT4!DG_ASSOCIATION_TABLE, CasUuid, CasUuid);
  3530. GET_MEMBER(qwAddr, DG_ASSOCIATION_TABLE, RPCRT4!DG_ASSOCIATION_TABLE, fCasUuidReady, fCasUuidReady);
  3531. dprintf(" CAS: "); PrintUuid( CasUuid );
  3532. dprintf(", %svalid\n", (ULONG)fCasUuidReady ? "" : "not ");
  3533. dprintf("\n");
  3534. PRINT_ADDRESS_OF_WITH_LABEL(qwAddr, DG_ASSOCIATION_TABLE, RPCRT4!DG_ASSOCIATION_TABLE, Mutex, "&Mutex (CSharedLock)", tmp2);
  3535. ULONG64 Associations;
  3536. ULONG64 AssociationsLength;
  3537. GET_MEMBER(qwAddr, DG_ASSOCIATION_TABLE, RPCRT4!DG_ASSOCIATION_TABLE, Associations, Associations);
  3538. GET_MEMBER(qwAddr, DG_ASSOCIATION_TABLE, RPCRT4!DG_ASSOCIATION_TABLE, AssociationsLength, AssociationsLength);
  3539. dprintf("association array at 0x%I64x, %x elements\n", Associations, AssociationsLength);
  3540. }
  3541. char *
  3542. strtok(
  3543. char *String
  3544. )
  3545. {
  3546. char * Word;
  3547. static char * End;
  3548. if (String)
  3549. {
  3550. Word = String;
  3551. }
  3552. else if (!End)
  3553. {
  3554. return 0;
  3555. }
  3556. else
  3557. {
  3558. Word = End+1;
  3559. }
  3560. while (*Word == ' ' || *Word == '\t')
  3561. {
  3562. ++Word;
  3563. }
  3564. if (!*Word)
  3565. {
  3566. End = 0;
  3567. return 0;
  3568. }
  3569. End = Word;
  3570. while (*End && *End != ' ' && *End != '\t')
  3571. {
  3572. ++End;
  3573. }
  3574. if (!*End)
  3575. {
  3576. End = 0;
  3577. }
  3578. else
  3579. {
  3580. *End = 0;
  3581. }
  3582. return Word;
  3583. }
  3584. BOOL
  3585. IsMember(
  3586. char Item,
  3587. char * List
  3588. )
  3589. {
  3590. BOOL Mask = FALSE;
  3591. if (List[0] == '~')
  3592. {
  3593. Mask = TRUE;
  3594. }
  3595. while (*List)
  3596. {
  3597. if (Item == *List)
  3598. {
  3599. return TRUE ^ Mask;
  3600. }
  3601. ++List;
  3602. }
  3603. return FALSE ^ Mask;
  3604. }
  3605. BOOL
  3606. FetchEvent(
  3607. IN ULONG_PTR RpcEvents,
  3608. IN unsigned Index,
  3609. IN struct RPC_EVENT * Entry
  3610. )
  3611. {
  3612. return GetData(RpcEvents + Index * sizeof(struct RPC_EVENT), Entry, sizeof(struct RPC_EVENT));
  3613. }
  3614. BOOL
  3615. FetchEventAddress(
  3616. IN ULONG64 RpcEvents,
  3617. IN int Index,
  3618. IN PULONG64 EntryAddress
  3619. )
  3620. {
  3621. static ULONG EntrySize = 0;
  3622. if (EntrySize == 0) {
  3623. EntrySize = GetTypeSize("RPCRT4!RPC_EVENT");
  3624. if (EntrySize == 0) {
  3625. return FALSE;
  3626. }
  3627. }
  3628. *EntryAddress = RpcEvents + Index * EntrySize;
  3629. return TRUE;
  3630. }
  3631. BOOL
  3632. DoesEntryMatch(
  3633. IN struct RPC_EVENT * Entry,
  3634. IN char * Subjects,
  3635. IN char * verbs,
  3636. IN DWORD thread,
  3637. IN ULONG_PTR addr,
  3638. IN ULONG_PTR obj_addr
  3639. )
  3640. {
  3641. if (!Entry->Subject)
  3642. {
  3643. return FALSE;
  3644. }
  3645. if (Subjects && !IsMember(Entry->Subject, Subjects))
  3646. {
  3647. return FALSE;
  3648. }
  3649. if (verbs && !IsMember(Entry->Verb, verbs))
  3650. {
  3651. return FALSE;
  3652. }
  3653. if (thread && Entry->Thread != (unsigned short) thread)
  3654. {
  3655. return FALSE;
  3656. }
  3657. if (addr && Entry->SubjectPointer != (void *) addr)
  3658. {
  3659. return FALSE;
  3660. }
  3661. if (obj_addr && Entry->ObjectPointer != (void *) obj_addr)
  3662. {
  3663. return FALSE;
  3664. }
  3665. return TRUE;
  3666. }
  3667. BOOL
  3668. DoesEntryAddressMatch(
  3669. IN ULONG64 Entry,
  3670. IN char * Subjects,
  3671. IN char * verbs,
  3672. IN DWORD thread,
  3673. IN ULONG64 addr,
  3674. IN ULONG64 obj_addr
  3675. )
  3676. {
  3677. ULONG64 tmp;
  3678. char item;
  3679. GET_MEMBER_NORET_NOSPEW(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Subject, tmp);
  3680. if (!tmp)
  3681. {
  3682. return FALSE;
  3683. }
  3684. if (Subjects && !IsMember((char)tmp, Subjects))
  3685. {
  3686. return FALSE;
  3687. }
  3688. GET_MEMBER_NORET_NOSPEW(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Verb, tmp);
  3689. if (verbs && !IsMember((char)tmp, verbs))
  3690. {
  3691. return FALSE;
  3692. }
  3693. GET_MEMBER_NORET_NOSPEW(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Thread, tmp);
  3694. if (thread && tmp != (unsigned short) thread)
  3695. {
  3696. return FALSE;
  3697. }
  3698. GET_MEMBER_NORET_NOSPEW(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, SubjectPointer, tmp);
  3699. if (addr && tmp != addr)
  3700. {
  3701. return FALSE;
  3702. }
  3703. GET_MEMBER_NORET_NOSPEW(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, ObjectPointer, tmp);
  3704. if (obj_addr && tmp != obj_addr)
  3705. {
  3706. return FALSE;
  3707. }
  3708. return TRUE;
  3709. }
  3710. char * DgPacketTypes[] =
  3711. {
  3712. "REQ",
  3713. "PING",
  3714. "RESP",
  3715. "FAULT",
  3716. "WORKING",
  3717. "NOCALL",
  3718. "REJECT",
  3719. "ACK",
  3720. "QUIT",
  3721. "FACK",
  3722. "QUACK",
  3723. "BIND",
  3724. "BIND-ACK",
  3725. "BIND_NAK",
  3726. "ALTER-CXT",
  3727. "ALTER-RESP",
  3728. "AUTH-3",
  3729. "SHUTDOWN",
  3730. "CANCEL",
  3731. "ORPHAN"
  3732. };
  3733. char * ScallStates[] =
  3734. {
  3735. "Init",
  3736. "BeforeDispatch",
  3737. "Dispatched",
  3738. "DispatchedWithCompleteData",
  3739. "AfterDispatch",
  3740. "SendingResponse",
  3741. "Complete"
  3742. };
  3743. char * CcallStates[] =
  3744. {
  3745. "Init",
  3746. "Quiescent",
  3747. "Send",
  3748. "SendReceive",
  3749. "Receive",
  3750. "CancellingSend",
  3751. "Complete"
  3752. };
  3753. char * HandleTypeStrings[] =
  3754. {
  3755. "wmsg_cas ",
  3756. "wmsg_handle ",
  3757. "dg_ccall ",
  3758. "dg_scall ",
  3759. "dg_binding ",
  3760. "osf_ccall ",
  3761. "osf_scall ",
  3762. "osf_cconn ",
  3763. "osf_sconn ",
  3764. "osf_cassoc ",
  3765. "osf_assoc ",
  3766. "osf_address ",
  3767. "lrpc_ccall ",
  3768. "lrpc_scall ",
  3769. "lrpc_cassoc ",
  3770. "lrpc_sassoc ",
  3771. "lrpc_binding ",
  3772. "svr_binding ",
  3773. "dg_cconn ",
  3774. "dg_sconn ",
  3775. "osf_binding ",
  3776. "dg_callback ",
  3777. "dg_address ",
  3778. "lrpc_address ",
  3779. "dg_assoc "
  3780. };
  3781. char *
  3782. GetHandleType(
  3783. void * Value
  3784. )
  3785. {
  3786. int i;
  3787. for (i=0; i < sizeof(HandleTypeStrings)/sizeof(char *); ++i)
  3788. {
  3789. if ((1UL << i) == PtrToUlong(Value))
  3790. {
  3791. return HandleTypeStrings[i];
  3792. }
  3793. }
  3794. static char scratch[40];
  3795. sprintf(scratch, "refobj %p", Value);
  3796. return scratch;
  3797. }
  3798. char *
  3799. GetHandleTypeAddr(
  3800. ULONG64 Pointer
  3801. )
  3802. {
  3803. int i;
  3804. for (i=0; i < sizeof(HandleTypeStrings)/sizeof(char *); ++i)
  3805. {
  3806. if ((1UL << i) == Pointer)
  3807. {
  3808. return HandleTypeStrings[i];
  3809. }
  3810. }
  3811. static char scratch[40];
  3812. sprintf(scratch, "refobj %.6x", Pointer);
  3813. return scratch;
  3814. }
  3815. int
  3816. PrintEntry(
  3817. IN struct RPC_EVENT * Entry,
  3818. IN ULONG index,
  3819. IN BOOL ShowStack
  3820. )
  3821. {
  3822. char * Subject;
  3823. char * Verb;
  3824. BOOL Printed = FALSE;
  3825. switch (Entry->Subject)
  3826. {
  3827. case SU_HANDLE : Subject = "binding "; break;
  3828. case SU_CCONN : Subject = "cconn "; break;
  3829. case SU_SCONN : Subject = "sconn "; break;
  3830. case SU_CASSOC : Subject = "cassoc "; break;
  3831. case SU_SASSOC : Subject = "sassoc "; break;
  3832. case SU_CCALL : Subject = "ccall "; break;
  3833. case SU_SCALL : Subject = "scall "; break;
  3834. case SU_PACKET : Subject = "packet "; break;
  3835. case SU_CENDPOINT: Subject = "endpnt "; break;
  3836. case SU_ENGINE : Subject = " call "; break;
  3837. case SU_ASSOC : Subject = " assoc "; break;
  3838. case SU_MUTEX : Subject = "mutex "; break;
  3839. case SU_STABLE : Subject = "sc tabl "; break;
  3840. case SU_BCACHE : Subject = "bcache "; break;
  3841. case SU_HEAP : Subject = "heap "; break;
  3842. case SU_THREAD : Subject = "thread "; break;
  3843. case SU_EVENT : Subject = "event "; break;
  3844. case SU_TRANS_CONN:Subject = "trans conn "; break;
  3845. case SU_ADDRESS : Subject = "address "; break;
  3846. case SU_EXCEPT : Subject = "exception "; break;
  3847. case SU_REFOBJ :
  3848. {
  3849. Subject = GetHandleType(Entry->ObjectPointer);
  3850. break;
  3851. }
  3852. case SU_CTXHANDLE: Subject = "ctx handle "; break;
  3853. default:
  3854. {
  3855. static char string[4];
  3856. Subject = string;
  3857. Subject[0] = '\"';
  3858. Subject[1] = Entry->Subject;
  3859. Subject[2] = '\"';
  3860. Subject[3] = '\0';
  3861. break;
  3862. }
  3863. }
  3864. dprintf("%5x: %06.6d.%03.3d/%-4x %s %p ", index, Entry->Time /1000, Entry->Time % 1000, Entry->Thread, Subject, Entry->SubjectPointer);
  3865. Verb = "(extension bug)";
  3866. switch (Entry->Verb)
  3867. {
  3868. case EV_CREATE : Verb = "create "; break;
  3869. case EV_DELETE : Verb = "delete "; break;
  3870. case EV_START : Verb = "active "; break;
  3871. case EV_STOP : Verb = "inactive "; break;
  3872. case EV_INC : Verb = "ref++ "; break;
  3873. case EV_DEC : Verb = "ref-- "; break;
  3874. case EV_ACK : Verb = "ack sent "; break;
  3875. case EV_NOTIFY : Verb = "notify "; break;
  3876. case EV_APC : Verb = "APC fired"; break;
  3877. case EV_RESOLVED : Verb = "resolved "; break;
  3878. case EV_REMOVED : Verb = "removed "; break;
  3879. case EV_CLEANUP : Verb = "cleanup "; break;
  3880. case EV_SEC_INIT1 : Verb = "init SC 1"; break;
  3881. case EV_SEC_INIT3 : Verb = "init SC 3"; break;
  3882. case EV_SEC_ACCEPT1 : Verb = "accptSC 1"; break;
  3883. case EV_SEC_ACCEPT3 : Verb = "accptSC 3"; break;
  3884. case EV_STATUS:
  3885. {
  3886. if (Entry->Subject != SU_EXCEPT)
  3887. {
  3888. if (Entry->ObjectPointer)
  3889. {
  3890. dprintf("status %lx, location %d", Entry->Data, Entry->ObjectPointer);
  3891. }
  3892. else
  3893. {
  3894. dprintf("status %lx", Entry->Data);
  3895. }
  3896. Printed = TRUE;
  3897. break;
  3898. }
  3899. else
  3900. {
  3901. dprintf("exception info: %lx, %lx, %lx", Entry->SubjectPointer, Entry->ObjectPointer, Entry->Data);
  3902. Printed = TRUE;
  3903. break;
  3904. }
  3905. }
  3906. case EV_DISASSOC : Verb = "disassoc "; break;
  3907. case EV_STATE:
  3908. {
  3909. char * state = "----";
  3910. if (Entry->Subject == SU_CCALL)
  3911. {
  3912. if (Entry->Data < DG_CCALL::CallInit ||
  3913. Entry->Data > DG_CCALL::CallComplete )
  3914. {
  3915. dprintf("unknown state 0x%x", Entry->Data);
  3916. Printed = TRUE;
  3917. }
  3918. else
  3919. {
  3920. state = CcallStates[Entry->Data - DG_CCALL::CallInit];
  3921. }
  3922. }
  3923. else
  3924. {
  3925. if (Entry->Data < DG_SCALL::CallInit ||
  3926. Entry->Data > DG_SCALL::CallComplete )
  3927. {
  3928. dprintf("unknown state 0x%x", Entry->Data);
  3929. Printed = TRUE;
  3930. }
  3931. else
  3932. {
  3933. state = ScallStates[Entry->Data - DG_SCALL::CallInit];
  3934. }
  3935. }
  3936. if (!Printed)
  3937. {
  3938. dprintf("state %s", state);
  3939. Printed = TRUE;
  3940. }
  3941. break;
  3942. }
  3943. case EV_POP : Verb = "pop "; break;
  3944. case EV_PUSH : Verb = "push "; break;
  3945. case EV_PKT_IN:
  3946. {
  3947. unsigned short frag = (unsigned short) (Entry->Data);
  3948. unsigned short ptype = (unsigned short) (Entry->Data >> 16);
  3949. char * ptypestring;
  3950. if (ptype >= sizeof(DgPacketTypes)/sizeof(DgPacketTypes[0]))
  3951. {
  3952. dprintf("recv pkt unknown type 0x%hx", ptype);
  3953. Printed = TRUE;
  3954. }
  3955. else
  3956. {
  3957. ptypestring = DgPacketTypes[ptype];
  3958. }
  3959. if (!Printed)
  3960. {
  3961. if (Entry->ObjectPointer)
  3962. {
  3963. dprintf("recv pkt %s frag %hx, location %d", ptypestring, frag, Entry->ObjectPointer);
  3964. }
  3965. else
  3966. {
  3967. dprintf("recv pkt %s frag/len %hx", ptypestring, frag);
  3968. }
  3969. Printed = TRUE;
  3970. }
  3971. break;
  3972. }
  3973. case EV_BUFFER_IN : Verb = "buf in"; break;
  3974. case EV_BUFFER_OUT: Verb = "buf out"; break;
  3975. case EV_TRANSFER: Verb = "xfer call"; break;
  3976. case EV_DROP: Verb = "dropped "; break;
  3977. case EV_DELAY: Verb = "delayed "; break;
  3978. case EV_CALLBACK: Verb = "callback "; break;
  3979. default:
  3980. {
  3981. static char string[4];
  3982. Verb = string;
  3983. Verb[0] = '\"';
  3984. Verb[1] = Entry->Verb;
  3985. Verb[2] = '\"';
  3986. Verb[3] = '\0';
  3987. break;
  3988. }
  3989. case 'p':
  3990. {
  3991. if (Entry->Subject == SU_STABLE)
  3992. {
  3993. Verb = "prune ";
  3994. }
  3995. else
  3996. {
  3997. DWORD buf[2];
  3998. buf[0] = (DWORD) Entry->Data;
  3999. buf[1] = 0;
  4000. dprintf("proc %s %p", (char *) buf, Entry->ObjectPointer);
  4001. Printed = TRUE;
  4002. }
  4003. break;
  4004. }
  4005. case EV_PKT_OUT:
  4006. {
  4007. unsigned short frag = (unsigned short) (Entry->Data);
  4008. unsigned short ptype = (unsigned short) (Entry->Data >> 16);
  4009. char * ptypestring;
  4010. if (ptype >= sizeof(DgPacketTypes)/sizeof(DgPacketTypes[0]))
  4011. {
  4012. ptypestring = "???";
  4013. }
  4014. else
  4015. {
  4016. ptypestring = DgPacketTypes[ptype];
  4017. }
  4018. dprintf("sent pkt %s frag/len %hx", ptypestring, frag);
  4019. Printed = TRUE;
  4020. break;
  4021. }
  4022. }
  4023. if (!Printed)
  4024. {
  4025. dprintf("%s %p %p", Verb, Entry->ObjectPointer, Entry->Data);
  4026. }
  4027. dprintf("\n");
  4028. int LinesPrinted = 1;
  4029. if (ShowStack && Entry->EventStackTrace[0])
  4030. {
  4031. int i;
  4032. for (i = 0; Entry->EventStackTrace[i] && i < STACKTRACE_DEPTH; i++)
  4033. {
  4034. dprintf(" ");
  4035. do_symbol((ULONG_PTR) Entry->EventStackTrace[i]);
  4036. ++LinesPrinted;
  4037. }
  4038. }
  4039. return LinesPrinted;
  4040. }
  4041. int
  4042. PrintEntryAddress(
  4043. IN ULONG64 Entry,
  4044. IN int index,
  4045. IN BOOL ShowStack
  4046. )
  4047. {
  4048. char * Subject;
  4049. char * Verb;
  4050. BOOL Printed = FALSE;
  4051. ULONG tmp;
  4052. ULONG64 Time = 0;
  4053. ULONG64 Thread = 0;
  4054. ULONG64 SubjectPointer = 0;
  4055. ULONG64 ObjectPointer = 0;
  4056. ULONG64 SubjectData = 0;
  4057. ULONG64 VerbData = 0;
  4058. ULONG64 Data = 0;
  4059. ULONG64 EventStackTraceAddress =0 ;
  4060. ULONG64 EventStackTrace_0 = 0;
  4061. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Time, Time);
  4062. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Thread, Thread);
  4063. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, SubjectPointer, SubjectPointer);
  4064. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Subject, SubjectData);
  4065. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, ObjectPointer, ObjectPointer);
  4066. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Verb, VerbData);
  4067. GET_MEMBER_NORET(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, Data, Data);
  4068. GET_ADDRESS_OF(Entry, RPC_EVENT, RPCRT4!RPC_EVENT, EventStackTrace, EventStackTraceAddress, tmp);
  4069. ReadPtrUnextend(EventStackTraceAddress, &EventStackTrace_0);
  4070. switch ((char)SubjectData)
  4071. {
  4072. case SU_HANDLE : Subject = "binding "; break;
  4073. case SU_CCONN : Subject = "cconn "; break;
  4074. case SU_SCONN : Subject = "sconn "; break;
  4075. case SU_CASSOC : Subject = "cassoc "; break;
  4076. case SU_SASSOC : Subject = "sassoc "; break;
  4077. case SU_CCALL : Subject = "ccall "; break;
  4078. case SU_SCALL : Subject = "scall "; break;
  4079. case SU_PACKET : Subject = "packet "; break;
  4080. case SU_CENDPOINT: Subject = "endpnt "; break;
  4081. case SU_ENGINE : Subject = " call "; break;
  4082. case SU_ASSOC : Subject = " assoc "; break;
  4083. case SU_MUTEX : Subject = "mutex "; break;
  4084. case SU_STABLE : Subject = "sc tabl "; break;
  4085. case SU_BCACHE : Subject = "bcache "; break;
  4086. case SU_HEAP : Subject = "heap "; break;
  4087. case SU_THREAD : Subject = "thread "; break;
  4088. case SU_EVENT : Subject = "event "; break;
  4089. case SU_TRANS_CONN:Subject = "trans conn "; break;
  4090. case SU_ADDRESS : Subject = "address "; break;
  4091. case SU_EXCEPT : Subject = "exception "; break;
  4092. case SU_REFOBJ :
  4093. {
  4094. Subject = GetHandleTypeAddr(ObjectPointer);
  4095. break;
  4096. }
  4097. case SU_CTXHANDLE: Subject = "ctx handle "; break;
  4098. case SU_EEINFO : Subject = "EEInfo "; break;
  4099. default:
  4100. {
  4101. static char string[4];
  4102. Subject = string;
  4103. Subject[0] = '\"';
  4104. Subject[1] = (char)SubjectData;
  4105. Subject[2] = '\"';
  4106. Subject[3] = '\0';
  4107. break;
  4108. }
  4109. }
  4110. dprintf("%5x: %06.6d.%03.3d/%-4x %s %I64p ", index, (ULONG)Time / 1000, (ULONG)Time % 1000, (ULONG)Thread, Subject, SubjectPointer);
  4111. if (SubjectData != SU_EEINFO)
  4112. {
  4113. Verb = "(extension bug)";
  4114. switch ((char)VerbData)
  4115. {
  4116. case EV_CREATE : Verb = "create "; break;
  4117. case EV_DELETE : Verb = "delete "; break;
  4118. case EV_START : Verb = "active "; break;
  4119. case EV_STOP : Verb = "inactive "; break;
  4120. case EV_INC : Verb = "ref++ "; break;
  4121. case EV_DEC : Verb = "ref-- "; break;
  4122. case EV_ACK : Verb = "ack sent "; break;
  4123. case EV_NOTIFY : Verb = "notify "; break;
  4124. case EV_APC : Verb = "APC fired"; break;
  4125. case EV_RESOLVED : Verb = "resolved "; break;
  4126. case EV_REMOVED : Verb = "removed "; break;
  4127. case EV_CLEANUP : Verb = "cleanup "; break;
  4128. case EV_SEC_INIT1 : Verb = "init SC 1"; break;
  4129. case EV_SEC_INIT3 : Verb = "init SC 3"; break;
  4130. case EV_SEC_ACCEPT1 : Verb = "accptSC 1"; break;
  4131. case EV_SEC_ACCEPT3 : Verb = "accptSC 3"; break;
  4132. case EV_STATUS:
  4133. {
  4134. if ((ULONG)SubjectData != SU_EXCEPT)
  4135. {
  4136. if (VerbData)
  4137. {
  4138. dprintf("status %lx, location %d", (ULONG)Data, (ULONG)ObjectPointer);
  4139. }
  4140. else
  4141. {
  4142. dprintf("status %lx", (ULONG)Data);
  4143. }
  4144. Printed = TRUE;
  4145. break;
  4146. }
  4147. else
  4148. {
  4149. dprintf("exception info: %lx, %lx, %lx", (ULONG)SubjectPointer, (ULONG)ObjectPointer, (ULONG)Data);
  4150. Printed = TRUE;
  4151. break;
  4152. }
  4153. }
  4154. case EV_DISASSOC : Verb = "disassoc "; break;
  4155. case EV_STATE:
  4156. {
  4157. char * state = "----";
  4158. if ((ULONG)SubjectData == SU_CCALL)
  4159. {
  4160. if (Data < GetExpression("rpcrt4!DG_CCALL__CallInit") ||
  4161. Data > GetExpression("rpcrt4!DG_CCALL__CallComplete"))
  4162. {
  4163. dprintf("unknown state 0x%x", Data);
  4164. Printed = TRUE;
  4165. }
  4166. else
  4167. {
  4168. state = CcallStates[Data - GetExpression("rpcrt4!DG_CCALL__CallInit")];
  4169. }
  4170. }
  4171. else
  4172. {
  4173. if (Data < GetExpression("RPCRT4!DG_SCALL__CallInit") ||
  4174. Data > GetExpression("RPCRT4!DG_SCALL__CallComplete"))
  4175. {
  4176. dprintf("unknown state 0x%x", Data);
  4177. Printed = TRUE;
  4178. }
  4179. else
  4180. {
  4181. state = ScallStates[Data - GetExpression("RPCRT4!DG_SCALL__CallInit")];
  4182. }
  4183. }
  4184. if (!Printed)
  4185. {
  4186. dprintf("state %s", state);
  4187. Printed = TRUE;
  4188. }
  4189. break;
  4190. }
  4191. case EV_POP : Verb = "pop "; break;
  4192. case EV_PUSH : Verb = "push "; break;
  4193. case EV_PKT_IN:
  4194. {
  4195. unsigned short frag = (unsigned short) (Data);
  4196. unsigned short ptype = (unsigned short) (Data >> 16);
  4197. char * ptypestring;
  4198. if (ptype >= sizeof(DgPacketTypes)/sizeof(DgPacketTypes[0]))
  4199. {
  4200. dprintf("recv pkt unknown type 0x%hx", ptype);
  4201. Printed = TRUE;
  4202. }
  4203. else
  4204. {
  4205. ptypestring = DgPacketTypes[ptype];
  4206. }
  4207. if (!Printed)
  4208. {
  4209. if (ObjectPointer)
  4210. {
  4211. dprintf("recv pkt %s frag %hx, location %d", ptypestring, frag, (ULONG)ObjectPointer);
  4212. }
  4213. else
  4214. {
  4215. dprintf("recv pkt %s frag/len %hx", ptypestring, frag);
  4216. }
  4217. Printed = TRUE;
  4218. }
  4219. break;
  4220. }
  4221. case EV_BUFFER_IN : Verb = "buf in"; break;
  4222. case EV_BUFFER_OUT: Verb = "buf out"; break;
  4223. case EV_TRANSFER: Verb = "xfer call"; break;
  4224. case EV_DROP: Verb = "dropped "; break;
  4225. case EV_DELAY: Verb = "delayed "; break;
  4226. case EV_CALLBACK: Verb = "callback "; break;
  4227. default:
  4228. {
  4229. static char string[10];
  4230. Verb = string;
  4231. Verb[0] = '\"';
  4232. Verb[1] = (char)VerbData;
  4233. Verb[2] = '\"';
  4234. Verb[3] = '\0';
  4235. break;
  4236. }
  4237. case 'p':
  4238. {
  4239. if (SubjectData == SU_STABLE)
  4240. {
  4241. Verb = "prune ";
  4242. }
  4243. else
  4244. {
  4245. DWORD buf[2];
  4246. buf[0] = (DWORD) Data;
  4247. buf[1] = 0;
  4248. dprintf("proc %s %I64x", (char *) buf, ObjectPointer);
  4249. Printed = TRUE;
  4250. }
  4251. break;
  4252. }
  4253. case EV_PKT_OUT:
  4254. {
  4255. unsigned short frag = (unsigned short) (Data);
  4256. unsigned short ptype = (unsigned short) ((Data >> 16) & 0xFF);
  4257. unsigned short opnum = (unsigned short) (Data >> 24);
  4258. ULONG CallId = (ULONG)ObjectPointer;
  4259. char * ptypestring;
  4260. if (ptype >= sizeof(DgPacketTypes)/sizeof(DgPacketTypes[0]))
  4261. {
  4262. ptypestring = "???";
  4263. }
  4264. else
  4265. {
  4266. ptypestring = DgPacketTypes[ptype];
  4267. }
  4268. if (opnum)
  4269. {
  4270. dprintf("sent p %s fr/len %hx op# %d cid %d", ptypestring, frag, opnum, CallId);
  4271. }
  4272. else
  4273. {
  4274. dprintf("sent p %s fr/len %hx cid %d", ptypestring, frag, CallId);
  4275. }
  4276. Printed = TRUE;
  4277. break;
  4278. }
  4279. }
  4280. }
  4281. else
  4282. {
  4283. // this is an eeinfo record
  4284. dprintf("GC %d St %d DL %d P#1 %d", (ULONG)VerbData, (ULONG)SubjectPointer, (ULONG)ObjectPointer, (ULONG)Data);
  4285. Printed = TRUE;
  4286. }
  4287. if (!Printed)
  4288. {
  4289. dprintf("%s %I64p %I64p", Verb, ObjectPointer, Data);
  4290. }
  4291. dprintf("\n");
  4292. int LinesPrinted = 1;
  4293. if (ShowStack && EventStackTrace_0) {
  4294. int i = 0;
  4295. ULONG64 StackEntry = 0;
  4296. do {
  4297. if (!ReadPtrUnextend(EventStackTraceAddress + i * AddressSize, &StackEntry)) {
  4298. dprintf(" ");
  4299. do_symbol(StackEntry);
  4300. ++LinesPrinted;
  4301. ++i;
  4302. }
  4303. }
  4304. while (StackEntry && i < STACKTRACE_DEPTH);
  4305. }
  4306. return LinesPrinted;
  4307. }
  4308. void scan_usage()
  4309. {
  4310. dprintf("options:\n"
  4311. "\n"
  4312. " -sXYZ print entries with subject character == X or Y or Z\n"
  4313. " -vXYZ print entries with verb character == X or Y or Z\n"
  4314. " -s~XYZ print entries with subject character != X or Y or Z\n"
  4315. " -v~XYZ print entries with verb character != X or Y or Z\n"
  4316. " -t NNNN print entries for thread NNNN \n"
  4317. " -a NNNN print entries for subject at address NNNN \n"
  4318. " -o NNNN print entries for object at address NNNN \n"
  4319. " -k or -k+ show stack traces if available\n"
  4320. " -k- don't show stack traces (default)\n"
  4321. " -b NNNN1 NNNN2 NNNN3 \n"
  4322. " (if symbols are broken) RpcEvents is at NNNN1"
  4323. " and NextEvent is NNNN2\n"
  4324. " and event array length is NNNN3\n"
  4325. " -NNNN print the NNNN entries ending with NextEvent (or specified base)\n"
  4326. " +NNNN print the NNNN entries starting with NextEvent (or specified base)\n"
  4327. " NNNN the base index is NNNN"
  4328. " -f filename reads a binary version of the log and displays it as text\n"
  4329. "\n"
  4330. "e.g. '!scan -40 -sN' would print the last 40 DG_SCONNECTION events\n"
  4331. " '!scan +30 200' would print 30 entries starting at index 200\n"
  4332. );
  4333. }
  4334. char VerbsToDisplay[40];
  4335. char SubjectsToDisplay[40];
  4336. DECLARE_API( scan )
  4337. {
  4338. char * Subject = 0;
  4339. char * verb = 0;
  4340. ULONG64 addr = 0;
  4341. ULONG64 obj_addr = 0;
  4342. DWORD thread = 0;
  4343. static ULONG64 RpcEvents = 0;
  4344. static LONG EventArrayLength = 0;
  4345. static LONG NextEvent = 0;
  4346. int RequestCount = 30;
  4347. int NextEventToPrint = 0;
  4348. BOOL ForwardSearch = FALSE;
  4349. BOOL ShowStackTraces = FALSE;
  4350. BOOL Wrapped = FALSE;
  4351. int BaseIndex = -1;
  4352. int MatchCount = 0;
  4353. int index;
  4354. int i;
  4355. BOOL fFileInput = FALSE;
  4356. HANDLE hFile;
  4357. struct RPC_EVENT Entry;
  4358. ULONG64 EntryAddress;
  4359. ULONG64 tmp;
  4360. //
  4361. // Interpret options.
  4362. //
  4363. char * arg;
  4364. LPSTR lpArgumentString = (LPSTR)args;
  4365. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  4366. {
  4367. if (arg[0] == '-')
  4368. {
  4369. ++arg;
  4370. switch (arg[0])
  4371. {
  4372. case 's':
  4373. {
  4374. if (!arg[1])
  4375. {
  4376. scan_usage();
  4377. return;
  4378. }
  4379. if (strlen(arg+1) >= sizeof(SubjectsToDisplay))
  4380. {
  4381. dprintf("-s: too many subject types proposed\n");
  4382. return;
  4383. }
  4384. strcpy(SubjectsToDisplay, arg+1);
  4385. Subject = SubjectsToDisplay;
  4386. if (Subject[0] == '*')
  4387. {
  4388. Subject = 0;
  4389. }
  4390. break;
  4391. }
  4392. case 'v':
  4393. {
  4394. if (!arg[1])
  4395. {
  4396. scan_usage();
  4397. return;
  4398. }
  4399. if (strlen(arg+1) >= sizeof(VerbsToDisplay))
  4400. {
  4401. dprintf("-v: too many verbs proposed\n");
  4402. return;
  4403. }
  4404. strcpy(VerbsToDisplay, arg+1);
  4405. verb = VerbsToDisplay;
  4406. if (verb[0] == '*')
  4407. {
  4408. verb = 0;
  4409. }
  4410. break;
  4411. }
  4412. case 'a':
  4413. {
  4414. if (arg[1])
  4415. {
  4416. scan_usage();
  4417. return;
  4418. }
  4419. arg = strtok(0);
  4420. if (!arg)
  4421. {
  4422. dprintf("-a: no object address specified\n");
  4423. return;
  4424. }
  4425. addr = GetExpression(arg);
  4426. if (!addr)
  4427. {
  4428. dprintf("-a: can't evaluate %s\n", arg);
  4429. return;
  4430. }
  4431. break;
  4432. }
  4433. case 'o':
  4434. {
  4435. if (arg[1])
  4436. {
  4437. scan_usage();
  4438. return;
  4439. }
  4440. arg = strtok(0);
  4441. if (!arg)
  4442. {
  4443. dprintf("-o: no object address specified\n");
  4444. return;
  4445. }
  4446. obj_addr = GetExpression(arg);
  4447. if (!obj_addr)
  4448. {
  4449. dprintf("-o: can't evaluate %s\n", arg);
  4450. return;
  4451. }
  4452. break;
  4453. }
  4454. case 't':
  4455. {
  4456. if (arg[1])
  4457. {
  4458. scan_usage();
  4459. return;
  4460. }
  4461. arg = strtok(0);
  4462. if (!arg)
  4463. {
  4464. dprintf("-t: no thread ID specified\n");
  4465. return;
  4466. }
  4467. thread = (DWORD) GetExpression(arg);
  4468. if (!thread)
  4469. {
  4470. dprintf("-t: can't evaluate %s\n", arg);
  4471. return;
  4472. }
  4473. break;
  4474. }
  4475. case 'b':
  4476. {
  4477. arg = strtok(0);
  4478. if (!arg)
  4479. {
  4480. dprintf("-b: no base address specified\n");
  4481. return;
  4482. }
  4483. RpcEvents = GetExpression(arg);
  4484. arg = strtok(0);
  4485. if (!arg)
  4486. {
  4487. dprintf("-b: no NextEvent specified\n");
  4488. return;
  4489. }
  4490. NextEvent = (LONG) GetExpression(arg);
  4491. arg = strtok(0);
  4492. if (!arg)
  4493. {
  4494. dprintf("-b: no event array length specified\n");
  4495. return;
  4496. }
  4497. EventArrayLength = (long) GetExpression(arg);
  4498. break;
  4499. }
  4500. case 'k':
  4501. {
  4502. if (arg[1] == '+' ||
  4503. arg[1] == '\0')
  4504. {
  4505. ShowStackTraces = TRUE;
  4506. }
  4507. else if (arg[1] == '-')
  4508. {
  4509. ShowStackTraces = FALSE;
  4510. }
  4511. else
  4512. {
  4513. dprintf("-k: use '-k' or '-k+' for stack traces, '-k-' for none\n");
  4514. return;
  4515. }
  4516. break;
  4517. }
  4518. case 'f':
  4519. {
  4520. arg = strtok(0);
  4521. if (!arg)
  4522. {
  4523. dprintf("-f: no file name specified\n");
  4524. return;
  4525. }
  4526. hFile = CreateFileA(arg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
  4527. FILE_ATTRIBUTE_NORMAL, NULL);
  4528. if (hFile == INVALID_HANDLE_VALUE)
  4529. {
  4530. dprintf("-f: Couldn't open file name %s - error %d\n", arg, GetLastError());
  4531. return;
  4532. }
  4533. fFileInput = TRUE;
  4534. }
  4535. break;
  4536. case '0':
  4537. case '1':
  4538. case '2':
  4539. case '3':
  4540. case '4':
  4541. case '5':
  4542. case '6':
  4543. case '7':
  4544. case '8':
  4545. case '9':
  4546. {
  4547. ForwardSearch = FALSE;
  4548. RequestCount = myatol(arg);
  4549. if (!RequestCount)
  4550. {
  4551. dprintf("-%s: zero lines specified\n", arg);
  4552. return;
  4553. }
  4554. break;
  4555. }
  4556. default:
  4557. {
  4558. dprintf("unknown option %s\n", arg);
  4559. scan_usage();
  4560. return;
  4561. }
  4562. }
  4563. }
  4564. else if (arg[0] == '+')
  4565. {
  4566. ++arg;
  4567. RequestCount = myatol(arg);
  4568. if (!RequestCount)
  4569. {
  4570. dprintf("+%s: zero lines specified\n", arg);
  4571. return;
  4572. }
  4573. MatchCount = RequestCount;
  4574. ForwardSearch = TRUE;
  4575. }
  4576. else
  4577. {
  4578. BaseIndex = (int) GetExpression(arg);
  4579. }
  4580. }
  4581. if (fFileInput)
  4582. {
  4583. BOOL Result;
  4584. DWORD NumberOfBytesRead;
  4585. index = 1;
  4586. while (1)
  4587. {
  4588. Result = ReadFile(hFile, &Entry, sizeof(Entry), &NumberOfBytesRead, NULL);
  4589. if (!Result)
  4590. {
  4591. dprintf("-f: Error reading file: %d\n", GetLastError());
  4592. break;
  4593. }
  4594. if (NumberOfBytesRead < sizeof(Entry))
  4595. {
  4596. dprintf("-f: EOF reached\n");
  4597. break;
  4598. }
  4599. PrintEntry(&Entry, index, ShowStackTraces);
  4600. index ++;
  4601. if ((CheckControlC)())
  4602. {
  4603. CloseHandle(hFile);
  4604. return;
  4605. }
  4606. }
  4607. CloseHandle(hFile);
  4608. return;
  4609. }
  4610. ULONG64 NextEventAddress = GetExpression("rpcrt4!NextEvent");
  4611. ULONG64 EventLengthAddress = GetExpression("rpcrt4!EventArrayLength");
  4612. //
  4613. // Find the current event.
  4614. //
  4615. if (!RpcEvents)
  4616. {
  4617. RpcEvents = GetExpression("rpcrt4!RpcEvents");
  4618. if (!RpcEvents || !NextEventAddress)
  4619. {
  4620. dprintf("I can't find rpcrt4!RpcEvents or rpcrt4!NextEvent; use -b\n");
  4621. return;
  4622. }
  4623. if (!ReadMemory(NextEventAddress, &NextEvent, sizeof(DWORD), 0))
  4624. {
  4625. dprintf("I can't read NextEvent from 0x%I64x\n", NextEventAddress);
  4626. return;
  4627. }
  4628. if (EventLengthAddress)
  4629. {
  4630. if (!ReadMemory(EventLengthAddress, &EventArrayLength, sizeof(DWORD), 0))
  4631. {
  4632. dprintf("I can't read EventArrayLength from 0x%I64x\n", EventLengthAddress);
  4633. return;
  4634. }
  4635. if (!ReadMemory(RpcEvents, &tmp, sizeof(ULONG64), 0))
  4636. {
  4637. dprintf("I can't read rpcrt4!RpcEvents at 0x%I64x\n", RpcEvents);
  4638. return;
  4639. }
  4640. RpcEvents = tmp;
  4641. }
  4642. else
  4643. {
  4644. dprintf("rpcrt4!EventArrayLength isn't defined; probably an older build\n");
  4645. EventArrayLength = 4096;
  4646. }
  4647. dprintf("RpcEvents at 0x%I64x; array has %u entries; NextEvent = %lx, %s\n",
  4648. RpcEvents, EventArrayLength, NextEvent, Wrapped ? "wrapped around" : "");
  4649. }
  4650. if (FALSE == FetchEventAddress(RpcEvents, 0, &EntryAddress))
  4651. {
  4652. dprintf("I can't read memory at 0x%I64x \n", RpcEvents);
  4653. return;
  4654. }
  4655. GET_MEMBER(EntryAddress, RPC_EVENT, RPCRT4!RPC_EVENT, Subject, tmp);
  4656. if (tmp)
  4657. {
  4658. Wrapped = TRUE;
  4659. }
  4660. if (thread || Subject || verb || addr || obj_addr)
  4661. {
  4662. dprintf("filter: ");
  4663. }
  4664. else
  4665. {
  4666. dprintf("no filter");
  4667. }
  4668. if (thread)
  4669. {
  4670. dprintf("thread %x ", thread);
  4671. }
  4672. if (Subject)
  4673. {
  4674. dprintf("subjects '%s' ", Subject);
  4675. }
  4676. if (verb)
  4677. {
  4678. dprintf("verbs '%s' ", verb);
  4679. }
  4680. if (addr)
  4681. {
  4682. dprintf("address %x ", addr);
  4683. }
  4684. if (obj_addr)
  4685. {
  4686. dprintf("direct-object address 0x%I64x ", obj_addr);
  4687. }
  4688. dprintf(", base index = %x\n", BaseIndex);
  4689. // Allow one set of debug spew to be printed if some data can't
  4690. // be properly read or fields extracted.
  4691. fSpew = TRUE;
  4692. //
  4693. // Scan backwards until we have enough matching events.
  4694. //
  4695. if (NextEvent > EventArrayLength)
  4696. {
  4697. NextEvent %= EventArrayLength;
  4698. }
  4699. if (ForwardSearch)
  4700. {
  4701. if (BaseIndex == -1)
  4702. {
  4703. BaseIndex = NextEventToPrint;
  4704. }
  4705. if (!Wrapped && BaseIndex + MatchCount > NextEvent+1)
  4706. {
  4707. MatchCount = NextEvent+1 - BaseIndex;
  4708. }
  4709. }
  4710. else
  4711. {
  4712. if (BaseIndex == -1)
  4713. {
  4714. BaseIndex = NextEvent;
  4715. }
  4716. LONG Point = BaseIndex;
  4717. for (index = Point; index >= 0 && MatchCount < RequestCount; --index )
  4718. {
  4719. if (FALSE == FetchEventAddress(RpcEvents, index, &EntryAddress))
  4720. {
  4721. dprintf("I can't read memory at index %x\n", index);
  4722. return;
  4723. }
  4724. if (DoesEntryAddressMatch(EntryAddress, Subject, verb, thread, addr, obj_addr))
  4725. {
  4726. ++MatchCount;
  4727. BaseIndex = index;
  4728. }
  4729. }
  4730. if (Wrapped && MatchCount < RequestCount)
  4731. {
  4732. for (index = EventArrayLength-1; index > Point && MatchCount < RequestCount; --index )
  4733. {
  4734. if (FALSE == FetchEventAddress(RpcEvents, index, &EntryAddress))
  4735. {
  4736. dprintf("I can't read memory at index %d\n", index);
  4737. return;
  4738. }
  4739. if (DoesEntryAddressMatch(EntryAddress, Subject, verb, thread, addr, obj_addr))
  4740. {
  4741. ++MatchCount;
  4742. BaseIndex = index;
  4743. }
  4744. }
  4745. }
  4746. }
  4747. //
  4748. // Print matching events.
  4749. //
  4750. index = BaseIndex;
  4751. do
  4752. {
  4753. if (FALSE == FetchEventAddress(RpcEvents, index, &EntryAddress))
  4754. {
  4755. dprintf("I can't read memory at index %x\n", index);
  4756. return;
  4757. }
  4758. if (DoesEntryAddressMatch(EntryAddress, Subject, verb, thread, addr, obj_addr))
  4759. {
  4760. PrintEntryAddress(EntryAddress, index, ShowStackTraces);
  4761. --MatchCount;
  4762. }
  4763. ++index;
  4764. index = index % EventArrayLength;
  4765. if ((CheckControlC)())
  4766. {
  4767. return;
  4768. }
  4769. }
  4770. while (MatchCount && index != BaseIndex);
  4771. NextEventToPrint = index;
  4772. }
  4773. DECLARE_API( rpctime )
  4774. {
  4775. DWORD dwCurrentTime;
  4776. if (fKD)
  4777. {
  4778. dprintf("Cannot dump time in kd\n");
  4779. return;
  4780. }
  4781. dwCurrentTime = GetTickCount();
  4782. dprintf("Current time is: %06.6d.%03.3d (0x%06.6x.%03.3x)\n", dwCurrentTime / 1000, dwCurrentTime % 1000,
  4783. dwCurrentTime / 1000, dwCurrentTime % 1000);
  4784. }
  4785. DECLARE_API( version )
  4786. {
  4787. #if DBG
  4788. PCSTR kind = "Checked";
  4789. #else
  4790. PCSTR kind = "Free";
  4791. #endif
  4792. if (fKD)
  4793. {
  4794. dprintf(
  4795. "%s RPC Extension dll for Build %d debugging %s kernel for Build %d\n",
  4796. kind,
  4797. VER_PRODUCTBUILD,
  4798. SavedMajorVersion == 0x0c ? "Checked" : "Free",
  4799. SavedMinorVersion
  4800. );
  4801. }
  4802. else
  4803. {
  4804. dprintf(
  4805. "%s RPC Extension dll for Build %d\n",
  4806. kind,
  4807. VER_PRODUCTBUILD
  4808. );
  4809. }
  4810. }
  4811. DECLARE_API( bcache )
  4812. {
  4813. ULONG64 tmp1;
  4814. ULONG tmp2;
  4815. ULONG64 StateArray = 0;
  4816. // For process cache
  4817. ULONG64 Cache;
  4818. ULONG64 CacheAddress;
  4819. BOOL b, fGuardPageMode = FALSE;
  4820. //
  4821. // Interpret options.
  4822. //
  4823. char * arg1;
  4824. char * arg2;
  4825. LPSTR lpArgumentString = (LPSTR)args;
  4826. arg1 = strtok(lpArgumentString);
  4827. arg2 = strtok(0);
  4828. if (arg2)
  4829. {
  4830. dprintf("usage: \n"
  4831. " !bcache <TEB-address> for a thread's cache\n"
  4832. " !bcache for the process cache\n"
  4833. "\n");
  4834. return;
  4835. }
  4836. if (arg1)
  4837. {
  4838. ULONG64 RpcThread;
  4839. ULONG64 pTeb = GetExpression(arg1);
  4840. GET_MEMBER(pTeb, TEB, TEB, ReservedForNtRpc, RpcThread);
  4841. GET_ADDRESS_OF(RpcThread, THREAD, RPCRT4!THREAD, BufferCache, StateArray, tmp2);
  4842. }
  4843. else
  4844. {
  4845. ULONG64 CachePointerAddress = GetExpression("rpcrt4!gBufferCache");
  4846. if (!CachePointerAddress)
  4847. {
  4848. dprintf("can't find rpcrt4!gBufferCache\n");
  4849. return;
  4850. }
  4851. b = GetData(CachePointerAddress, &CacheAddress, sizeof(PVOID));
  4852. if ( !b )
  4853. {
  4854. dprintf("couldn't read process buffer cache pointer at %x\n", CacheAddress);
  4855. return;
  4856. }
  4857. dprintf("process-wide buffer cache:\n");
  4858. ULONG64 GuardPageMode = GetExpression("rpcrt4!fGuardPageMode");
  4859. if(GuardPageMode)
  4860. b = GetData(GuardPageMode, &fGuardPageMode, sizeof(fGuardPageMode));
  4861. if (!b)
  4862. {
  4863. dprintf("couldn't read guard page mode flag at address %p\n", GuardPageMode);
  4864. return;
  4865. }
  4866. if (fGuardPageMode)
  4867. {
  4868. dprintf("---> GUARD PAGE mode enabled!\n");
  4869. }
  4870. GET_ADDRESS_OF(CacheAddress, BCACHE, RPCRT4!BCACHE, _bcGlobalState, StateArray, tmp2);
  4871. }
  4872. //
  4873. // Load the size hints.
  4874. //
  4875. ULONG64 HintAddress;
  4876. HintAddress = GetExpression("rpcrt4!pHints");
  4877. ReadPtrUnextend(HintAddress, &HintAddress);
  4878. //
  4879. // Dump the buffer states.
  4880. //
  4881. int i;
  4882. ULONG64 State = StateArray;
  4883. ULONG64 Hint = HintAddress;
  4884. ULONG64 cBlocks;
  4885. ULONG64 pList;
  4886. ULONG64 cSize;
  4887. for (i=0; i < 4; ++i)
  4888. {
  4889. GET_MEMBER(State, BCACHE_STATE, RPCRT4!BCACHE_STATE, cBlocks, cBlocks);
  4890. GET_MEMBER(State, BCACHE_STATE, RPCRT4!BCACHE_STATE, pList, pList);
  4891. GET_MEMBER(Hint, BUFFER_CACHE_HINTS, RPCRT4!BUFFER_CACHE_HINTS, cSize, cSize);
  4892. dprintf(" count %5u head %I64x size %5x\n",
  4893. (ULONG)cBlocks,
  4894. pList,
  4895. (ULONG)cSize);
  4896. State += GET_TYPE_SIZE(BCACHE_STATE, RPCRT4!BCACHE_STATE);
  4897. Hint += GET_TYPE_SIZE(BUFFER_CACHE_HINTS, RPCRT4!BUFFER_CACHE_HINTS);
  4898. }
  4899. if (!arg1)
  4900. {
  4901. ULONG64 _bcGlobalStats;
  4902. GET_ADDRESS_OF(CacheAddress, BCACHE, RPCRT4!BCACHE, _bcGlobalStats, _bcGlobalStats, tmp2);
  4903. // Dump out the bcache cache stats
  4904. dprintf("\nGlobal Stats:\n cap hits misses\n");
  4905. for (i = 0; i < ((fGuardPageMode) ? 2 : 4); i++)
  4906. {
  4907. ULONG64 cBufferCacheCap;
  4908. ULONG64 cAllocationHits;
  4909. ULONG64 cAllocationMisses;
  4910. GET_MEMBER(_bcGlobalStats, BCACHE_STATS, RPCRT4!BCACHE_STATS, cBufferCacheCap, cBufferCacheCap);
  4911. GET_MEMBER(_bcGlobalStats, BCACHE_STATS, RPCRT4!BCACHE_STATS, cAllocationHits, cAllocationHits);
  4912. GET_MEMBER(_bcGlobalStats, BCACHE_STATS, RPCRT4!BCACHE_STATS, cAllocationMisses, cAllocationMisses);
  4913. dprintf(" %5d %5d %5d\n",
  4914. cBufferCacheCap,
  4915. cAllocationHits,
  4916. cAllocationMisses);
  4917. _bcGlobalStats += GET_TYPE_SIZE(BCACHE_STATS, RPCRT4!BCACHE_STATS);
  4918. }
  4919. }
  4920. }
  4921. VOID
  4922. CheckVersion(
  4923. VOID
  4924. )
  4925. {
  4926. }
  4927. LPEXT_API_VERSION
  4928. ExtensionApiVersion(
  4929. VOID
  4930. )
  4931. {
  4932. return &ApiVersion;
  4933. }
  4934. void PrintGetCallInfoUsage(void)
  4935. {
  4936. dprintf("Usage: \n\tgetcallinfo [CallID|0 [IfStart|0 [ProcNum|FFFF [ProcessID|0]]]]\n");
  4937. }
  4938. DECLARE_API( getcallinfo )
  4939. {
  4940. ULONG CallID = 0;
  4941. ULONG IfStart = 0;
  4942. USHORT ProcNum = RPCDBG_NO_PROCNUM_SPECIFIED;
  4943. ULONG ProcessID = 0;
  4944. int ArgumentNo = 0;
  4945. //
  4946. // Interpret options.
  4947. //
  4948. char * arg;
  4949. if (fKD != 0)
  4950. {
  4951. dprintf("This extension command does not work under kd\n");
  4952. return;
  4953. }
  4954. LPSTR lpArgumentString = (LPSTR)args;
  4955. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  4956. {
  4957. switch(ArgumentNo)
  4958. {
  4959. case 0:
  4960. // either help or CallID
  4961. if ((arg[0] == '?') || ((arg[0] == '-') && (arg[1] == '?')))
  4962. {
  4963. PrintGetCallInfoUsage();
  4964. return;
  4965. }
  4966. else
  4967. {
  4968. CallID = (ULONG)GetExpression(arg);
  4969. }
  4970. break;
  4971. case 1:
  4972. IfStart = (ULONG)GetExpression(arg);
  4973. break;
  4974. case 2:
  4975. ProcNum = (unsigned short) GetExpression(arg);
  4976. break;
  4977. case 3:
  4978. ProcessID = (ULONG)GetExpression(arg);
  4979. break;
  4980. default:
  4981. dprintf("Too many arguments\n");
  4982. PrintGetCallInfoUsage();
  4983. }
  4984. ArgumentNo ++;
  4985. }
  4986. GetAndPrintCallInfo(CallID, IfStart, ProcNum, ProcessID, dprintf);
  4987. }
  4988. void PrintGetDbgCellUsage(void)
  4989. {
  4990. dprintf("Usage: \n\tgetdbgcell ProcessID CellID1.CellID2\n");
  4991. }
  4992. DECLARE_API( getdbgcell )
  4993. {
  4994. ULONG ProcessID = 0;
  4995. int ArgumentNo = 0;
  4996. DebugCellID CellID;
  4997. char *DotSeparator;
  4998. CellID.SectionID = 0;
  4999. CellID.CellID = 0;
  5000. //
  5001. // Interpret options.
  5002. //
  5003. char * arg;
  5004. if (fKD != 0)
  5005. {
  5006. dprintf("This extension command does not work under kd\n");
  5007. return;
  5008. }
  5009. LPSTR lpArgumentString = (LPSTR)args;
  5010. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  5011. {
  5012. switch(ArgumentNo)
  5013. {
  5014. case 0:
  5015. // either help or ProcessID
  5016. if ((arg[0] == '?') || ((arg[0] == '-') && (arg[1] == '?')))
  5017. {
  5018. PrintGetDbgCellUsage();
  5019. return;
  5020. }
  5021. else
  5022. {
  5023. ProcessID = (ULONG)GetExpression(arg);
  5024. }
  5025. break;
  5026. case 1:
  5027. DotSeparator = strchr(arg, '.');
  5028. if (DotSeparator == NULL)
  5029. {
  5030. PrintGetCallInfoUsage();
  5031. return;
  5032. }
  5033. *DotSeparator = 0;
  5034. DotSeparator ++;
  5035. CellID.SectionID = (USHORT)GetExpression(arg);
  5036. CellID.CellID = (USHORT)GetExpression(DotSeparator);
  5037. break;
  5038. default:
  5039. dprintf("Too many arguments\n");
  5040. PrintGetDbgCellUsage();
  5041. }
  5042. ArgumentNo ++;
  5043. }
  5044. GetAndPrintDbgCellInfo(ProcessID, CellID, dprintf);
  5045. }
  5046. void PrintGetEndpointInfoUsage(void)
  5047. {
  5048. dprintf("Usage: \n\tgetendpointinfo [EndpointName]\n");
  5049. }
  5050. DECLARE_API( getendpointinfo )
  5051. {
  5052. int ArgumentNo = 0;
  5053. char *EndpointName = NULL;
  5054. //
  5055. // Interpret options.
  5056. //
  5057. char * arg;
  5058. if (fKD != 0)
  5059. {
  5060. dprintf("This extension command does not work under kd\n");
  5061. return;
  5062. }
  5063. LPSTR lpArgumentString = (LPSTR)args;
  5064. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  5065. {
  5066. switch(ArgumentNo)
  5067. {
  5068. case 0:
  5069. // either help or EndpointName
  5070. if ((arg[0] == '?') || ((arg[0] == '-') && (arg[1] == '?')))
  5071. {
  5072. PrintGetEndpointInfoUsage();
  5073. return;
  5074. }
  5075. else
  5076. {
  5077. EndpointName = arg;
  5078. }
  5079. break;
  5080. default:
  5081. dprintf("Too many arguments\n");
  5082. PrintGetCallInfoUsage();
  5083. }
  5084. ArgumentNo ++;
  5085. }
  5086. GetAndPrintEndpointInfo(EndpointName, dprintf);
  5087. }
  5088. void PrintGetThreadInfoUsage(void)
  5089. {
  5090. dprintf("Usage: \n\tgetthreadinfo ProcessID [ThreadID]\n");
  5091. }
  5092. DECLARE_API( getthreadinfo )
  5093. {
  5094. DWORD ProcessID = 0;
  5095. DWORD ThreadID = 0;
  5096. int ArgumentNo = 0;
  5097. BOOL fFirstTime = TRUE;
  5098. //
  5099. // Interpret options.
  5100. //
  5101. char * arg;
  5102. if (fKD != 0)
  5103. {
  5104. dprintf("This extension command does not work under kd\n");
  5105. return;
  5106. }
  5107. LPSTR lpArgumentString = (LPSTR)args;
  5108. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  5109. {
  5110. switch(ArgumentNo)
  5111. {
  5112. case 0:
  5113. // either help or EndpointName
  5114. if ((arg[0] == '?') || ((arg[0] == '-') && (arg[1] == '?')))
  5115. {
  5116. PrintGetThreadInfoUsage();
  5117. return;
  5118. }
  5119. else
  5120. {
  5121. ProcessID = (DWORD)GetExpression(arg);
  5122. }
  5123. fFirstTime = FALSE;
  5124. break;
  5125. case 1:
  5126. ThreadID = (DWORD)GetExpression(arg);
  5127. break;
  5128. default:
  5129. dprintf("Too many arguments\n");
  5130. PrintGetThreadInfoUsage();
  5131. }
  5132. ArgumentNo ++;
  5133. }
  5134. if (fFirstTime)
  5135. {
  5136. dprintf("You must specify at least a process id\n");
  5137. PrintGetThreadInfoUsage();
  5138. return;
  5139. }
  5140. GetAndPrintThreadInfo(ProcessID, ThreadID, dprintf);
  5141. }
  5142. void PrintGetClientCallInfoUsage(void)
  5143. {
  5144. dprintf("Usage: \n\tgetclientcallinfo [CallID|0 [IfStart|0 [ProcNum|FFFF [ProcessID|0]]]]\n");
  5145. }
  5146. DECLARE_API( getclientcallinfo )
  5147. {
  5148. ULONG CallID = 0;
  5149. ULONG IfStart = 0;
  5150. USHORT ProcNum = RPCDBG_NO_PROCNUM_SPECIFIED;
  5151. ULONG ProcessID = 0;
  5152. int ArgumentNo = 0;
  5153. //
  5154. // Interpret options.
  5155. //
  5156. char * arg;
  5157. if (fKD != 0)
  5158. {
  5159. dprintf("This extension command does not work under kd\n");
  5160. return;
  5161. }
  5162. LPSTR lpArgumentString = (LPSTR)args;
  5163. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  5164. {
  5165. switch(ArgumentNo)
  5166. {
  5167. case 0:
  5168. // either help or CallID
  5169. if ((arg[0] == '?') || ((arg[0] == '-') && (arg[1] == '?')))
  5170. {
  5171. PrintGetClientCallInfoUsage();
  5172. return;
  5173. }
  5174. else
  5175. {
  5176. CallID = (ULONG)GetExpression(arg);
  5177. }
  5178. break;
  5179. case 1:
  5180. IfStart = (ULONG)GetExpression(arg);
  5181. break;
  5182. case 2:
  5183. ProcNum = (USHORT)GetExpression(arg);
  5184. break;
  5185. case 3:
  5186. ProcessID = (ULONG)GetExpression(arg);
  5187. break;
  5188. default:
  5189. dprintf("Too many arguments\n");
  5190. PrintGetCallInfoUsage();
  5191. }
  5192. ArgumentNo ++;
  5193. }
  5194. GetAndPrintClientCallInfo(CallID, IfStart, ProcNum, ProcessID, dprintf);
  5195. }
  5196. DECLARE_API( checkrpcsym )
  5197. {
  5198. PVOID FunctionPtr;
  5199. DWORD Data;
  5200. BOOL b;
  5201. BOOL fUnsure = FALSE;
  5202. const int FunctionNamesSize = 2;
  5203. const int ExpectedDataSize = 3;
  5204. DWORD ExpectedData_x86[2][3] = {{0x55, 0x8B, 0xEC},{0x55, 0x8B, 0xEC}};
  5205. DWORD ExpectedData_ia64[2][3] = {{0x00, 0xa8, 0x85},{0x00, 0x20, 0x2d}};
  5206. const char *FunctionNames[2] = {"RPCRT4!WS_NewConnection", "RPCRT4!OSF_ADDRESS__NewConnection"};
  5207. int i, FunctionNo;
  5208. BOOL fNoSpew = FALSE;
  5209. for (FunctionNo = 0; FunctionNo < FunctionNamesSize; FunctionNo ++)
  5210. {
  5211. FunctionPtr = (PVOID)GetExpression(FunctionNames[FunctionNo]);
  5212. if (FunctionPtr == NULL)
  5213. {
  5214. dprintf("Cannot find address of %s - RPC symbols are wrong\n",
  5215. FunctionNames[FunctionNo]);
  5216. return;
  5217. }
  5218. b = GetData(HandleToUlong(FunctionPtr), &Data, sizeof(DWORD));
  5219. if (!b)
  5220. {
  5221. // under UM debugger this is bad symbols
  5222. if (fKD == 0)
  5223. {
  5224. dprintf("Cannot access address %x - RPC symbols are wrong\n", FunctionPtr);
  5225. return;
  5226. }
  5227. // in kd this is possible even with valid symbols
  5228. fUnsure = TRUE;
  5229. }
  5230. else
  5231. {
  5232. for (i = 0; i < ExpectedDataSize; i ++)
  5233. {
  5234. if (((IsPtr64() && ((Data & 0xFF) != ExpectedData_ia64[FunctionNo][i]) ||
  5235. (!IsPtr64()) && ((Data & 0xFF) != ExpectedData_x86[FunctionNo][i])))
  5236. && fNoSpew == FALSE)
  5237. {
  5238. dprintf("Function %s does not have expected\n"
  5239. "contents - debugger and debuggee have\n"
  5240. "different versions or architectures or the RPC\n"
  5241. "symbols are wrong\n\n",
  5242. FunctionNames[FunctionNo]);
  5243. fUnsure = TRUE;
  5244. fNoSpew = TRUE;
  5245. }
  5246. Data >>= 8;
  5247. }
  5248. }
  5249. }
  5250. if (fUnsure)
  5251. {
  5252. dprintf("The correctness of RPC symbols could not be determined conclusively\n");
  5253. }
  5254. else
  5255. {
  5256. dprintf("RPC symbols are correct\n");
  5257. }
  5258. }
  5259. typedef struct tagCallStackPatternMatch
  5260. {
  5261. const char *FunctionBase;
  5262. int ValueOffset; // 0 if the value is not relative to this symbols, or
  5263. // any positive/negative if the value is relative to
  5264. // this symbol
  5265. } CallStackPatternMatch;
  5266. typedef struct tagStackGroupPattern
  5267. {
  5268. CallStackPatternMatch *StackPattern;
  5269. int NumberOfEntries;
  5270. } StackGroupPattern;
  5271. CallStackPatternMatch WS_CallStack1[] = {{"kernel32!WaitForSingleObjectEx", 0},
  5272. {"rpcrt4!UTIL_WaitForSyncIO", 0},
  5273. {"rpcrt4!WS_SyncRecv", 0},
  5274. {"rpcrt4!WS_SyncRecv", 0},
  5275. {"rpcrt4!OSF_CCONNECTION__TransSendReceive", 0},
  5276. {"rpcrt4!OSF_CCONNECTION__SendFragment", 0},
  5277. {"rpcrt4!OSF_CCALL__SendNextFragment", 0},
  5278. {"rpcrt4!OSF_CCALL__FastSendReceive", 0},
  5279. {"rpcrt4!OSF_CCALL__SendReceiveHelper", 0},
  5280. {"rpcrt4!OSF_CCALL__SendReceive", 0},
  5281. {"rpcrt4!I_RpcSendReceive", 0},
  5282. {"rpcrt4!NdrSendReceive", sizeof(PVOID)}};
  5283. CallStackPatternMatch WS_CallStack2[] = {{"kernel32!WaitForSingleObjectEx", 0},
  5284. {"rpcrt4!UTIL_WaitForSyncIO", 0},
  5285. {"rpcrt4!UTIL_GetOverlappedResultEx", 0},
  5286. {"rpcrt4!WS_SyncRecv", 0},
  5287. {"rpcrt4!OSF_CCONNECTION__TransSendReceive", 0},
  5288. {"rpcrt4!OSF_CCONNECTION__SendFragment", 0},
  5289. {"rpcrt4!OSF_CCALL__SendNextFragment", 0},
  5290. {"rpcrt4!OSF_CCALL__FastSendReceive", 0},
  5291. {"rpcrt4!OSF_CCALL__SendReceiveHelper", 0},
  5292. {"rpcrt4!OSF_CCALL__SendReceive", 0},
  5293. {"rpcrt4!I_RpcSendReceive", 0},
  5294. {"rpcrt4!NdrSendReceive", sizeof(PVOID)}};
  5295. CallStackPatternMatch NMP_CallStack1[] = {{"kernel32!WaitForSingleObjectEx", 0},
  5296. {"rpcrt4!UTIL_WaitForSyncIO", 0},
  5297. {"rpcrt4!UTIL_GetOverlappedResultEx", 0},
  5298. {"rpcrt4!NMP_SyncSendRecv", 0},
  5299. {"rpcrt4!OSF_CCONNECTION__TransSendReceive", 0},
  5300. {"rpcrt4!OSF_CCONNECTION__SendFragment", 0},
  5301. {"rpcrt4!OSF_CCALL__SendNextFragment", 0},
  5302. {"rpcrt4!OSF_CCALL__FastSendReceive", 0},
  5303. {"rpcrt4!OSF_CCALL__SendReceiveHelper", 0},
  5304. {"rpcrt4!OSF_CCALL__SendReceive", 0},
  5305. {"rpcrt4!I_RpcSendReceive", 0},
  5306. {"rpcrt4!NdrSendReceive", sizeof(PVOID)}};
  5307. CallStackPatternMatch LRPC_CallStack1[] = {{"rpcrt4!LRPC_CCALL__SendReceive", 0},
  5308. {"rpcrt4!I_RpcSendReceive", 0},
  5309. {"rpcrt4!NdrSendReceive", sizeof(PVOID)}};
  5310. const int NumberOfWsCallStacks = 2;
  5311. StackGroupPattern WS_CallStacks[] = {{WS_CallStack1, 12}, {WS_CallStack2, 12}};
  5312. const int NumberOfNmpCallStacks = 1;
  5313. StackGroupPattern NMP_CallStacks[] = {{NMP_CallStack1, 12}};
  5314. const int NumberOfLrpcCallStacks = 1;
  5315. StackGroupPattern LRPC_CallStacks[] = {{LRPC_CallStack1, 3}};
  5316. BOOL VerboseStack = FALSE;
  5317. BOOL MatchStack(IN PVOID StackStart, IN StackGroupPattern *StackGroup,
  5318. IN int NumberOfElementsInGroup, OUT ULONG_PTR *Value)
  5319. {
  5320. int i;
  5321. BOOL Result;
  5322. ULONG_PTR CurrentPos;
  5323. ULONG_PTR CurrentValue;
  5324. ULONG_PTR Displacement;
  5325. int StackPatternPos; // the next stack entry to match
  5326. ULONG_PTR FinalValue = 0;
  5327. int ValueOffset;
  5328. CHAR CurrentName[256];
  5329. for (i = 0; i < NumberOfElementsInGroup; i ++)
  5330. {
  5331. CurrentPos = (ULONG_PTR)StackStart;
  5332. StackPatternPos = 0;
  5333. while (TRUE)
  5334. {
  5335. Result = GetData(CurrentPos, &CurrentValue, sizeof(ULONG_PTR));
  5336. if (Result == FALSE)
  5337. goto NextStack;
  5338. GetSymbol((ULONG64)CurrentValue, CurrentName, (PULONG64)&Displacement);
  5339. if (RpcpStringCompareA((const char *)CurrentName, StackGroup[i].StackPattern[StackPatternPos].FunctionBase) == 0)
  5340. {
  5341. if (VerboseStack)
  5342. {
  5343. dprintf("Stack: %d: Match with '%s'\n", i, CurrentName);
  5344. }
  5345. ValueOffset = StackGroup[i].StackPattern[StackPatternPos].ValueOffset;
  5346. if (ValueOffset != 0)
  5347. {
  5348. Result = GetData(CurrentPos + ValueOffset, &FinalValue,
  5349. sizeof(ULONG_PTR));
  5350. if (Result == FALSE)
  5351. goto NextStack;
  5352. }
  5353. StackPatternPos ++;
  5354. if (StackPatternPos >= StackGroup[i].NumberOfEntries)
  5355. {
  5356. // full stack match - return success
  5357. ASSERT(FinalValue != 0);
  5358. *Value = FinalValue;
  5359. return TRUE;
  5360. }
  5361. }
  5362. CurrentPos += sizeof(ULONG_PTR);
  5363. }
  5364. NextStack:
  5365. ;
  5366. }
  5367. return FALSE;
  5368. }
  5369. BOOL GetDataFromRpcMessage(IN ULONG_PTR RpcMessage, OUT ULONG_PTR *CallObject,
  5370. OUT DWORD *IfStart, OUT USHORT *ProcNum)
  5371. {
  5372. BOOL Result;
  5373. union
  5374. {
  5375. RPC_MESSAGE RpcMessage;
  5376. RPC_CLIENT_INTERFACE Interface;
  5377. } MemLoc;
  5378. ULONG_PTR Interface;
  5379. Result = GetData(RpcMessage, (PVOID) &MemLoc.RpcMessage, sizeof(MemLoc.RpcMessage));
  5380. if (Result == FALSE)
  5381. return FALSE;
  5382. *CallObject = (ULONG_PTR)MemLoc.RpcMessage.Handle;
  5383. *ProcNum = (USHORT)MemLoc.RpcMessage.ProcNum;
  5384. Interface = (ULONG_PTR)MemLoc.RpcMessage.RpcInterfaceInformation;
  5385. Result = GetData(Interface, &MemLoc.Interface, sizeof(MemLoc.Interface));
  5386. if (Result == FALSE)
  5387. return FALSE;
  5388. *IfStart = MemLoc.Interface.InterfaceId.SyntaxGUID.Data1;
  5389. return TRUE;
  5390. }
  5391. BOOL PrintDceBinding(ULONG_PTR DceBindingPointer)
  5392. {
  5393. NO_CONSTRUCTOR_TYPE(DCE_BINDING, DceBinding);
  5394. RPC_CHAR *RpcProtocolSequence;
  5395. RPC_CHAR *NetworkAddress;
  5396. RPC_CHAR *Endpoint;
  5397. BOOL Result;
  5398. Result = GetData(DceBindingPointer, DceBinding, sizeof(DCE_BINDING));
  5399. if (Result == FALSE)
  5400. return FALSE;
  5401. RpcProtocolSequence = ReadProcessRpcChar((ULONG64)DceBinding->RpcProtocolSequence);
  5402. if (RpcProtocolSequence) {
  5403. dprintf("\tProtocol Sequence: \t\"%ws\"\t(Address: %p)\n", RpcProtocolSequence, DceBinding->RpcProtocolSequence);
  5404. delete RpcProtocolSequence;
  5405. }
  5406. NetworkAddress = ReadProcessRpcChar((ULONG64)DceBinding->NetworkAddress);
  5407. if (NetworkAddress) {
  5408. dprintf("\tNetworkAddress:\t\t\"%ws\"\t(Address: %p)\n", NetworkAddress, DceBinding->NetworkAddress);
  5409. delete NetworkAddress;
  5410. }
  5411. Endpoint = ReadProcessRpcChar((ULONG64)DceBinding->Endpoint);
  5412. if (Endpoint) {
  5413. dprintf("\tEndpoint:\t\t\"%ws\" \t(Address: %p)\n", Endpoint, DceBinding->Endpoint);
  5414. delete Endpoint;
  5415. }
  5416. if ((RpcProtocolSequence == NULL) && (NetworkAddress == NULL)
  5417. && (Endpoint == NULL))
  5418. {
  5419. return FALSE;
  5420. }
  5421. return TRUE;
  5422. }
  5423. BOOL PrintOsfCallInfoFromRpcMessage(ULONG_PTR RpcMessage)
  5424. {
  5425. ULONG_PTR CallObject;
  5426. BOOL Result;
  5427. NO_CONSTRUCTOR_TYPE(OSF_CCALL, OsfCCall);
  5428. DWORD CallID;
  5429. DWORD IfStart;
  5430. USHORT ProcNum;
  5431. ULONG_PTR ConnPointer;
  5432. ULONG_PTR AssocPointer;
  5433. ULONG_PTR DceBindingPointer;
  5434. Result = GetDataFromRpcMessage(RpcMessage, &CallObject, &IfStart, &ProcNum);
  5435. if (Result == FALSE)
  5436. return FALSE;
  5437. Result = GetData(CallObject, OsfCCall, sizeof(OSF_CCALL));
  5438. if (Result == FALSE)
  5439. return FALSE;
  5440. CallID = OsfCCall->CallId;
  5441. dprintf("CallID: %d\n", CallID);
  5442. dprintf("IfStart: %x\n", IfStart);
  5443. dprintf("ProcNum: %d\n", (int)ProcNum);
  5444. ConnPointer = (ULONG_PTR)OsfCCall->Connection;
  5445. // get the association pointer
  5446. Result = GetData(ConnPointer + FIELD_OFFSET(OSF_CCONNECTION, Association), &AssocPointer,
  5447. sizeof(ULONG_PTR));
  5448. if (Result == FALSE)
  5449. return FALSE;
  5450. // get the dcebinding pointer
  5451. Result = GetData(AssocPointer + FIELD_OFFSET(OSF_CASSOCIATION, DceBinding), &DceBindingPointer,
  5452. sizeof(ULONG_PTR));
  5453. if (Result == FALSE)
  5454. return FALSE;
  5455. // print the DCE binding info
  5456. PrintDceBinding(DceBindingPointer);
  5457. return TRUE;
  5458. }
  5459. BOOL PrintLrpcCallInfoFromRpcMessage(ULONG_PTR RpcMessage)
  5460. {
  5461. ULONG_PTR CallObject;
  5462. BOOL Result;
  5463. NO_CONSTRUCTOR_TYPE(LRPC_CCALL, LrpcCCall);
  5464. DWORD CallID;
  5465. DWORD IfStart;
  5466. USHORT ProcNum;
  5467. ULONG_PTR AssocPointer;
  5468. ULONG_PTR DceBindingPointer;
  5469. Result = GetDataFromRpcMessage(RpcMessage, &CallObject, &IfStart, &ProcNum);
  5470. if (Result == FALSE)
  5471. return FALSE;
  5472. Result = GetData(CallObject, LrpcCCall, sizeof(LRPC_CCALL));
  5473. if (Result == FALSE)
  5474. return FALSE;
  5475. CallID = LrpcCCall->CallId;
  5476. dprintf("CallID: %d\n", CallID);
  5477. dprintf("IfStart: %x\n", IfStart);
  5478. dprintf("ProcNum: %d\n", (int)ProcNum);
  5479. AssocPointer = (ULONG_PTR)LrpcCCall->Association;
  5480. // get the dcebinding pointer
  5481. Result = GetData(AssocPointer + FIELD_OFFSET(LRPC_CASSOCIATION, DceBinding), &DceBindingPointer,
  5482. sizeof(ULONG_PTR));
  5483. if (Result == FALSE)
  5484. return FALSE;
  5485. // print the DCE binding info
  5486. PrintDceBinding(DceBindingPointer);
  5487. return TRUE;
  5488. }
  5489. DECLARE_API (rpcreadstack)
  5490. {
  5491. PVOID StackStart;
  5492. BOOL Result;
  5493. ULONG_PTR Value;
  5494. LPSTR lpArgumentString = (LPSTR)args;
  5495. StackStart = (PVOID)GetExpression(lpArgumentString);
  5496. // try to match the stack against the different types we support
  5497. // first, try Winsock
  5498. if (VerboseStack)
  5499. {
  5500. dprintf("Matching Winsock stacks\n");
  5501. }
  5502. Result = MatchStack(StackStart, WS_CallStacks, NumberOfWsCallStacks, &Value);
  5503. if (Result == TRUE)
  5504. {
  5505. // call the Winsock stack analysis function
  5506. PrintOsfCallInfoFromRpcMessage(Value);
  5507. return;
  5508. }
  5509. // next, try Named pipes
  5510. if (VerboseStack)
  5511. {
  5512. dprintf("Matching named pipe stacks\n");
  5513. }
  5514. Result = MatchStack(StackStart, NMP_CallStacks, NumberOfNmpCallStacks, &Value);
  5515. if (Result == TRUE)
  5516. {
  5517. // call the named pipe stack analysis function
  5518. PrintOsfCallInfoFromRpcMessage(Value);
  5519. return;
  5520. }
  5521. // next, try LRPC
  5522. if (VerboseStack)
  5523. {
  5524. dprintf("Matching LRPC stacks\n");
  5525. }
  5526. Result = MatchStack(StackStart, LRPC_CallStacks, NumberOfLrpcCallStacks, &Value);
  5527. if (Result == TRUE)
  5528. {
  5529. // call the Lrpc stack analysis function
  5530. PrintLrpcCallInfoFromRpcMessage(Value);
  5531. return;
  5532. }
  5533. dprintf("Not found!\n");
  5534. }
  5535. DECLARE_API (rpcverbosestack)
  5536. {
  5537. VerboseStack = !VerboseStack;
  5538. if (VerboseStack)
  5539. {
  5540. dprintf("Switched to ON\n");
  5541. }
  5542. else
  5543. {
  5544. dprintf("Switched to OFF\n");
  5545. }
  5546. }
  5547. VOID
  5548. do_eerecord(
  5549. ULONG64 qwAddr
  5550. )
  5551. {
  5552. ULONG64 tmp0;
  5553. ULONG64 tmp1;
  5554. ULONG tmp2;
  5555. unsigned char Buf[sizeof(ExtendedErrorInfo) + sizeof(ExtendedErrorParam) * (MaxNumberOfEEInfoParams - 1)];
  5556. ULONG64 EEInfoAddr;
  5557. BOOL Result;
  5558. int EEInfoSize;
  5559. RPC_CHAR *ComputerNameStr;
  5560. SYSTEMTIME SystemTime;
  5561. int i;
  5562. ULONG64 nLen;
  5563. ULONG64 TimeStamp;
  5564. ULONG64 ComputerName;
  5565. ULONG64 Params;
  5566. ULONG64 ParamType;
  5567. ULONG64 ParamAddr;
  5568. ULONG64 UnicodeStringAddr;
  5569. ULONG64 AnsiStringAddr;
  5570. ULONG64 BlobAddr;
  5571. ULONG64 nLength;
  5572. ULONG64 pString;
  5573. char *AnsiBuf;
  5574. RPC_CHAR *UnicodeBuf;
  5575. dprintf("eerecord at 0x%I64x:\n", qwAddr);
  5576. GET_MEMBER(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, nLen, nLen);
  5577. GET_MEMBER(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, TimeStamp, TimeStamp);
  5578. GET_ADDRESS_OF(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, Params, Params, tmp2);
  5579. GET_ADDRESS_OF(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, ComputerName, ComputerName, tmp2);
  5580. GET_MEMBER(ComputerName, EEComputerName, RPCRT4!EEComputerName, Type, tmp1);
  5581. if ((ULONG)tmp1 == eecnpPresent)
  5582. {
  5583. GET_ADDRESS_OF(ComputerName, EEComputerName, RPCRT4!EEComputerName, Name, tmp1, tmp2);
  5584. GET_MEMBER(tmp1, EEUString, RPCRT4!EEUString, pString, tmp0);
  5585. ComputerNameStr = ReadProcessRpcChar(tmp0);
  5586. if (ComputerNameStr != NULL)
  5587. {
  5588. dprintf("Computer Name: %S\n", ComputerNameStr);
  5589. delete ComputerNameStr;
  5590. }
  5591. }
  5592. else
  5593. {
  5594. dprintf("Computer Name: (null)\n");
  5595. }
  5596. PRINT_MEMBER_DECIMAL_AND_HEX(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, ProcessID, tmp0);
  5597. PRINT_MEMBER_DECIMAL_AND_HEX(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, Status, tmp0);
  5598. // BUG
  5599. dprintf ("TimeStamp=%I64x\n", TimeStamp);
  5600. Result = FileTimeToSystemTime((FILETIME *)&TimeStamp, &SystemTime);
  5601. if (Result)
  5602. {
  5603. dprintf("System Time is: %d/%d/%d %d:%d:%d:%d\n",
  5604. SystemTime.wMonth,
  5605. SystemTime.wDay,
  5606. SystemTime.wYear,
  5607. SystemTime.wHour,
  5608. SystemTime.wMinute,
  5609. SystemTime.wSecond,
  5610. SystemTime.wMilliseconds);
  5611. }
  5612. else
  5613. {
  5614. dprintf("Couldn't extract system time. Error is %d\n", GetLastError());
  5615. }
  5616. PRINT_MEMBER(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, GeneratingComponent, tmp0);
  5617. PRINT_MEMBER_DECIMAL_AND_HEX(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, Status, tmp0);
  5618. PRINT_MEMBER_DECIMAL_AND_HEX(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, DetectionLocation, tmp0);
  5619. GET_MEMBER(qwAddr, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, Flags, tmp0);
  5620. dprintf("Flags: %S %S\n",
  5621. tmp0 & EEInfoPreviousRecordsMissing ? "Previous Record Missing" : "",
  5622. tmp0 & EEInfoNextRecordsMissing ? "Next Record Missing" : "");
  5623. dprintf("nLen = %d\n", (int)nLen);
  5624. ParamAddr = Params;
  5625. for (i = 0; i < (int)nLen; i++)
  5626. {
  5627. dprintf("Parameter %d:", i);
  5628. GET_MEMBER(ParamAddr, tagParam, RPCRT4!tagParam, Type, ParamType);
  5629. switch((ULONG)ParamType)
  5630. {
  5631. case eeptiAnsiString:
  5632. dprintf("(Ansi string) : ");
  5633. GET_ADDRESS_OF(ParamAddr, tagParam, RPCRT4!tagParam, AnsiString, AnsiStringAddr, tmp2);
  5634. GET_MEMBER(AnsiStringAddr, tagEEAString, RPCRT4!tagEEAString, nLength, nLength);
  5635. GET_MEMBER(AnsiStringAddr, tagEEAString, RPCRT4!tagEEAString, pString, pString);
  5636. // we know the length - use GetData
  5637. AnsiBuf = new char [(unsigned)nLength];
  5638. if (AnsiBuf != NULL)
  5639. {
  5640. Result = GetData(pString,
  5641. AnsiBuf,
  5642. (ULONG)nLength);
  5643. if (Result)
  5644. {
  5645. dprintf("%s\n", AnsiBuf);
  5646. }
  5647. // else
  5648. // error info has already been printed - nothing to do
  5649. delete [] AnsiBuf;
  5650. }
  5651. break;
  5652. case eeptiUnicodeString:
  5653. dprintf("(Unicode string) : ");
  5654. GET_ADDRESS_OF(ParamAddr, tagParam, RPCRT4!tagParam, UnicodeString, UnicodeStringAddr, tmp2);
  5655. GET_MEMBER(UnicodeStringAddr, tagEEAString, RPCRT4!tagEEAString, nLength, nLength);
  5656. GET_MEMBER(UnicodeStringAddr, tagEEAString, RPCRT4!tagEEAString, pString, pString);
  5657. // we know the length - use GetData
  5658. UnicodeBuf = new RPC_CHAR [(unsigned)nLength];
  5659. if (UnicodeBuf != NULL)
  5660. {
  5661. Result = GetData(pString,
  5662. UnicodeBuf,
  5663. (ULONG)(nLength * sizeof(RPC_CHAR)));
  5664. if (Result)
  5665. {
  5666. dprintf("%S\n", UnicodeBuf);
  5667. }
  5668. // else
  5669. // error info has already been printed - nothing to do
  5670. delete [] UnicodeBuf;
  5671. }
  5672. break;
  5673. case eeptiLongVal:
  5674. PRINT_MEMBER_DECIMAL_AND_HEX(ParamAddr, tagParam, RPCRT4!tagParam, LVal, tmp0);
  5675. break;
  5676. case eeptiShortVal:
  5677. PRINT_MEMBER_DECIMAL_AND_HEX(ParamAddr, tagParam, RPCRT4!tagParam, IVal, tmp0);
  5678. break;
  5679. case eeptiPointerVal:
  5680. PRINT_MEMBER_DECIMAL_AND_HEX(ParamAddr, tagParam, RPCRT4!tagParam, PVal, tmp0);
  5681. break;
  5682. case eeptiNone:
  5683. dprintf("(Truncated value)\n");
  5684. break;
  5685. case eeptiBinary:
  5686. dprintf("(Binary value:)\n");
  5687. GET_ADDRESS_OF(ParamAddr, tagParam, RPCRT4!tagParam, Blob, BlobAddr, tmp2);
  5688. PRINT_MEMBER_DECIMAL_AND_HEX(BlobAddr, tagBinaryEEInfo, RPCRT4!tagBinaryEEInfo, nSize, tmp0);
  5689. PRINT_MEMBER_DECIMAL_AND_HEX(BlobAddr, tagBinaryEEInfo, RPCRT4!tagBinaryEEInfo, pBlob, tmp0);
  5690. break;
  5691. default:
  5692. dprintf("Invalid type: %d\n", (ULONG)ParamType);
  5693. }
  5694. ParamAddr += GET_TYPE_SIZE(tagParam, RPCRT4!tagParam);
  5695. }
  5696. }
  5697. VOID
  5698. do_eeinfo(
  5699. ULONG64 qwAddr
  5700. )
  5701. {
  5702. ULONG64 PrevNextElement = qwAddr;
  5703. ULONG64 NextElement = qwAddr;
  5704. ULONG64 FirstElement = qwAddr;
  5705. BOOL Result;
  5706. do
  5707. {
  5708. do_eerecord(NextElement);
  5709. PrevNextElement = NextElement;
  5710. GET_MEMBER(NextElement, ExtendedErrorInfo, RPCRT4!ExtendedErrorInfo, Next, NextElement);
  5711. // prevent loops
  5712. if (NextElement == FirstElement)
  5713. {
  5714. dprintf("Loop detected - exitting ...\n");
  5715. return;
  5716. }
  5717. dprintf("------------------------\n");
  5718. }
  5719. while(NextElement != 0 && PrevNextElement != NextElement);
  5720. }
  5721. VOID PrintTypeinfoUsage(VOID) {
  5722. dprintf("Wrong arguments to !rpcexts.typeinfo\n");
  5723. dprintf("Please use !rpcexts.typeinfo on|off\n");
  5724. }
  5725. DECLARE_API (typeinfo)
  5726. {
  5727. LPSTR lpArgumentString = (LPSTR)args;
  5728. if (strcmp(lpArgumentString, "on") == 0)
  5729. fUseTypeInfo = TRUE;
  5730. else if (strcmp(lpArgumentString, "off") == 0)
  5731. fUseTypeInfo = FALSE;
  5732. else if (strcmp(lpArgumentString, "") == 0)
  5733. {
  5734. if (fUseTypeInfo == TRUE)
  5735. dprintf ("typeinfo use is on\n");
  5736. else
  5737. dprintf ("typeinfo use is off\n");
  5738. }
  5739. else
  5740. PrintTypeinfoUsage();
  5741. return;
  5742. }
  5743. VOID PrintStackMatchUsage(VOID) {
  5744. dprintf("Wrong arguments to !rpcexts.stackmatch");
  5745. dprintf("Please use !rpcexts.stackmatch start_addr [depth]\n");
  5746. }
  5747. DECLARE_API( stackmatch )
  5748. {
  5749. static ULONG64 Start;
  5750. static ULONG Depth = 0x80;
  5751. CHAR Symbol[128];
  5752. ULONG64 Displacement = 0;
  5753. CHAR ObjSymbol[128];
  5754. ULONG64 ObjDisplacement = 0;
  5755. //
  5756. // Interpret options.
  5757. //
  5758. ULONG ProcessID = 0;
  5759. int ArgumentNo = 0;
  5760. DebugCellID CellID;
  5761. char *DotSeparator;
  5762. //
  5763. // Interpret options.
  5764. //
  5765. char * arg;
  5766. LPSTR lpArgumentString = (LPSTR)args;
  5767. for (arg=strtok(lpArgumentString); arg; arg = strtok(0))
  5768. {
  5769. switch(ArgumentNo)
  5770. {
  5771. case 0:
  5772. Start = GetExpression(arg);
  5773. break;
  5774. case 1:
  5775. Depth = (ULONG) GetExpression(arg);
  5776. break;
  5777. default:
  5778. dprintf("Too many arguments\n");
  5779. PrintStackMatchUsage();
  5780. }
  5781. ArgumentNo ++;
  5782. }
  5783. for (ULONG64 Addr=Start; Addr<=Start+Depth; Addr+=AddressSize) {
  5784. ULONG64 Val;
  5785. ReadPtrUnextend(Addr, &Val);
  5786. dprintf("%I64p %I64p", Addr, Val);
  5787. GetSymbol(Val, Symbol, &Displacement);
  5788. if (strcmp(Symbol, "") != 0)
  5789. dprintf(" %s+%x", Symbol, Displacement);
  5790. else {
  5791. ULONG64 Obj;
  5792. ReadPtrUnextend(Val, &Obj);
  5793. if (Obj) {
  5794. dprintf(" -> %I64p", Obj);
  5795. GetSymbol(Obj, ObjSymbol, &ObjDisplacement);
  5796. if (strcmp(ObjSymbol, "") != 0)
  5797. dprintf(" %s+%x", ObjSymbol, ObjDisplacement);
  5798. }
  5799. }
  5800. dprintf("\n");
  5801. }
  5802. Start = Addr;
  5803. }
  5804. DECLARE_API( listcalls )
  5805. {
  5806. ULONG64 qwAddr;
  5807. BOOL fArgSpecified = FALSE;
  5808. ULONG64 ServerAddress;
  5809. LPSTR lpArgumentString = (LPSTR)args;
  5810. if (0 == strtok(lpArgumentString))
  5811. {
  5812. lpArgumentString = "rpcrt4!GlobalRpcServer";
  5813. fArgSpecified = TRUE;
  5814. }
  5815. qwAddr = GetExpression(lpArgumentString);
  5816. if ( !qwAddr )
  5817. {
  5818. dprintf("Error: can't evaluate '%s'\n", lpArgumentString);
  5819. return;
  5820. }
  5821. if (fArgSpecified)
  5822. {
  5823. if (ReadPtrUnextend(qwAddr, &ServerAddress))
  5824. {
  5825. dprintf("couldn't read memory at address 0x%I64x\n", qwAddr);
  5826. return;
  5827. }
  5828. }
  5829. else
  5830. ServerAddress = qwAddr;
  5831. do_listcalls(ServerAddress);
  5832. }
  5833. VOID LoopThroughDict(ULONG64 Dict, PCHAR offset) {
  5834. ULONG64 tmp0;
  5835. ULONG64 tmp1;
  5836. ULONG tmp2;
  5837. ULONG64 cDictSize;
  5838. ULONG64 cDictSlots;
  5839. ULONG64 DictSlots;
  5840. int j;
  5841. ULONG64 DictSlot;
  5842. GET_MEMBER(Dict, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, cDictSize, cDictSize);
  5843. GET_MEMBER(Dict, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, cDictSlots, cDictSlots);
  5844. if ((ULONG)cDictSize > (ULONG)cDictSlots)
  5845. {
  5846. dprintf("Bad dictionary\t\t- %I64p\n", Dict);
  5847. return;
  5848. }
  5849. GET_MEMBER(Dict, SIMPLE_DICT, RPCRT4!SIMPLE_DICT, DictSlots, DictSlots);
  5850. dprintf("%sPrinting %d items in dictionary: %I64p with %d slots\n\n", offset, (ULONG)cDictSize, Dict, (ULONG)cDictSlots);
  5851. // Loop throught the associations.
  5852. for (j = 0; j < MIN((int)cDictSize, MAX_ITEMS_IN_DICTIONARY); j++)
  5853. {
  5854. if (!ReadPtrUnextend(DictSlots + j * AddressSize, &DictSlot))
  5855. dprintf ("%s(%d): 0x%I64x - ", offset, j, DictSlot);
  5856. ULONG64 MagicValue;
  5857. ULONG64 ObjectType;
  5858. ULONG64 LocalDict;
  5859. if (ReadPtrUnextend(DictSlot+AddressSize, &MagicValue) ||
  5860. ReadPtrUnextend(DictSlot+AddressSize+4, &ObjectType)) {
  5861. dprintf("Bad or deleted object at %p\n", DictSlot);
  5862. return;
  5863. }
  5864. if ((ULONG)MagicValue != MAGICLONG)
  5865. {
  5866. dprintf("Bad or deleted object at %p\n", DictSlot);
  5867. return;
  5868. }
  5869. switch (((ULONG)ObjectType) & (~OBJECT_DELETED))
  5870. {
  5871. case DG_ADDRESS_TYPE:
  5872. dprintf("DG_ADDRESS\n");
  5873. break;
  5874. case OSF_ADDRESS_TYPE:
  5875. dprintf("OSF_ADDRESS\n");
  5876. GET_ADDRESS_OF(DictSlot, OSF_ADDRESS, RPCRT4!OSF_ADDRESS, Associations, LocalDict, tmp2);
  5877. LoopThroughDict(LocalDict, "\t\t");
  5878. break;
  5879. case LRPC_ADDRESS_TYPE:
  5880. dprintf("LRPC_ADDRESS\n");
  5881. GET_ADDRESS_OF(DictSlot, LRPC_ADDRESS, RPCRT4!LRPC_ADDRESS, AssociationDictionary, LocalDict, tmp2);
  5882. LoopThroughDict(LocalDict, "\t\t");
  5883. break;
  5884. case OSF_ASSOCIATION_TYPE:
  5885. dprintf("OSF_ASSOCIATION_TYPE\n");
  5886. break;
  5887. case LRPC_SASSOCIATION_TYPE:
  5888. dprintf("LRPC_SASSOCIATION_TYPE\n");
  5889. break;
  5890. default:
  5891. dprintf("The RPC object type is 0x%lx and I don't recognize it.\n", (ObjectType) & ~(OBJECT_DELETED));
  5892. }
  5893. }
  5894. }
  5895. VOID
  5896. do_listcalls(
  5897. ULONG64 qwAddr
  5898. )
  5899. {
  5900. ULONG64 tmp0;
  5901. ULONG64 tmp1;
  5902. ULONG tmp2;
  5903. dprintf("\n");
  5904. dprintf("RPC_SERVER at 0x%I64x\n", qwAddr);
  5905. ULONG64 RpcAddressDictionary;
  5906. GET_ADDRESS_OF(qwAddr, RPC_SERVER, RPCRT4!RPC_SERVER, RpcAddressDictionary, RpcAddressDictionary, tmp2);
  5907. dprintf("&RpcAddressDictionary(RPC_SIMPLE_DICT) - 0x%I64x\n", RpcAddressDictionary);
  5908. LoopThroughDict(RpcAddressDictionary, "\t");
  5909. dprintf("\n");
  5910. }
  5911. DECLARE_API( rpcverifier )
  5912. {
  5913. ULONG64 qwAddr;
  5914. ULONG64 tmp1;
  5915. dprintf("\n");
  5916. dprintf("gfAppVerifierEnabled = %d\n", GetVar("rpcrt4!gfAppVerifierEnabled"));
  5917. dprintf("gfRPCVerifierEnabled = %d\n\n", GetVar("rpcrt4!gfRPCVerifierEnabled"));
  5918. if (!((BOOL)GetVar("rpcrt4!gfRPCVerifierEnabled")))return;
  5919. qwAddr = GetVar("rpcrt4!pRpcVerifierSettings");
  5920. dprintf("RpcVerifierFlags = 0x%x\n\n", GetVar("rpcrt4!RpcVerifierFlags"));
  5921. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, fFaultInjectImpersonateClient, "FaultInjectImpersonateClient", tmp1);
  5922. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, ProbFaultInjectImpersonateClient, "ProbFaultInjectImpersonateClient", tmp1);
  5923. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, DelayFaultInjectImpersonateClient, "DelayFaultInjectImpersonateClient", tmp1);
  5924. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, fCorruptionInjectServerReceives, "CorruptionInjectServerReceives", tmp1);
  5925. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, fCorruptionInjectClientReceives, "CorruptionInjectClientReceives", tmp1);
  5926. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, ProbRpcHeaderCorruption, "ProbRpcHeaderCorruption", tmp1);
  5927. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, ProbDataCorruption, "ProbDataCorruption", tmp1);
  5928. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, ProbSecureDataCorruption, "ProbSecureDataCorruption", tmp1);
  5929. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, CorruptionPattern, "CorruptionPattern", tmp1);
  5930. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, CorruptionSizeType, "CorruptionSizeType", tmp1);
  5931. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, CorruptionSize, "CorruptionSize", tmp1);
  5932. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, CorruptionDistributionType, "CorruptionDistributionType", tmp1);
  5933. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, ProbBufferTruncation, "ProbBufferTruncation", tmp1);
  5934. PRINT_MEMBER_WITH_LABEL(qwAddr, tRpcVerifierSettings, RPCRT4!tRpcVerifierSettings, MaxBufferTruncationSize, "MaxBufferTruncationSize", tmp1);
  5935. dprintf("\n");
  5936. }