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

1032 lines
23 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. context.c
  5. Abstract:
  6. Dumps the AML Context Structure in Human-Readable-Form (HRF)
  7. Author:
  8. Stephane Plante (splante) 21-Mar-1997
  9. Environment:
  10. User Mode.
  11. Revision History:
  12. --*/
  13. #include "pch.h"
  14. VOID
  15. dumpAccessFieldObject(
  16. IN ULONG_PTR AccessFieldAddress,
  17. IN ULONG Verbose,
  18. IN ULONG IndentLevel
  19. )
  20. {
  21. ACCFIELDOBJ fieldObj;
  22. BOOL result;
  23. UCHAR buffer[80];
  24. ULONG returnLength;
  25. //
  26. // Initialize the indent buffer
  27. //
  28. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  29. memset( buffer, ' ', IndentLevel );
  30. buffer[IndentLevel] = '\0';
  31. result = ReadMemory(
  32. AccessFieldAddress,
  33. &fieldObj,
  34. sizeof(ACCFIELDOBJ),
  35. &returnLength
  36. );
  37. if (result != TRUE ||
  38. returnLength != sizeof(ACCFIELDOBJ) ||
  39. fieldObj.FrameHdr.dwSig != SIG_ACCFIELDOBJ) {
  40. dprintf(
  41. "%sdumpAccessFieldUnit: Coult not read ACCFIELDOBJ %08lx\n",
  42. buffer,
  43. AccessFieldAddress
  44. );
  45. return;
  46. }
  47. dprintf(
  48. "%sAccess Field Object - %08lx\n"
  49. "%s Field Data Object: %08lx\n",
  50. buffer, AccessFieldAddress,
  51. buffer, fieldObj.pdataObj
  52. );
  53. if (fieldObj.pdataObj != NULL && (Verbose & VERBOSE_CONTEXT)) {
  54. dumpPObject(
  55. (ULONG_PTR) fieldObj.pdataObj,
  56. Verbose,
  57. IndentLevel + 4
  58. );
  59. }
  60. dprintf(
  61. "%s Target Buffer: %08lx - %08lx\n"
  62. "%s Access Size: %08lx\n"
  63. "%s # of Accesses: %08lx\n"
  64. "%s Data Mask: %08lx\n"
  65. "%s # of Left Bits: %08lx\n"
  66. "%s # of Right Bits: %08lx\n"
  67. "%s Index to #/Accesses: %08lx\n"
  68. "%s Temp Data: %08lx\n",
  69. buffer, fieldObj.pbBuff, fieldObj.pbBuffEnd,
  70. buffer, fieldObj.dwAccSize,
  71. buffer, fieldObj.dwcAccesses,
  72. buffer, fieldObj.dwDataMask,
  73. buffer, fieldObj.iLBits,
  74. buffer, fieldObj.iRBits,
  75. buffer, fieldObj.iAccess,
  76. buffer, fieldObj.dwData
  77. );
  78. dprintf(
  79. "%s Field Descriptor: %p\n",
  80. buffer,
  81. ( (ULONG_PTR) &(fieldObj.fd) - (ULONG_PTR) &fieldObj + AccessFieldAddress )
  82. );
  83. dumpFieldAddress(
  84. ( (ULONG_PTR) &(fieldObj.fd) - (ULONG_PTR) &fieldObj + AccessFieldAddress ),
  85. Verbose,
  86. IndentLevel + 4
  87. );
  88. }
  89. VOID
  90. dumpAccessFieldUnit(
  91. IN ULONG_PTR AccessFieldAddress,
  92. IN ULONG Verbose,
  93. IN ULONG IndentLevel
  94. )
  95. {
  96. ACCFIELDUNIT fieldUnit;
  97. BOOL result;
  98. UCHAR buffer[80];
  99. ULONG returnLength;
  100. //
  101. // Initialize the indent buffer
  102. //
  103. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  104. memset( buffer, ' ', IndentLevel );
  105. buffer[IndentLevel] = '\0';
  106. result = ReadMemory(
  107. AccessFieldAddress,
  108. &fieldUnit,
  109. sizeof(ACCFIELDUNIT),
  110. &returnLength
  111. );
  112. if (result != TRUE ||
  113. returnLength != sizeof(ACCFIELDUNIT) ||
  114. fieldUnit.FrameHdr.dwSig != SIG_ACCFIELDUNIT) {
  115. dprintf(
  116. "%sdumpAccessFieldUnit: Coult not read ACCFIELDUNIT %08lx\n",
  117. buffer,
  118. AccessFieldAddress
  119. );
  120. return;
  121. }
  122. dprintf(
  123. "%sAccess Field Unit - %08lx\n"
  124. "%s Field Data Object: %08lx\n",
  125. buffer, AccessFieldAddress,
  126. buffer, fieldUnit.pdataObj
  127. );
  128. if (fieldUnit.pdataObj != NULL && (Verbose & VERBOSE_CONTEXT)) {
  129. dumpPObject(
  130. (ULONG_PTR) fieldUnit.pdataObj,
  131. Verbose,
  132. IndentLevel + 4
  133. );
  134. }
  135. dprintf(
  136. "%s Source/Result Object: %08lx\n",
  137. buffer,
  138. fieldUnit.pdata
  139. );
  140. if (fieldUnit.pdata != NULL && (Verbose & VERBOSE_CONTEXT)) {
  141. dumpPObject(
  142. (ULONG_PTR) fieldUnit.pdata,
  143. Verbose,
  144. IndentLevel + 4
  145. );
  146. }
  147. }
  148. VOID
  149. dumpAmlTerm(
  150. IN ULONG_PTR AmlTermAddress,
  151. IN ULONG Verbose,
  152. IN ULONG IndentLevel
  153. )
  154. {
  155. AMLTERM amlTerm;
  156. BOOL result;
  157. INT i;
  158. UCHAR buffer[80];
  159. ULONG returnLength;
  160. //
  161. // Initialize the indent buffer
  162. //
  163. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  164. memset( buffer, ' ', IndentLevel );
  165. buffer[IndentLevel] = '\0';
  166. result = ReadMemory(
  167. AmlTermAddress,
  168. &amlTerm,
  169. sizeof(AMLTERM),
  170. &returnLength
  171. );
  172. if (result != TRUE || returnLength != sizeof(AMLTERM)) {
  173. dprintf(
  174. "\n%sdumpAmlTerm: Could not read AMLTERM 0x%08lx\n",
  175. buffer,
  176. AmlTermAddress
  177. );
  178. return;
  179. }
  180. if (amlTerm.pszTermName != NULL) {
  181. result = ReadMemory(
  182. (ULONG_PTR) amlTerm.pszTermName,
  183. Buffer,
  184. 32,
  185. &returnLength
  186. );
  187. if (result && returnLength <= 32) {
  188. Buffer[returnLength] = '\0';
  189. dprintf(" - %s\n", Buffer );
  190. }
  191. }
  192. }
  193. VOID
  194. dumpCall(
  195. IN ULONG_PTR CallAddress,
  196. IN ULONG Verbose,
  197. IN ULONG IndentLevel
  198. )
  199. {
  200. BOOL result;
  201. CALL call;
  202. INT i;
  203. UCHAR buffer[80];
  204. ULONG returnLength;
  205. //
  206. // Initialize the indent buffer
  207. //
  208. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  209. memset( buffer, ' ', IndentLevel );
  210. buffer[IndentLevel] = '\0';
  211. result = ReadMemory(
  212. CallAddress,
  213. &call,
  214. sizeof(CALL),
  215. &returnLength
  216. );
  217. if (result != TRUE ||
  218. returnLength != sizeof(CALL) ||
  219. call.FrameHdr.dwSig != SIG_CALL) {
  220. dprintf(
  221. "%sdumpCall: Coult not read CALL %08lx\n",
  222. buffer,
  223. CallAddress
  224. );
  225. return;
  226. }
  227. dprintf(
  228. "%sCall - %08lx\n", buffer, CallAddress
  229. );
  230. //
  231. // Method
  232. //
  233. dprintf(
  234. "%s Method: %08lx\n",
  235. buffer,
  236. call.pnsMethod
  237. );
  238. if (call.pnsMethod != NULL && (Verbose & VERBOSE_CONTEXT)) {
  239. dumpNSObject( (ULONG_PTR) call.pnsMethod, Verbose, IndentLevel + 4);
  240. }
  241. //
  242. // Previous Call Frame
  243. //
  244. if (Verbose & VERBOSE_CALL) {
  245. dprintf(
  246. "%s Previous Call Frame: %08lx\n"
  247. "%s Previous Owner: %08lx\n",
  248. buffer,
  249. call.pcallPrev,
  250. buffer,
  251. call.pownerPrev
  252. );
  253. if (call.pownerPrev != NULL && (Verbose & VERBOSE_CONTEXT)) {
  254. dumpObjectOwner(
  255. (ULONG_PTR) call.pownerPrev,
  256. IndentLevel + 2
  257. );
  258. }
  259. }
  260. if (Verbose & VERBOSE_CONTEXT) {
  261. //
  262. // Dump arguments
  263. //
  264. dprintf(
  265. "%s Arguments (Current): %1d (%1d)\n",
  266. buffer,
  267. call.icArgs,
  268. call.iArg
  269. );
  270. for (i = 0; i < call.icArgs; i++) {
  271. dprintf(
  272. "%s Argument(%d): %p\n",
  273. buffer,
  274. i,
  275. (ULONG_PTR) (call.pdataArgs + i)
  276. );
  277. dumpPObject(
  278. (ULONG_PTR) (call.pdataArgs + i),
  279. Verbose,
  280. IndentLevel + 4
  281. );
  282. }
  283. dprintf(
  284. "%s Result: %08lx\n",
  285. buffer,
  286. call.pdataResult
  287. );
  288. if (call.pdataResult != NULL) {
  289. dumpPObject(
  290. (ULONG_PTR) call.pdataResult,
  291. Verbose,
  292. IndentLevel + 4
  293. );
  294. }
  295. if (Verbose & VERBOSE_CALL) {
  296. dprintf(
  297. "%s Locals:\n",
  298. buffer
  299. );
  300. for (i = 0; i < MAX_NUM_LOCALS; i++) {
  301. dumpObject(
  302. (ULONG) ( (PUCHAR) &(call.Locals[i]) - (PUCHAR) &call) +
  303. CallAddress,
  304. &(call.Locals[i]),
  305. Verbose,
  306. IndentLevel + 4
  307. );
  308. }
  309. }
  310. }
  311. }
  312. VOID
  313. dumpContext(
  314. IN ULONG_PTR ContextAddress,
  315. IN ULONG Verbose
  316. )
  317. /*++
  318. Routine Description:
  319. This routine dumps a context structure in HRF
  320. Arguments:
  321. ContextAddress - Where on the target machine the context is located
  322. Verbose - How verbose we should be
  323. Return Value:
  324. None
  325. --*/
  326. {
  327. ULONG_PTR displacement;
  328. BOOL result;
  329. CTXT context;
  330. ULONG returnLength;
  331. //
  332. // Read the context from the target
  333. //
  334. result = ReadMemory(
  335. ContextAddress,
  336. &context,
  337. sizeof(CTXT),
  338. &returnLength
  339. );
  340. if (result != TRUE || returnLength != sizeof(CTXT) ) {
  341. dprintf(
  342. "dumpContext: could not read CTXT %08lx\n",
  343. ContextAddress
  344. );
  345. return;
  346. }
  347. //
  348. // Is it a context?
  349. //
  350. if (context.dwSig != SIG_CTXT) {
  351. dprintf(
  352. "dumpContext: Signature (%08lx) != SIG_CTXT (%08lx)\n",
  353. context.dwSig,
  354. SIG_CTXT
  355. );
  356. return;
  357. }
  358. dprintf("Context - %08lx-%08lx\n",ContextAddress, context.pbCtxtEnd );
  359. if (Verbose & VERBOSE_CONTEXT) {
  360. dprintf(
  361. " AllocatedContextList: F:%08lx B:%08lx\n"
  362. " QueingContextList: F:%08lx B:%08lx\n"
  363. " ContextListHead: %08lx\n"
  364. " SynchronizeLevel: %08lx\n"
  365. " CurrentOpByte: %08lx\n"
  366. " AsyncCallBack: %08lx",
  367. context.listCtxt.plistNext, context.listCtxt.plistPrev,
  368. context.listQueue.plistNext, context.listQueue.plistPrev,
  369. context.pplistCtxtQueue,
  370. context.dwSyncLevel,
  371. context.pbOp,
  372. context.pfnAsyncCallBack
  373. );
  374. if (context.pfnAsyncCallBack != NULL) {
  375. GetSymbol(
  376. context.pfnAsyncCallBack,
  377. Buffer,
  378. &displacement
  379. );
  380. dprintf(" %s",
  381. Buffer
  382. );
  383. }
  384. dprintf(
  385. "\n"
  386. " AsyncCallBackContext: %08lx\n"
  387. " AsyncDataCallBack: %08lx\n",
  388. context.pvContext,
  389. context.pdataCallBack
  390. );
  391. }
  392. dprintf(
  393. " Flags: %08lx",
  394. context.dwfCtxt
  395. );
  396. if (context.dwfCtxt & CTXTF_TIMER_PENDING) {
  397. dprintf(" Timer");
  398. }
  399. if (context.dwfCtxt & CTXTF_TIMEOUT) {
  400. dprintf(" Timeout");
  401. }
  402. if (context.dwfCtxt & CTXTF_READY) {
  403. dprintf(" Ready");
  404. }
  405. if (context.dwfCtxt & CTXTF_NEED_CALLBACK) {
  406. dprintf(" CallBack");
  407. }
  408. dprintf("\n");
  409. dprintf(
  410. " NameSpace Object: %08lx\n",
  411. context.pnsObj
  412. );
  413. if (Verbose & VERBOSE_CONTEXT) {
  414. dprintf(
  415. " NameSpace Scope: %08lx\n"
  416. " NameSpace Owner: %08lx\n",
  417. context.pnsScope,
  418. context.powner
  419. );
  420. if (context.powner != NULL) {
  421. dumpObjectOwner(
  422. (ULONG_PTR) context.powner,
  423. 2
  424. );
  425. }
  426. }
  427. dprintf(
  428. " Current Call Frame: %08lx\n",
  429. context.pcall
  430. );
  431. if (context.pcall != NULL) {
  432. dumpCall(
  433. (ULONG_PTR) context.pcall,
  434. (Verbose & ~VERBOSE_CONTEXT),
  435. 4
  436. );
  437. }
  438. dumpStack(
  439. ContextAddress,
  440. &context,
  441. Verbose,
  442. 2
  443. );
  444. }
  445. VOID
  446. dumpFieldAddress(
  447. IN ULONG_PTR FieldAddress,
  448. IN ULONG Verbose,
  449. IN ULONG IndentLevel
  450. )
  451. {
  452. FIELDDESC fd;
  453. BOOL result;
  454. UCHAR buffer[80];
  455. ULONG returnLength;
  456. //
  457. // Initialize the indent buffer
  458. //
  459. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  460. memset( buffer, ' ', IndentLevel );
  461. buffer[IndentLevel] = '\0';
  462. result = ReadMemory(
  463. FieldAddress,
  464. &fd,
  465. sizeof(FIELDDESC),
  466. &returnLength
  467. );
  468. if (result != TRUE ||
  469. returnLength != sizeof(FIELDDESC) ) {
  470. dprintf(
  471. "%sdumpFieldAddress: Coult not read FIELDDESC %08lx\n",
  472. buffer,
  473. FieldAddress
  474. );
  475. return;
  476. }
  477. dprintf(
  478. "%sField Descriptor - %08lx\n"
  479. "%s ByteOffset: %08lx\n"
  480. "%s Start Bit Position: %08lx\n"
  481. "%s Number of Bits: %08lx\n"
  482. "%s Flags: %08lx\n",
  483. buffer, FieldAddress,
  484. buffer, fd.dwByteOffset,
  485. buffer, fd.dwStartBitPos,
  486. buffer, fd.dwNumBits,
  487. buffer, fd.dwFieldFlags
  488. );
  489. }
  490. VOID
  491. dumpListContexts(
  492. IN VOID
  493. )
  494. /*++
  495. --*/
  496. {
  497. PLIST pList;
  498. PLIST pListNext;
  499. }
  500. VOID
  501. dumpObjectOwner(
  502. IN ULONG_PTR ObjOwnerAddress,
  503. IN ULONG IndentLevel
  504. )
  505. {
  506. BOOL result;
  507. OBJOWNER objowner;
  508. UCHAR buffer[80];
  509. ULONG returnLength;
  510. //
  511. // Initialize the indent buffer
  512. //
  513. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  514. memset( buffer, ' ', IndentLevel );
  515. buffer[IndentLevel] = '\0';
  516. result = ReadMemory(
  517. ObjOwnerAddress,
  518. &objowner,
  519. sizeof(OBJOWNER),
  520. &returnLength
  521. );
  522. if (result == TRUE &&
  523. returnLength == sizeof(OBJOWNER) &&
  524. objowner.dwSig == SIG_OBJOWNER) {
  525. dprintf(
  526. "%sObjectOwner - %08lx\n"
  527. "%s NameSpaceObject: %08lx\n"
  528. "%s List: F:%08lx B:%08lx\n",
  529. buffer,
  530. ObjOwnerAddress,
  531. buffer,
  532. objowner.pnsObjList,
  533. buffer,
  534. objowner.list.plistNext,
  535. objowner.list.plistPrev
  536. );
  537. } else {
  538. dprintf(
  539. "%sdumpObjectOwner: Could not read OBJOWNER %08lx\n",
  540. buffer,ObjOwnerAddress
  541. );
  542. }
  543. }
  544. VOID
  545. dumpScope(
  546. IN ULONG_PTR ScopeAddress,
  547. IN ULONG Verbose,
  548. IN ULONG IndentLevel
  549. )
  550. {
  551. BOOL result;
  552. SCOPE scope;
  553. UCHAR indent[80];
  554. ULONG returnLength;
  555. //
  556. // Initialize the indent buffer
  557. //
  558. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  559. memset( indent, ' ', IndentLevel );
  560. indent[IndentLevel] = '\0';
  561. result = ReadMemory(
  562. ScopeAddress,
  563. &scope,
  564. sizeof(SCOPE),
  565. &returnLength
  566. );
  567. if (result != TRUE ||
  568. returnLength != sizeof(SCOPE) ||
  569. scope.FrameHdr.dwSig != SIG_SCOPE) {
  570. dprintf(
  571. "%sdumpScope: Coult not read SCOPE %08lx\n",
  572. indent,
  573. ScopeAddress
  574. );
  575. return;
  576. }
  577. dprintf(
  578. "%sScope - %08lx\n",
  579. indent,
  580. ScopeAddress
  581. );
  582. dprintf(
  583. "%s ScopeEnd: %08lx\n"
  584. "%s ReturnAddress: %08lx\n"
  585. "%s Previous Scope: %08lx\n",
  586. indent,
  587. scope.pbOpEnd,
  588. indent,
  589. scope.pbOpRet,
  590. indent,
  591. scope.pnsPrevScope
  592. );
  593. if (Verbose & VERBOSE_CALL) {
  594. dumpNSObject( (ULONG_PTR) scope.pnsPrevScope, Verbose, IndentLevel + 4);
  595. }
  596. dprintf(
  597. "%s Previous Owner: %08lx\n",
  598. indent,
  599. scope.pownerPrev
  600. );
  601. if (Verbose & VERBOSE_CALL) {
  602. dumpObjectOwner(
  603. (ULONG_PTR) scope.pownerPrev,
  604. IndentLevel + 4
  605. );
  606. }
  607. dprintf(
  608. "%s Result Object: %08lx\n",
  609. indent,
  610. scope.pdataResult
  611. );
  612. if (scope.pdataResult != NULL && (Verbose & VERBOSE_CALL) ) {
  613. dumpPObject(
  614. (ULONG_PTR) scope.pdataResult,
  615. Verbose,
  616. IndentLevel + 4
  617. );
  618. }
  619. }
  620. VOID
  621. dumpStack(
  622. IN ULONG_PTR ContextAddress,
  623. IN PCTXT Context,
  624. IN ULONG Verbose,
  625. IN ULONG IndentLevel
  626. )
  627. {
  628. ULONG_PTR displacement;
  629. BOOL result;
  630. FRAMEHDR frame;
  631. PUCHAR frameAddress;
  632. UCHAR indent[80];
  633. UCHAR buffer[5];
  634. ULONG returnLength;
  635. //
  636. // Initialize the indent buffer
  637. //
  638. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  639. memset( indent, ' ', IndentLevel );
  640. indent[IndentLevel] = '\0';
  641. buffer[4] = '\0';
  642. dprintf(
  643. "%sStack - %p-%08lx (%08lx)\n",
  644. indent,
  645. ContextAddress,
  646. Context->LocalHeap.pbHeapEnd,
  647. Context->pbCtxtEnd
  648. );
  649. //
  650. // Calculate where the first frame lies
  651. //
  652. frameAddress = Context->LocalHeap.pbHeapEnd;
  653. while (frameAddress < Context->pbCtxtEnd) {
  654. result = ReadMemory(
  655. (ULONG_PTR) frameAddress,
  656. &frame,
  657. sizeof(FRAMEHDR),
  658. &returnLength
  659. );
  660. if (result != TRUE ||
  661. returnLength != sizeof(FRAMEHDR)) {
  662. dprintf(
  663. "%sdumpStack: could not read FRAMEHDR %08lx\n",
  664. indent,
  665. (ULONG_PTR) frameAddress
  666. );
  667. return;
  668. }
  669. memcpy( buffer, (PUCHAR) &(frame.dwSig), 4 );
  670. dprintf(
  671. "%s %p: %s - (Length %08lx) (Flags %08lx)\n"
  672. "%s ParseFunction %08lx",
  673. indent,
  674. (ULONG_PTR) frameAddress,
  675. buffer,
  676. frame.dwLen,
  677. frame.dwfFrame,
  678. indent,
  679. frame.pfnParse
  680. );
  681. if (frame.pfnParse != NULL) {
  682. GetSymbol(
  683. frame.pfnParse,
  684. Buffer,
  685. &displacement
  686. );
  687. dprintf(" %s",
  688. Buffer
  689. );
  690. }
  691. dprintf("\n");
  692. //
  693. // Do we know how to crack the frame?
  694. //
  695. switch(frame.dwSig) {
  696. case SIG_CALL:
  697. dumpCall(
  698. (ULONG_PTR) frameAddress,
  699. Verbose,
  700. IndentLevel + 4
  701. );
  702. break;
  703. case SIG_SCOPE:
  704. dumpScope(
  705. (ULONG_PTR) frameAddress,
  706. Verbose,
  707. IndentLevel + 4
  708. );
  709. break;
  710. case SIG_TERM:
  711. dumpTerm(
  712. (ULONG_PTR) frameAddress,
  713. Verbose,
  714. IndentLevel + 4
  715. );
  716. break;
  717. case SIG_ACCFIELDUNIT:
  718. dumpAccessFieldUnit(
  719. (ULONG_PTR) frameAddress,
  720. Verbose,
  721. IndentLevel + 4
  722. );
  723. break;
  724. case SIG_ACCFIELDOBJ:
  725. dumpAccessFieldObject(
  726. (ULONG_PTR) frameAddress,
  727. Verbose,
  728. IndentLevel + 4
  729. );
  730. break;
  731. }
  732. //
  733. // Make sure that there is some white space present
  734. //
  735. dprintf("\n\n");
  736. //
  737. // Next11
  738. //
  739. frameAddress += frame.dwLen;
  740. }
  741. }
  742. VOID
  743. dumpTerm(
  744. IN ULONG_PTR TermAddress,
  745. IN ULONG Verbose,
  746. IN ULONG IndentLevel
  747. )
  748. {
  749. BOOL result;
  750. INT i;
  751. TERM term;
  752. UCHAR indent[80];
  753. ULONG returnLength;
  754. //
  755. // Initialize the indent buffer
  756. //
  757. IndentLevel = (IndentLevel > 79 ? 79 : IndentLevel);
  758. memset( indent, ' ', IndentLevel );
  759. indent[IndentLevel] = '\0';
  760. result = ReadMemory(
  761. TermAddress,
  762. &term,
  763. sizeof(TERM),
  764. &returnLength
  765. );
  766. if (result != TRUE ||
  767. returnLength != sizeof(TERM) ||
  768. term.FrameHdr.dwSig != SIG_TERM) {
  769. dprintf(
  770. "%sdumpTerm: Coult not read TERM %08lx\n",
  771. indent,
  772. TermAddress
  773. );
  774. return;
  775. }
  776. dprintf(
  777. "%sTerm - %08lx\n",
  778. indent,
  779. TermAddress
  780. );
  781. dprintf(
  782. "%s OpCodeStart: %08lx\n"
  783. "%s OpCodeEnd: %08lx\n"
  784. "%s ScopeEnd: %08lx\n"
  785. "%s NameSpaceObject: %08lx\n",
  786. indent,
  787. term.pbOpTerm,
  788. indent,
  789. term.pbOpEnd,
  790. indent,
  791. term.pbScopeEnd,
  792. indent,
  793. term.pnsObj
  794. );
  795. if ( term.pnsObj != NULL && (Verbose & VERBOSE_CALL)) {
  796. dumpNSObject( (ULONG_PTR) term.pnsObj, Verbose, IndentLevel + 4);
  797. }
  798. dprintf(
  799. "%s Aml Term: %08lx",
  800. indent,
  801. term.pamlterm
  802. );
  803. if (term.pamlterm != NULL) {
  804. dumpAmlTerm( (ULONG_PTR) term.pamlterm, Verbose, IndentLevel + 4);
  805. } else {
  806. dprintf("\n");
  807. }
  808. //
  809. // Dump arguments
  810. //
  811. dprintf(
  812. "%s Arguments (Current): %1d (%1d)\n",
  813. indent,
  814. term.icArgs,
  815. term.iArg
  816. );
  817. for (i = 0; i < term.icArgs; i++) {
  818. dprintf(
  819. "%s Argument(%d): %p\n",
  820. indent,
  821. i,
  822. (ULONG_PTR) (term.pdataArgs + i)
  823. );
  824. if (Verbose & VERBOSE_CALL) {
  825. dumpPObject(
  826. (ULONG_PTR) (term.pdataArgs + i),
  827. Verbose,
  828. IndentLevel + 4
  829. );
  830. }
  831. }
  832. dprintf(
  833. "%s Result: %08lx\n",
  834. indent,
  835. term.pdataResult
  836. );
  837. if (term.pdataResult != NULL && (Verbose & VERBOSE_CALL) ) {
  838. dumpPObject(
  839. (ULONG_PTR) term.pdataResult,
  840. Verbose,
  841. IndentLevel + 4
  842. );
  843. }
  844. }