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.

86 lines
2.0 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. try
  12. {
  13. ULONG64 ActCtxData = 0;
  14. if (*args)
  15. {
  16. ActCtxData = GetExpression(args);
  17. }
  18. else
  19. {
  20. if (!GetActiveActivationContextData(&ActCtxData))
  21. {
  22. dprintf("Unable to find activation context data for this process at the moment.\n");
  23. return;
  24. }
  25. }
  26. DumpActCtxData(NULL, ActCtxData, 0xFFFFFFFF);
  27. }
  28. catch (const COutOfMemory &)
  29. {
  30. dprintf("Out of memory\n");
  31. }
  32. }
  33. DECLARE_API(actctx)
  34. {
  35. try
  36. {
  37. //
  38. // This finds the currently-active PACTIVATION_CONTEXT for the thread, or
  39. // dumps the one indicated as a parameter
  40. //
  41. ULONG64 ActiveActCtx = 0;
  42. if (*args)
  43. {
  44. ActiveActCtx = GetExpression(args);
  45. }
  46. else
  47. {
  48. ULONG64 ulTebAddress;
  49. ULONG64 ulActiveStackFrame;
  50. GetTebAddress(&ulTebAddress);
  51. GetFieldValue(ulTebAddress, "nt!TEB", "ActivationContextStack.ActiveFrame", ulActiveStackFrame);
  52. if (!ulActiveStackFrame)
  53. {
  54. dprintf("There is no current activation context stack frame. Try !actctxdata instead.\n");
  55. return;
  56. }
  57. GetFieldValue(ulActiveStackFrame, "nt!RTL_ACTIVATION_CONTEXT_STACK_FRAME", "ActivationContext", ActiveActCtx);
  58. if (!ActiveActCtx)
  59. {
  60. dprintf("The activation context stack frame at %p doesn't point to a valid activation context object.\n", ActiveActCtx);
  61. return;
  62. }
  63. }
  64. DumpActCtx(ActiveActCtx, 0xFFFF);
  65. }
  66. catch (const COutOfMemory &)
  67. {
  68. dprintf("Out of memory\n");
  69. }
  70. }