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.

358 lines
6.5 KiB

  1. //
  2. // Driver Verifier Control Applet
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. // header: verify.hxx
  7. // author: silviuc
  8. // created: Mon Jan 04 12:34:19 1999
  9. //
  10. #ifndef _VERIFY_HXX_INCLUDED_
  11. #define _VERIFY_HXX_INCLUDED_
  12. //
  13. // Constant:
  14. //
  15. // MI_SUSPECT_DRIVER_BUFFER_LENGTH
  16. //
  17. // Description:
  18. //
  19. // The maximum length of the string containing the
  20. // driver names (according to ntos\mm\mi.h
  21. //
  22. #define MI_SUSPECT_DRIVER_BUFFER_LENGTH 512
  23. //
  24. // Constant:
  25. //
  26. // VRFP_MAX_NUMBER_DRIVERS
  27. //
  28. // Description:
  29. //
  30. // The maximum number of drivers we can deal with.
  31. //
  32. #define VRFP_MAX_NUMBER_DRIVERS 256
  33. //
  34. // Type:
  35. //
  36. // VRF_DRIVER_STATE
  37. //
  38. // Description:
  39. //
  40. // This is the type to represent the state of the driver
  41. // from the verifier perspective. The name of the driver
  42. // is just the file name without path therefore we have
  43. // just a small name buffer.
  44. //
  45. typedef struct {
  46. TCHAR Name [ _MAX_PATH ];
  47. BOOL Verified;
  48. BOOL CurrentlyVerified;
  49. TCHAR Provider[ 128 ];
  50. TCHAR Version[ 64 ];
  51. } VRF_DRIVER_STATE, * PVRF_DRIVER_STATE;
  52. //
  53. // Type:
  54. //
  55. // VRF_VERIFIER_STATE
  56. //
  57. // Description:
  58. //
  59. // This is the type used for data transfer from/to the registry
  60. // driver verifier settings. The `DriverInfo' and `DriverNames'
  61. // fields are filled with pointers to internal data structures
  62. // when VrfGetVerifierState() is called. The caller of this function
  63. // does not have to deallocate or manage in any other way these
  64. // areas.
  65. //
  66. typedef struct {
  67. BOOL AllDriversVerified;
  68. BOOL SpecialPoolVerification;
  69. BOOL PagedCodeVerification;
  70. BOOL AllocationFaultInjection;
  71. BOOL PoolTracking;
  72. BOOL IoVerifier;
  73. ULONG SysIoVerifierLevel;
  74. ULONG DriverCount;
  75. TCHAR DriverNames[ MI_SUSPECT_DRIVER_BUFFER_LENGTH ];
  76. VRF_DRIVER_STATE DriverInfo[ VRFP_MAX_NUMBER_DRIVERS ];
  77. TCHAR AdditionalDriverNames[ MI_SUSPECT_DRIVER_BUFFER_LENGTH ];
  78. } VRF_VERIFIER_STATE, * PVRF_VERIFIER_STATE;
  79. //
  80. // Type:
  81. //
  82. // KRN_DRIVER_STATE
  83. //
  84. // Description:
  85. //
  86. // This type reflects the per user information as it is
  87. // maintained by the system verifier.
  88. //
  89. typedef struct {
  90. TCHAR Name [ _MAX_PATH ];
  91. ULONG Loads;
  92. ULONG Unloads;
  93. ULONG CurrentPagedPoolAllocations;
  94. ULONG CurrentNonPagedPoolAllocations;
  95. ULONG PeakPagedPoolAllocations;
  96. ULONG PeakNonPagedPoolAllocations;
  97. SIZE_T PagedPoolUsageInBytes;
  98. SIZE_T NonPagedPoolUsageInBytes;
  99. SIZE_T PeakPagedPoolUsageInBytes;
  100. SIZE_T PeakNonPagedPoolUsageInBytes;
  101. } KRN_DRIVER_STATE, * PKRN_DRIVER_STATE;
  102. //
  103. // Type:
  104. //
  105. // KRN_VERIFIER_STATE
  106. //
  107. // Description:
  108. //
  109. // This type reflects the global information as it is
  110. // maintained by the system verifier.
  111. //
  112. typedef struct {
  113. ULONG Level;
  114. BOOL SpecialPool;
  115. BOOL IrqlChecking;
  116. BOOL FaultInjection;
  117. BOOL PoolTrack;
  118. BOOL IoVerif;
  119. ULONG RaiseIrqls;
  120. ULONG AcquireSpinLocks;
  121. ULONG SynchronizeExecutions;
  122. ULONG AllocationsAttempted;
  123. ULONG AllocationsSucceeded;
  124. ULONG AllocationsSucceededSpecialPool;
  125. ULONG AllocationsWithNoTag;
  126. ULONG Trims;
  127. ULONG AllocationsFailed;
  128. ULONG AllocationsFailedDeliberately;
  129. ULONG UnTrackedPool;
  130. ULONG DriverCount;
  131. KRN_DRIVER_STATE DriverInfo[ VRFP_MAX_NUMBER_DRIVERS ];
  132. } KRN_VERIFIER_STATE, * PKRN_VERIFIER_STATE;
  133. //
  134. // array length macro
  135. //
  136. #define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( array[ 0 ] ) )
  137. //
  138. // Verifier management functions
  139. //
  140. BOOL
  141. VrfGetVerifierState (
  142. PVRF_VERIFIER_STATE VrfState);
  143. BOOL
  144. VrfSetVerifierState (
  145. PVRF_VERIFIER_STATE VrfState);
  146. BOOL
  147. VrfSetVolatileFlags (
  148. UINT uNewFlags);
  149. BOOL
  150. VrfSetVolatileOptions(
  151. BOOL bSpecialPool,
  152. BOOL bIrqlChecking,
  153. BOOL bFaultInjection );
  154. BOOL
  155. VrfClearAllVerifierSettings (
  156. );
  157. BOOL
  158. VrfNotifyDriverSelection (
  159. PVRF_VERIFIER_STATE VrfState,
  160. ULONG Index );
  161. //
  162. // Support for dynamic set of verified drivers
  163. //
  164. BOOL VrfVolatileAddDriver(
  165. const WCHAR *szDriverName );
  166. BOOL VrfVolatileRemoveDriver(
  167. const WCHAR *szDriverName );
  168. //
  169. // System verifier information
  170. //
  171. BOOL
  172. KrnGetSystemVerifierState (
  173. PKRN_VERIFIER_STATE KrnState);
  174. //
  175. // Command line execution
  176. //
  177. DWORD
  178. VrfExecuteCommandLine (
  179. int Count,
  180. LPTSTR Args[]);
  181. //
  182. // Miscellaneous functions
  183. //
  184. void
  185. __cdecl
  186. VrfError ( // defined in modspage.cxx
  187. LPTSTR fmt,
  188. ...);
  189. void
  190. __cdecl
  191. VrfErrorResourceFormat( // defined in modspage.cxx
  192. UINT uIdResourceFormat,
  193. ... );
  194. //////////////////////////////////////////////////////////////////////
  195. /////////////////////////////////////////// strings operations support
  196. //////////////////////////////////////////////////////////////////////
  197. BOOL
  198. GetStringFromResources(
  199. UINT uIdResource,
  200. TCHAR *strBuffer,
  201. int nBufferLength );
  202. void
  203. VrfPrintStringFromResources(
  204. UINT uIdResource);
  205. BOOL
  206. VrfOuputStringFromResources(
  207. UINT uIdResource,
  208. BOOL bConvertToOEM,
  209. FILE *file ); // returns FALSE on a _fputts error (disk full)
  210. void
  211. VrfPrintNarrowStringOEMFormat(
  212. char *szText );
  213. BOOL
  214. VrfOutputWideStringOEMFormat(
  215. LPTSTR strText,
  216. BOOL bAppendNewLine,
  217. FILE *file ); // returns FALSE on a fprintf of fputs error (disk full)
  218. BOOL
  219. __cdecl
  220. VrfFTPrintf(
  221. BOOL bConvertToOEM,
  222. FILE *file,
  223. LPTSTR fmt,
  224. ...); // returns FALSE on a _ftprintf error (disk full)
  225. BOOL
  226. __cdecl
  227. VrfFTPrintfResourceFormat(
  228. BOOL bConvertToOEM,
  229. FILE *file,
  230. UINT uIdResFmtString,
  231. ...); // returns FALSE on a _ftprintf error (disk full)
  232. void
  233. __cdecl
  234. VrfTPrintfResourceFormat(
  235. UINT uIdResFmtString,
  236. ...);
  237. void
  238. VrfPutTS(
  239. LPTSTR strText );
  240. //
  241. // Exit codes for cmd line execution
  242. //
  243. #define EXIT_CODE_SUCCESS 0
  244. #define EXIT_CODE_ERROR 1
  245. #define EXIT_CODE_REBOOT_NEEDED 2
  246. //////////////////////////////////////////////////////////////////////
  247. ////////////////////////////////////////////////////////// Global Data
  248. //////////////////////////////////////////////////////////////////////
  249. //
  250. // Command line / GUI
  251. //
  252. extern BOOL g_bCommandLineMode;
  253. //
  254. // OS version and build number information
  255. //
  256. extern OSVERSIONINFO g_OsVersion;
  257. // ...
  258. #endif // #ifndef _VERIFY_HXX_INCLUDED_
  259. //
  260. // end of header: verify.hxx
  261. //