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.

69 lines
1.6 KiB

  1. #include "windows.h"
  2. #define KDEXT_64BIT
  3. #include "dbghelp.h"
  4. #include "wdbgexts.h"
  5. #include "stdlib.h"
  6. #include "stdio.h"
  7. #include "sxstypes.h"
  8. #include "fusiondbgext.h"
  9. DECLARE_API(actctxdata)
  10. {
  11. ULONG64 ActCtxData = 0;
  12. if (*args)
  13. {
  14. ActCtxData = GetExpression(args);
  15. }
  16. else
  17. {
  18. if (!GetActiveActivationContextData(&ActCtxData))
  19. {
  20. dprintf("Unable to find activation context data for this process at the moment.\n");
  21. return;
  22. }
  23. }
  24. DumpActCtxData(NULL, ActCtxData, 0xFFFFFFFF);
  25. }
  26. DECLARE_API(actctx)
  27. {
  28. //
  29. // This finds the currently-active PACTIVATION_CONTEXT for the thread, or
  30. // dumps the one indicated as a parameter
  31. //
  32. ULONG64 ActiveActCtx = 0;
  33. if (*args)
  34. {
  35. ActiveActCtx = GetExpression(args);
  36. }
  37. else
  38. {
  39. ULONG64 ulTebAddress;
  40. ULONG64 ulActiveStackFrame;
  41. GetTebAddress(&ulTebAddress);
  42. GetFieldValue(ulTebAddress, "nt!TEB", "ActivationContextStack.ActiveFrame", ulActiveStackFrame);
  43. if (!ulActiveStackFrame)
  44. {
  45. dprintf("There is no current activation context stack frame. Try !actctxdata instead.\n");
  46. return;
  47. }
  48. GetFieldValue(ulActiveStackFrame, "nt!RTL_ACTIVATION_CONTEXT_STACK_FRAME", "ActivationContext", ActiveActCtx);
  49. if (!ActiveActCtx)
  50. {
  51. dprintf("The activation context stack frame at %p doesn't point to a valid activation context object.\n", ActiveActCtx);
  52. return;
  53. }
  54. }
  55. DumpActCtx(ActiveActCtx, 0xFFFF);
  56. }