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.

188 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. dbgkp.h
  5. Abstract:
  6. This header file describes private data structures and functions
  7. that make up the kernel mode portion of the Dbg subsystem.
  8. Author:
  9. Mark Lucovsky (markl) 19-Jan-1990
  10. [Environment:]
  11. optional-environment-info (e.g. kernel mode only...)
  12. [Notes:]
  13. optional-notes
  14. Revision History:
  15. --*/
  16. #ifndef _DBGKP_
  17. #define _DBGKP_
  18. #pragma warning(disable:4214) // bit field types other than int
  19. #pragma warning(disable:4201) // nameless struct/union
  20. #pragma warning(disable:4324) // alignment sensitive to declspec
  21. #pragma warning(disable:4127) // condition expression is constant
  22. #pragma warning(disable:4115) // named type definition in parentheses
  23. #include "ntos.h"
  24. #define NOEXTAPI
  25. #include "wdbgexts.h"
  26. #include "ntdbg.h"
  27. #include <zwapi.h>
  28. #include <string.h>
  29. #if defined(_WIN64)
  30. #include <wow64t.h>
  31. #endif
  32. #define DEBUG_EVENT_READ (0x01) // Event had been seen by win32 app
  33. #define DEBUG_EVENT_NOWAIT (0x02) // No waiter one this. Just free the pool
  34. #define DEBUG_EVENT_INACTIVE (0x04) // The message is in inactive. It may be activated or deleted later
  35. #define DEBUG_EVENT_RELEASE (0x08) // Release rundown protection on this thread
  36. #define DEBUG_EVENT_PROTECT_FAILED (0x10) // Rundown protection failed to be acquired on this thread
  37. #define DEBUG_EVENT_SUSPEND (0x20) // Resume thread on continue
  38. typedef struct _DEBUG_EVENT {
  39. LIST_ENTRY EventList; // Queued to event object through this
  40. KEVENT ContinueEvent;
  41. CLIENT_ID ClientId;
  42. PEPROCESS Process; // Waiting process
  43. PETHREAD Thread; // Waiting thread
  44. NTSTATUS Status; // Status of operation
  45. ULONG Flags;
  46. PETHREAD BackoutThread; // Backout key for faked messages
  47. DBGKM_APIMSG ApiMsg; // Message being sent
  48. } DEBUG_EVENT, *PDEBUG_EVENT;
  49. NTSTATUS
  50. DbgkpSendApiMessage(
  51. IN OUT PDBGKM_APIMSG ApiMsg,
  52. IN BOOLEAN SuspendProcess
  53. );
  54. BOOLEAN
  55. DbgkpSuspendProcess(
  56. VOID
  57. );
  58. VOID
  59. DbgkpResumeProcess(
  60. VOID
  61. );
  62. HANDLE
  63. DbgkpSectionToFileHandle(
  64. IN PVOID SectionObject
  65. );
  66. VOID
  67. DbgkpDeleteObject (
  68. IN PVOID Object
  69. );
  70. VOID
  71. DbgkpCloseObject (
  72. IN PEPROCESS Process,
  73. IN PVOID Object,
  74. IN ACCESS_MASK GrantedAccess,
  75. IN ULONG ProcessHandleCount,
  76. IN ULONG SystemHandleCount
  77. );
  78. NTSTATUS
  79. DbgkpQueueMessage (
  80. IN PEPROCESS Process,
  81. IN PETHREAD Thread,
  82. IN OUT PDBGKM_APIMSG ApiMsg,
  83. IN ULONG Flags,
  84. IN PDEBUG_OBJECT TargetDebugObject
  85. );
  86. VOID
  87. DbgkpOpenHandles (
  88. PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
  89. PEPROCESS Process,
  90. PETHREAD Thread
  91. );
  92. VOID
  93. DbgkpMarkProcessPeb (
  94. PEPROCESS Process
  95. );
  96. VOID
  97. DbgkpConvertKernelToUserStateChange (
  98. IN OUT PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
  99. IN PDEBUG_EVENT DebugEvent
  100. );
  101. NTSTATUS
  102. DbgkpSendApiMessageLpc(
  103. IN OUT PDBGKM_APIMSG ApiMsg,
  104. IN PVOID Port,
  105. IN BOOLEAN SuspendProcess
  106. );
  107. VOID
  108. DbgkpFreeDebugEvent (
  109. IN PDEBUG_EVENT DebugEvent
  110. );
  111. NTSTATUS
  112. DbgkpPostFakeProcessCreateMessages (
  113. IN PEPROCESS Process,
  114. IN PDEBUG_OBJECT DebugObject,
  115. IN PETHREAD *pLastThread
  116. );
  117. NTSTATUS
  118. DbgkpPostFakeModuleMessages (
  119. IN PEPROCESS Process,
  120. IN PETHREAD Thread,
  121. IN PDEBUG_OBJECT DebugObject
  122. );
  123. NTSTATUS
  124. DbgkpPostFakeThreadMessages (
  125. IN PEPROCESS Process,
  126. IN PDEBUG_OBJECT DebugObject,
  127. IN PETHREAD StartThread,
  128. OUT PETHREAD *pFirstThread,
  129. OUT PETHREAD *pLastThread
  130. );
  131. NTSTATUS
  132. DbgkpPostAdditionalThreadMessages (
  133. IN PEPROCESS Process,
  134. IN PDEBUG_OBJECT DebugObject,
  135. IN PETHREAD LastThread
  136. );
  137. VOID
  138. DbgkpWakeTarget (
  139. IN PDEBUG_EVENT DebugEvent
  140. );
  141. NTSTATUS
  142. DbgkpSetProcessDebugObject (
  143. IN PEPROCESS Process,
  144. IN PDEBUG_OBJECT DebugObject,
  145. IN NTSTATUS MsgStatus,
  146. IN PETHREAD LastThread
  147. );
  148. #endif // _DBGKP_