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.

192 lines
4.2 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. #define DBGKP_FIELD_FROM_IMAGE_OPTIONAL_HEADER(hdrs,field) \
  39. ((hdrs)->OptionalHeader.##field)
  40. typedef struct _DEBUG_EVENT {
  41. LIST_ENTRY EventList; // Queued to event object through this
  42. KEVENT ContinueEvent;
  43. CLIENT_ID ClientId;
  44. PEPROCESS Process; // Waiting process
  45. PETHREAD Thread; // Waiting thread
  46. NTSTATUS Status; // Status of operation
  47. ULONG Flags;
  48. PETHREAD BackoutThread; // Backout key for faked messages
  49. DBGKM_APIMSG ApiMsg; // Message being sent
  50. } DEBUG_EVENT, *PDEBUG_EVENT;
  51. NTSTATUS
  52. DbgkpSendApiMessage(
  53. IN OUT PDBGKM_APIMSG ApiMsg,
  54. IN BOOLEAN SuspendProcess
  55. );
  56. BOOLEAN
  57. DbgkpSuspendProcess(
  58. VOID
  59. );
  60. VOID
  61. DbgkpResumeProcess(
  62. VOID
  63. );
  64. HANDLE
  65. DbgkpSectionToFileHandle(
  66. IN PVOID SectionObject
  67. );
  68. VOID
  69. DbgkpDeleteObject (
  70. IN PVOID Object
  71. );
  72. VOID
  73. DbgkpCloseObject (
  74. IN PEPROCESS Process,
  75. IN PVOID Object,
  76. IN ACCESS_MASK GrantedAccess,
  77. IN ULONG_PTR ProcessHandleCount,
  78. IN ULONG_PTR SystemHandleCount
  79. );
  80. NTSTATUS
  81. DbgkpQueueMessage (
  82. IN PEPROCESS Process,
  83. IN PETHREAD Thread,
  84. IN OUT PDBGKM_APIMSG ApiMsg,
  85. IN ULONG Flags,
  86. IN PDEBUG_OBJECT TargetDebugObject
  87. );
  88. VOID
  89. DbgkpOpenHandles (
  90. PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
  91. PEPROCESS Process,
  92. PETHREAD Thread
  93. );
  94. VOID
  95. DbgkpMarkProcessPeb (
  96. PEPROCESS Process
  97. );
  98. VOID
  99. DbgkpConvertKernelToUserStateChange (
  100. IN OUT PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
  101. IN PDEBUG_EVENT DebugEvent
  102. );
  103. NTSTATUS
  104. DbgkpSendApiMessageLpc(
  105. IN OUT PDBGKM_APIMSG ApiMsg,
  106. IN PVOID Port,
  107. IN BOOLEAN SuspendProcess
  108. );
  109. VOID
  110. DbgkpFreeDebugEvent (
  111. IN PDEBUG_EVENT DebugEvent
  112. );
  113. NTSTATUS
  114. DbgkpPostFakeProcessCreateMessages (
  115. IN PEPROCESS Process,
  116. IN PDEBUG_OBJECT DebugObject,
  117. IN PETHREAD *pLastThread
  118. );
  119. NTSTATUS
  120. DbgkpPostFakeModuleMessages (
  121. IN PEPROCESS Process,
  122. IN PETHREAD Thread,
  123. IN PDEBUG_OBJECT DebugObject
  124. );
  125. NTSTATUS
  126. DbgkpPostFakeThreadMessages (
  127. IN PEPROCESS Process,
  128. IN PDEBUG_OBJECT DebugObject,
  129. IN PETHREAD StartThread,
  130. OUT PETHREAD *pFirstThread,
  131. OUT PETHREAD *pLastThread
  132. );
  133. NTSTATUS
  134. DbgkpPostAdditionalThreadMessages (
  135. IN PEPROCESS Process,
  136. IN PDEBUG_OBJECT DebugObject,
  137. IN PETHREAD LastThread
  138. );
  139. VOID
  140. DbgkpWakeTarget (
  141. IN PDEBUG_EVENT DebugEvent
  142. );
  143. NTSTATUS
  144. DbgkpSetProcessDebugObject (
  145. IN PEPROCESS Process,
  146. IN PDEBUG_OBJECT DebugObject,
  147. IN NTSTATUS MsgStatus,
  148. IN PETHREAD LastThread
  149. );
  150. #endif // _DBGKP_