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.

291 lines
4.4 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. watchdog.h
  5. Abstract:
  6. Contains all structure and routine definitions for
  7. NT Watchdog services.
  8. Author:
  9. Michael Maciesowicz (mmacie) 05-May-2000
  10. Environment:
  11. Kernel mode only.
  12. Notes:
  13. Revision History:
  14. --*/
  15. #ifndef _WATCHDOG_H_
  16. #define _WATCHDOG_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif // __cplusplus
  20. #ifdef WATCHDOG_EXPORTS
  21. #define WATCHDOGAPI
  22. #else
  23. #define WATCHDOGAPI __declspec(dllimport)
  24. #endif // WATCHDOG_EXPORTS
  25. //
  26. // Do not dereference any watchdog data types directly!!!
  27. // They're subject to change at any time.
  28. //
  29. //
  30. // Data types.
  31. //
  32. typedef enum _WD_OBJECT_TYPE
  33. {
  34. WdStandardWatchdog = 'WSdW', // WdSW
  35. WdDeferredWatchdog = 'WDdW' // WdDW
  36. } WD_OBJECT_TYPE, *PWD_OBJECT_TYPE;
  37. typedef enum _WD_TIME_TYPE
  38. {
  39. WdKernelTime = 1,
  40. WdUserTime,
  41. WdFullTime
  42. } WD_TIME_TYPE, *PWD_TIME_TYPE;
  43. typedef enum _WD_EVENT_TYPE
  44. {
  45. WdNoEvent = 1,
  46. WdTimeoutEvent,
  47. WdRecoveryEvent
  48. } WD_EVENT_TYPE, *PWD_EVENT_TYPE;
  49. typedef struct _WATCHDOG_OBJECT
  50. {
  51. WD_OBJECT_TYPE ObjectType;
  52. LONG ReferenceCount;
  53. ULONG OwnerTag;
  54. PDEVICE_OBJECT DeviceObject;
  55. WD_TIME_TYPE TimeType;
  56. WD_EVENT_TYPE LastEvent;
  57. struct _KTHREAD *RESTRICTED_POINTER LastQueuedThread;
  58. KSPIN_LOCK SpinLock;
  59. } WATCHDOG_OBJECT, *PWATCHDOG_OBJECT;
  60. typedef struct _DEFERRED_WATCHDOG
  61. {
  62. WATCHDOG_OBJECT Header;
  63. LONG Period;
  64. LONG SuspendCount;
  65. LONG InCount;
  66. LONG OutCount;
  67. LONG LastInCount;
  68. LONG LastOutCount;
  69. ULONG LastKernelTime;
  70. ULONG LastUserTime;
  71. ULONG TimeIncrement;
  72. LONG Trigger;
  73. BOOLEAN Started;
  74. struct _KTHREAD *RESTRICTED_POINTER Thread;
  75. struct _KTIMER Timer;
  76. struct _KDPC TimerDpc;
  77. struct _KDPC *ClientDpc;
  78. } DEFERRED_WATCHDOG, *PDEFERRED_WATCHDOG;
  79. typedef struct _WATCHDOG
  80. {
  81. WATCHDOG_OBJECT Header;
  82. ULONG StartCount;
  83. ULONG SuspendCount;
  84. ULONG LastKernelTime;
  85. ULONG LastUserTime;
  86. ULONG TimeIncrement;
  87. LARGE_INTEGER DueTime;
  88. LARGE_INTEGER InitialDueTime;
  89. struct _KTHREAD *RESTRICTED_POINTER Thread;
  90. struct _KTIMER Timer;
  91. struct _KDPC TimerDpc;
  92. struct _KDPC *ClientDpc;
  93. } WATCHDOG, *PWATCHDOG;
  94. //
  95. // Deferred watchdog function prototypes.
  96. //
  97. WATCHDOGAPI
  98. PDEFERRED_WATCHDOG
  99. WdAllocateDeferredWatchdog(
  100. IN PDEVICE_OBJECT DeviceObject,
  101. IN WD_TIME_TYPE TimeType,
  102. IN ULONG Tag
  103. );
  104. WATCHDOGAPI
  105. VOID
  106. FASTCALL
  107. WdEnterMonitoredSection(
  108. IN PDEFERRED_WATCHDOG Watch
  109. );
  110. WATCHDOGAPI
  111. VOID
  112. FASTCALL
  113. WdExitMonitoredSection(
  114. IN PDEFERRED_WATCHDOG Watch
  115. );
  116. WATCHDOGAPI
  117. VOID
  118. WdFreeDeferredWatchdog(
  119. IN PDEFERRED_WATCHDOG Watch
  120. );
  121. WATCHDOGAPI
  122. VOID
  123. FASTCALL
  124. WdResetDeferredWatch(
  125. IN PDEFERRED_WATCHDOG Watch
  126. );
  127. WATCHDOGAPI
  128. VOID
  129. FASTCALL
  130. WdResumeDeferredWatch(
  131. IN PDEFERRED_WATCHDOG Watch,
  132. IN BOOLEAN Incremental
  133. );
  134. WATCHDOGAPI
  135. VOID
  136. WdStartDeferredWatch(
  137. IN PDEFERRED_WATCHDOG Watch,
  138. IN PKDPC Dpc,
  139. IN LONG Period
  140. );
  141. WATCHDOGAPI
  142. VOID
  143. WdStopDeferredWatch(
  144. IN PDEFERRED_WATCHDOG Watch
  145. );
  146. WATCHDOGAPI
  147. VOID
  148. FASTCALL
  149. WdSuspendDeferredWatch(
  150. IN PDEFERRED_WATCHDOG Watch
  151. );
  152. //
  153. // Watchdog function prototypes.
  154. //
  155. WATCHDOGAPI
  156. PWATCHDOG
  157. WdAllocateWatchdog(
  158. IN PDEVICE_OBJECT DeviceObject,
  159. IN WD_TIME_TYPE TimeType,
  160. IN ULONG Tag
  161. );
  162. WATCHDOGAPI
  163. VOID
  164. WdFreeWatchdog(
  165. IN PWATCHDOG Watch
  166. );
  167. WATCHDOGAPI
  168. VOID
  169. WdResetWatch(
  170. IN PWATCHDOG Watch
  171. );
  172. WATCHDOGAPI
  173. VOID
  174. WdResumeWatch(
  175. IN PWATCHDOG Watch,
  176. IN BOOLEAN Incremental
  177. );
  178. WATCHDOGAPI
  179. VOID
  180. WdStartWatch(
  181. IN PWATCHDOG Watch,
  182. IN LARGE_INTEGER DueTime,
  183. IN PKDPC Dpc
  184. );
  185. WATCHDOGAPI
  186. VOID
  187. WdStopWatch(
  188. IN PWATCHDOG Watch,
  189. IN BOOLEAN Incremental
  190. );
  191. WATCHDOGAPI
  192. VOID
  193. WdSuspendWatch(
  194. IN PWATCHDOG Watch
  195. );
  196. WATCHDOGAPI
  197. VOID
  198. WdDdiWatchdogDpcCallback(
  199. IN PKDPC Dpc,
  200. IN PVOID DeferredContext,
  201. IN PVOID SystemArgument1,
  202. IN PVOID SystemArgument2
  203. );
  204. //
  205. // Common function prototypes.
  206. //
  207. WATCHDOGAPI
  208. VOID
  209. WdCompleteEvent(
  210. IN PVOID Watch,
  211. IN PKTHREAD Thread
  212. );
  213. WATCHDOGAPI
  214. VOID
  215. WdDereferenceObject(
  216. IN PVOID Watch
  217. );
  218. WATCHDOGAPI
  219. PDEVICE_OBJECT
  220. WdGetDeviceObject(
  221. IN PVOID Watch
  222. );
  223. WATCHDOGAPI
  224. WD_EVENT_TYPE
  225. WdGetLastEvent(
  226. IN PVOID Watch
  227. );
  228. WATCHDOGAPI
  229. PDEVICE_OBJECT
  230. WdGetLowestDeviceObject(
  231. IN PVOID Watch
  232. );
  233. WATCHDOGAPI
  234. VOID
  235. WdReferenceObject(
  236. IN PVOID Watch
  237. );
  238. #ifdef __cplusplus
  239. }
  240. #endif // __cplusplus
  241. #endif // _WATCHDOG_H_