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.

285 lines
5.8 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. verifier.h
  5. Abstract:
  6. Include file for application verifier routines that are callable by
  7. user mode code.
  8. Author:
  9. Silviu Calinoiu (SilviuC) 23-Jan-2002
  10. Environment:
  11. These routines are callable only when application verifier is enabled
  12. for the calling process.
  13. Revision History:
  14. --*/
  15. #ifndef _AVRF_
  16. #define _AVRF_
  17. //
  18. // VERIFIER SDK
  19. //
  20. // This header contains the declarations of all APIs exported by
  21. // base verifier (verifier.dll). It is not expected that normal
  22. // applications will link statically verifier.dll. The typical
  23. // scenario for a verifier (let's say COM verifier) is to dynamically
  24. // discover if application verifier is enabled (check if
  25. // FLG_APPLICATION_VERIFIER global flag is set) and then load verifier.dll
  26. // and call GetProcAddress() to get all the entry points it is interested in.
  27. // This is the reason all exports have also a typedef for the function pointer
  28. // so that it is convenient to get this entry points at runtime.
  29. //
  30. //
  31. // Runtime query/set functions for verifier flags.
  32. //
  33. typedef
  34. NTSTATUS
  35. (* VERIFIER_QUERY_RUNTIME_FLAGS_FUNCTION) (
  36. OUT PLOGICAL VerifierEnabled,
  37. OUT PULONG VerifierFlags
  38. );
  39. typedef
  40. NTSTATUS
  41. (* VERIFIER_SET_RUNTIME_FLAGS_FUNCTION) (
  42. IN ULONG VerifierFlags
  43. );
  44. NTSTATUS
  45. VerifierQueryRuntimeFlags (
  46. OUT PLOGICAL VerifierEnabled,
  47. OUT PULONG VerifierFlags
  48. );
  49. NTSTATUS
  50. VerifierSetRuntimeFlags (
  51. IN ULONG VerifierFlags
  52. );
  53. //
  54. // RPC read-only page heap create/destroy APIs.
  55. //
  56. typedef
  57. PVOID
  58. (* VERIFIER_CREATE_RPC_PAGE_HEAP_FUNCTION) (
  59. IN ULONG Flags,
  60. IN PVOID HeapBase OPTIONAL,
  61. IN SIZE_T ReserveSize OPTIONAL,
  62. IN SIZE_T CommitSize OPTIONAL,
  63. IN PVOID Lock OPTIONAL,
  64. IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
  65. );
  66. typedef
  67. PVOID
  68. (* VERIFIER_DESTROY_RPC_PAGE_HEAP_FUNCTION) (
  69. IN PVOID HeapHandle
  70. );
  71. PVOID
  72. VerifierCreateRpcPageHeap (
  73. IN ULONG Flags,
  74. IN PVOID HeapBase OPTIONAL,
  75. IN SIZE_T ReserveSize OPTIONAL,
  76. IN SIZE_T CommitSize OPTIONAL,
  77. IN PVOID Lock OPTIONAL,
  78. IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
  79. );
  80. PVOID
  81. VerifierDestroyRpcPageHeap (
  82. IN PVOID HeapHandle
  83. );
  84. //
  85. // Fault injection management
  86. //
  87. #define FAULT_INJECTION_CLASS_WAIT_APIS 0
  88. #define FAULT_INJECTION_CLASS_HEAP_ALLOC_APIS 1
  89. #define FAULT_INJECTION_CLASS_VIRTUAL_ALLOC_APIS 2
  90. #define FAULT_INJECTION_CLASS_REGISTRY_APIS 3
  91. #define FAULT_INJECTION_CLASS_FILE_APIS 4
  92. #define FAULT_INJECTION_CLASS_EVENT_APIS 5
  93. #define FAULT_INJECTION_CLASS_MAP_VIEW_APIS 6
  94. #define FAULT_INJECTION_CLASS_OLE_ALLOC_APIS 7
  95. #define FAULT_INJECTION_INVALID_CLASS 8
  96. typedef
  97. VOID
  98. (* VERIFIER_SET_FAULT_INJECTION_PROBABILITY) (
  99. ULONG Class,
  100. ULONG Probability
  101. );
  102. VOID
  103. VerifierSetFaultInjectionProbability (
  104. ULONG Class,
  105. ULONG Probability
  106. );
  107. typedef
  108. ULONG
  109. (* VERIFIER_ENABLE_FAULT_INJECTION_TARGET_RANGE_FUNCTION) (
  110. IN PVOID StartAddress,
  111. IN PVOID EndAddress
  112. );
  113. typedef
  114. VOID
  115. (* VERIFIER_DISABLE_FAULT_INJECTION_TARGET_RANGE_FUNCTION) (
  116. IN ULONG RangeIndex
  117. );
  118. typedef
  119. ULONG
  120. (* VERIFIER_ENABLE_FAULT_INJECTION_EXCLUSION_RANGE_FUNCTION) (
  121. IN PVOID StartAddress,
  122. IN PVOID EndAddress
  123. );
  124. typedef
  125. VOID
  126. (* VERIFIER_DISABLE_FAULT_INJECTION_EXCLUSION_RANGE_FUNCTION) (
  127. IN ULONG RangeIndex
  128. );
  129. ULONG
  130. VerifierEnableFaultInjectionTargetRange (
  131. PVOID StartAddress,
  132. PVOID EndAddress
  133. );
  134. VOID
  135. VerifierDisableFaultInjectionTargetRange (
  136. ULONG RangeIndex
  137. );
  138. ULONG
  139. VerifierEnableFaultInjectionExclusionRange (
  140. PVOID StartAddress,
  141. PVOID EndAddress
  142. );
  143. VOID
  144. VerifierDisableFaultInjectionExclusionRange (
  145. ULONG RangeIndex
  146. );
  147. //
  148. // DLL related information
  149. //
  150. typedef
  151. LOGICAL
  152. (* VERIFIER_IS_DLL_ENTRY_ACTIVE_FUNCTION) (
  153. OUT PVOID * Reserved
  154. );
  155. LOGICAL
  156. VerifierIsDllEntryActive (
  157. OUT PVOID * Reserved
  158. );
  159. //
  160. // Locks counter
  161. //
  162. typedef
  163. LOGICAL
  164. (* VERIFIER_IS_CURRENT_THREAD_HOLDING_LOCKS_FUNCTION) (
  165. VOID
  166. );
  167. LOGICAL
  168. VerifierIsCurrentThreadHoldingLocks (
  169. VOID
  170. );
  171. //
  172. // Free memory notifications
  173. //
  174. typedef
  175. NTSTATUS
  176. (* VERIFIER_FREE_MEMORY_CALLBACK) (
  177. PVOID Address,
  178. SIZE_T Size,
  179. PVOID Context
  180. );
  181. typedef
  182. NTSTATUS
  183. (* VERIFIER_ADD_FREE_MEMORY_CALLBACK_FUNCTION) (
  184. VERIFIER_FREE_MEMORY_CALLBACK Callback
  185. );
  186. typedef
  187. NTSTATUS
  188. (* VERIFIER_DELETE_FREE_MEMORY_CALLBACK_FUNCTION) (
  189. VERIFIER_FREE_MEMORY_CALLBACK Callback
  190. );
  191. NTSTATUS
  192. VerifierAddFreeMemoryCallback (
  193. VERIFIER_FREE_MEMORY_CALLBACK Callback
  194. );
  195. NTSTATUS
  196. VerifierDeleteFreeMemoryCallback (
  197. VERIFIER_FREE_MEMORY_CALLBACK Callback
  198. );
  199. //
  200. // Verifier stops and logging.
  201. //
  202. typedef
  203. NTSTATUS
  204. (* VERIFIER_LOG_MESSAGE_FUNCTION) (
  205. PCHAR Message,
  206. ...
  207. );
  208. typedef
  209. VOID
  210. (* VERIFIER_STOP_MESSAGE_FUNCTION) (
  211. ULONG_PTR Code,
  212. PCHAR Message,
  213. ULONG_PTR Param1, PCHAR Description1,
  214. ULONG_PTR Param2, PCHAR Description2,
  215. ULONG_PTR Param3, PCHAR Description3,
  216. ULONG_PTR Param4, PCHAR Description4
  217. );
  218. NTSTATUS
  219. VerifierLogMessage (
  220. PCHAR Message,
  221. ...
  222. );
  223. VOID
  224. VerifierStopMessage (
  225. ULONG_PTR Code,
  226. PCHAR Message,
  227. ULONG_PTR Param1, PCHAR Description1,
  228. ULONG_PTR Param2, PCHAR Description2,
  229. ULONG_PTR Param3, PCHAR Description3,
  230. ULONG_PTR Param4, PCHAR Description4
  231. );
  232. #endif // _AVRF_