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.

328 lines
5.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 enum _WD_OBJECT_STATE
  50. {
  51. WdStopped = 1,
  52. WdStarted,
  53. WdRemoved
  54. } WD_OBJECT_STATE, *PWD_OBJECT_STATE;
  55. //
  56. // BUGBUG:
  57. //
  58. // This structure is defined here, and in gre\os.cxx as WATCHDOG_DPC_CONTEXT.
  59. // We need to drop that definition from os.cxx and use WD_GDI_DPC_CONTEXT
  60. // instead (win32k includes watchdog.w).
  61. //
  62. typedef struct _LDEV LDEV, *PLDEV;
  63. typedef struct _WD_GDI_DPC_CONTEXT
  64. {
  65. PLDEV *ppldevDrivers;
  66. HANDLE hDriver;
  67. UNICODE_STRING DisplayDriverName;
  68. } WD_GDI_DPC_CONTEXT, *PWD_GDI_DPC_CONTEXT;
  69. typedef struct _WATCHDOG_OBJECT
  70. {
  71. WD_OBJECT_TYPE ObjectType;
  72. LONG ReferenceCount;
  73. ULONG OwnerTag;
  74. PDEVICE_OBJECT DeviceObject;
  75. WD_TIME_TYPE TimeType;
  76. WD_EVENT_TYPE LastEvent;
  77. struct _KTHREAD *RESTRICTED_POINTER LastQueuedThread;
  78. KSPIN_LOCK SpinLock;
  79. PVOID Context;
  80. } WATCHDOG_OBJECT, *PWATCHDOG_OBJECT;
  81. typedef struct _DEFERRED_WATCHDOG
  82. {
  83. WATCHDOG_OBJECT Header;
  84. LONG Period;
  85. LONG SuspendCount;
  86. LONG InCount;
  87. LONG OutCount;
  88. LONG LastInCount;
  89. LONG LastOutCount;
  90. ULONG LastKernelTime;
  91. ULONG LastUserTime;
  92. ULONG TimeIncrement;
  93. LONG Trigger;
  94. ULONG State;
  95. struct _KTHREAD *RESTRICTED_POINTER Thread;
  96. struct _KTIMER Timer;
  97. struct _KDPC TimerDpc;
  98. struct _KDPC *ClientDpc;
  99. } DEFERRED_WATCHDOG, *PDEFERRED_WATCHDOG;
  100. typedef struct _WATCHDOG
  101. {
  102. WATCHDOG_OBJECT Header;
  103. ULONG StartCount;
  104. ULONG SuspendCount;
  105. ULONG LastKernelTime;
  106. ULONG LastUserTime;
  107. ULONG TimeIncrement;
  108. LARGE_INTEGER DueTime;
  109. LARGE_INTEGER InitialDueTime;
  110. struct _KTHREAD *RESTRICTED_POINTER Thread;
  111. struct _KTIMER Timer;
  112. struct _KDPC TimerDpc;
  113. struct _KDPC *ClientDpc;
  114. } WATCHDOG, *PWATCHDOG;
  115. //
  116. // Deferred watchdog function prototypes.
  117. //
  118. WATCHDOGAPI
  119. PDEFERRED_WATCHDOG
  120. WdAllocateDeferredWatchdog(
  121. IN PDEVICE_OBJECT DeviceObject,
  122. IN WD_TIME_TYPE TimeType,
  123. IN ULONG Tag
  124. );
  125. WATCHDOGAPI
  126. VOID
  127. FASTCALL
  128. WdEnterMonitoredSection(
  129. IN PDEFERRED_WATCHDOG Watch
  130. );
  131. WATCHDOGAPI
  132. VOID
  133. FASTCALL
  134. WdExitMonitoredSection(
  135. IN PDEFERRED_WATCHDOG Watch
  136. );
  137. WATCHDOGAPI
  138. VOID
  139. WdFreeDeferredWatchdog(
  140. IN PDEFERRED_WATCHDOG Watch
  141. );
  142. WATCHDOGAPI
  143. VOID
  144. FASTCALL
  145. WdResetDeferredWatch(
  146. IN PDEFERRED_WATCHDOG Watch
  147. );
  148. WATCHDOGAPI
  149. VOID
  150. FASTCALL
  151. WdResumeDeferredWatch(
  152. IN PDEFERRED_WATCHDOG Watch,
  153. IN BOOLEAN Incremental
  154. );
  155. WATCHDOGAPI
  156. VOID
  157. WdStartDeferredWatch(
  158. IN PDEFERRED_WATCHDOG Watch,
  159. IN PKDPC Dpc,
  160. IN LONG Period
  161. );
  162. WATCHDOGAPI
  163. VOID
  164. WdStopDeferredWatch(
  165. IN PDEFERRED_WATCHDOG Watch
  166. );
  167. WATCHDOGAPI
  168. VOID
  169. FASTCALL
  170. WdSuspendDeferredWatch(
  171. IN PDEFERRED_WATCHDOG Watch
  172. );
  173. //
  174. // Watchdog function prototypes.
  175. //
  176. WATCHDOGAPI
  177. PWATCHDOG
  178. WdAllocateWatchdog(
  179. IN PDEVICE_OBJECT DeviceObject,
  180. IN WD_TIME_TYPE TimeType,
  181. IN ULONG Tag
  182. );
  183. WATCHDOGAPI
  184. VOID
  185. WdFreeWatchdog(
  186. IN PWATCHDOG Watch
  187. );
  188. WATCHDOGAPI
  189. VOID
  190. WdResetWatch(
  191. IN PWATCHDOG Watch
  192. );
  193. WATCHDOGAPI
  194. VOID
  195. WdResumeWatch(
  196. IN PWATCHDOG Watch,
  197. IN BOOLEAN Incremental
  198. );
  199. WATCHDOGAPI
  200. VOID
  201. WdStartWatch(
  202. IN PWATCHDOG Watch,
  203. IN LARGE_INTEGER DueTime,
  204. IN PKDPC Dpc
  205. );
  206. WATCHDOGAPI
  207. VOID
  208. WdStopWatch(
  209. IN PWATCHDOG Watch,
  210. IN BOOLEAN Incremental
  211. );
  212. WATCHDOGAPI
  213. VOID
  214. WdSuspendWatch(
  215. IN PWATCHDOG Watch
  216. );
  217. WATCHDOGAPI
  218. VOID
  219. WdDdiWatchdogDpcCallback(
  220. IN PKDPC Dpc,
  221. IN PVOID DeferredContext,
  222. IN PVOID SystemArgument1,
  223. IN PVOID SystemArgument2
  224. );
  225. //
  226. // Common function prototypes.
  227. //
  228. WATCHDOGAPI
  229. PVOID
  230. WdAttachContext(
  231. IN PVOID Watch,
  232. IN ULONG Size
  233. );
  234. WATCHDOGAPI
  235. VOID
  236. WdCompleteEvent(
  237. IN PVOID Watch,
  238. IN PKTHREAD Thread
  239. );
  240. WATCHDOGAPI
  241. VOID
  242. WdDereferenceObject(
  243. IN PVOID Watch
  244. );
  245. WATCHDOGAPI
  246. VOID
  247. WdDetachContext(
  248. IN PVOID Watch
  249. );
  250. WATCHDOGAPI
  251. PDEVICE_OBJECT
  252. WdGetDeviceObject(
  253. IN PVOID Watch
  254. );
  255. WATCHDOGAPI
  256. WD_EVENT_TYPE
  257. WdGetLastEvent(
  258. IN PVOID Watch
  259. );
  260. WATCHDOGAPI
  261. PDEVICE_OBJECT
  262. WdGetLowestDeviceObject(
  263. IN PVOID Watch
  264. );
  265. WATCHDOGAPI
  266. VOID
  267. WdReferenceObject(
  268. IN PVOID Watch
  269. );
  270. #ifdef __cplusplus
  271. }
  272. #endif // __cplusplus
  273. #endif // _WATCHDOG_H_