Source code of Windows XP (NT5)
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.

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