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.

572 lines
11 KiB

  1. //
  2. // Driver Verifier UI
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. //
  7. // module: VSetting.h
  8. // author: DMihai
  9. // created: 11/1/00
  10. //
  11. // Description:
  12. //
  13. //////////////////////////////////////////////////////////////////////
  14. #if !defined(AFX_VSETTING_H__478A94E4_3D60_4419_950C_2144CB86691D__INCLUDED_)
  15. #define AFX_VSETTING_H__478A94E4_3D60_4419_950C_2144CB86691D__INCLUDED_
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif // _MSC_VER > 1000
  19. #include "ProgCtrl.h"
  20. ///////////////////////////////////////////////////////////////
  21. //
  22. // CDriverData class
  23. //
  24. // Has information about one driver
  25. //
  26. class CDriverData : public CObject
  27. {
  28. public:
  29. CDriverData();
  30. CDriverData( const CDriverData &DriverData );
  31. CDriverData( LPCTSTR szDriverName );
  32. virtual ~CDriverData();
  33. public:
  34. //
  35. // Operators
  36. //
  37. //
  38. // Methods
  39. //
  40. BOOL LoadDriverImageData();
  41. //
  42. // Overrides
  43. //
  44. virtual void AssertValid( ) const;
  45. protected:
  46. BOOL LoadDriverHeaderData();
  47. BOOL LoadDriverVersionData();
  48. public:
  49. //
  50. // Type definitions
  51. //
  52. typedef enum
  53. {
  54. SignedNotVerifiedYet = 1,
  55. SignedYes,
  56. SignedNo
  57. } SignedTypeEnum;
  58. typedef enum
  59. {
  60. VerifyDriverNo = 1,
  61. VerifyDriverYes
  62. } VerifyDriverTypeEnum;
  63. public:
  64. //
  65. // Data
  66. //
  67. CString m_strName;
  68. SignedTypeEnum m_SignedStatus;
  69. VerifyDriverTypeEnum m_VerifyDriverStatus;
  70. //
  71. // If the current driver is a miniport then
  72. // m_strMiniportName is the driver it is linked against (videoprt.sys, etc.)
  73. //
  74. CString m_strMiniportName;
  75. //
  76. // If this is a "special driver" this is the name to add to the verification list
  77. //
  78. // - hal.dll for the HAL
  79. // - ntoskrnl.exe fro the kernel
  80. //
  81. CString m_strReservedName;
  82. //
  83. // Binary header info
  84. //
  85. WORD m_wMajorOperatingSystemVersion;
  86. WORD m_wMajorImageVersion;
  87. //
  88. // Version info
  89. //
  90. CString m_strCompanyName;
  91. CString m_strFileVersion;
  92. CString m_strFileDescription;
  93. };
  94. ///////////////////////////////////////////////////////////////
  95. //
  96. // CDriverDataArray class
  97. //
  98. // ObArray of CDriverData
  99. //
  100. class CDriverDataArray : public CObArray
  101. {
  102. public:
  103. ~CDriverDataArray();
  104. public:
  105. VOID DeleteAll();
  106. CDriverData *GetAt( INT_PTR nIndex ) const;
  107. public:
  108. //
  109. // Operators
  110. //
  111. CDriverDataArray &operator = (const CDriverDataArray &DriversSet);
  112. };
  113. ///////////////////////////////////////////////////////////////
  114. //
  115. // CDriversSet class
  116. //
  117. // Describes a set of drivers to verify
  118. //
  119. class CDriversSet : public CObject
  120. {
  121. public:
  122. CDriversSet();
  123. virtual ~CDriversSet();
  124. public:
  125. //
  126. // Find all installed unsigned drivers if we didn't do that already
  127. //
  128. BOOL LoadAllDriversData( HANDLE hAbortEvent,
  129. CVrfProgressCtrl &ProgressCtl );
  130. BOOL FindUnsignedDrivers( HANDLE hAbortEvent,
  131. CVrfProgressCtrl &ProgressCtl );
  132. BOOL ShouldDriverBeVerified( const CDriverData *pDriverData ) const;
  133. BOOL ShouldVerifySomeDrivers( ) const;
  134. BOOL GetDriversToVerify( CString &strDriversToVerify );
  135. //
  136. // Operators
  137. //
  138. CDriversSet &operator = (const CDriversSet &DriversSet);
  139. //
  140. // Add a new verifier data structure based on the name
  141. // Returns the new item's index in the array.
  142. //
  143. INT_PTR AddNewDriverData( LPCTSTR szDriverName );
  144. //
  145. // Is this driver name already in our list?
  146. //
  147. BOOL IsDriverNameInList( LPCTSTR szDriverName );
  148. //
  149. // Overrides
  150. //
  151. virtual void AssertValid( ) const;
  152. protected:
  153. //
  154. // Load all installed driver names if we didn't do this already
  155. //
  156. BOOL LoadAllDriversNames( HANDLE hAbortEvent );
  157. public:
  158. //
  159. // Types
  160. //
  161. typedef enum
  162. {
  163. DriversSetCustom = 1,
  164. DriversSetOldOs,
  165. DriversSetNotSigned,
  166. DriversSetAllDrivers
  167. } DriversSetTypeEnum;
  168. //
  169. // Data
  170. //
  171. //
  172. // Standard, custom, etc.
  173. //
  174. DriversSetTypeEnum m_DriverSetType;
  175. //
  176. // Array with data for all the currently installed drivers
  177. //
  178. CDriverDataArray m_aDriverData;
  179. //
  180. // Extra drivers (not currenly installed) to verify
  181. //
  182. CStringArray m_astrNotInstalledDriversToVerify;
  183. //
  184. // Did we initialize already the driver data array?
  185. //
  186. BOOL m_bDriverDataInitialized;
  187. //
  188. // Did we initialize already the unsigned drivers member
  189. // of the driver data structure?
  190. //
  191. BOOL m_bUnsignedDriverDataInitialized;
  192. };
  193. ///////////////////////////////////////////////////////////////
  194. //
  195. // CSettingsBits class
  196. //
  197. // Describes a set of verifier settings bits
  198. //
  199. class CSettingsBits : public CObject
  200. {
  201. public:
  202. CSettingsBits();
  203. virtual ~CSettingsBits();
  204. public:
  205. //
  206. // Type definitions
  207. //
  208. typedef enum
  209. {
  210. SettingsTypeTypical = 1,
  211. SettingsTypeCustom,
  212. } SettingsTypeEnum;
  213. public:
  214. //
  215. // Operators
  216. //
  217. CSettingsBits &operator = (const CSettingsBits &VerifSettings);
  218. //
  219. // Overrides
  220. //
  221. virtual void AssertValid() const;
  222. //
  223. // Methods
  224. //
  225. VOID SetTypicalOnly();
  226. VOID EnableTypicalTests( BOOL bEnable );
  227. VOID EnableExcessiveTests( BOOL bEnable );
  228. VOID EnableLowResTests( BOOL bEnable );
  229. BOOL GetVerifierFlags( DWORD &dwVerifyFlags );
  230. public:
  231. //
  232. // Data
  233. //
  234. SettingsTypeEnum m_SettingsType;
  235. BOOL m_bSpecialPoolEnabled;
  236. BOOL m_bForceIrqlEnabled;
  237. BOOL m_bLowResEnabled;
  238. BOOL m_bPoolTrackingEnabled;
  239. BOOL m_bIoEnabled;
  240. BOOL m_bDeadlockDetectEnabled;
  241. BOOL m_bDMAVerifEnabled;
  242. BOOL m_bEnhIoEnabled;
  243. };
  244. ///////////////////////////////////////////////////////////////
  245. //
  246. // CDiskData class
  247. //
  248. // Has information about one disk.
  249. //
  250. class CDiskData : public CObject
  251. {
  252. public:
  253. CDiskData( LPCTSTR szVerifierEnabled,
  254. LPCTSTR szDiskDevicesForDisplay,
  255. LPCTSTR szDiskDevicesPDOName );
  256. CDiskData( const CDiskData &DiskData );
  257. virtual ~CDiskData();
  258. public:
  259. //
  260. // Operators
  261. //
  262. //
  263. // Methods
  264. //
  265. //
  266. // Overrides
  267. //
  268. virtual void AssertValid( ) const;
  269. protected:
  270. public:
  271. //
  272. // Data
  273. //
  274. BOOL m_bVerifierEnabled;
  275. CString m_strDiskDevicesForDisplay;
  276. CString m_strDiskDevicesPDOName;
  277. };
  278. ///////////////////////////////////////////////////////////////
  279. //
  280. // CDiskDataArray class
  281. //
  282. // ObArray of CDiskData
  283. //
  284. class CDiskDataArray : public CObArray
  285. {
  286. public:
  287. CDiskDataArray();
  288. ~CDiskDataArray();
  289. public:
  290. VOID DeleteAll();
  291. CDiskData *GetAt( INT_PTR nIndex ) const;
  292. BOOL InitializeDiskList();
  293. BOOL VerifyAnyDisk();
  294. BOOL SaveNewSettings();
  295. BOOL DeleteAllSettings();
  296. VOID SetVerifyAllDisks( BOOL bEnabled );
  297. public:
  298. //
  299. // Operators
  300. //
  301. CDiskDataArray &operator = (const CDiskDataArray &DiskDataArray);
  302. public:
  303. //
  304. // Data.
  305. //
  306. };
  307. ///////////////////////////////////////////////////////////////
  308. //
  309. // CVerifierSettings class
  310. //
  311. // Describes a set of drivers and/or disks to verify and
  312. // the verifier settings bits
  313. //
  314. class CVerifierSettings : public CObject
  315. {
  316. public:
  317. CVerifierSettings();
  318. virtual ~CVerifierSettings();
  319. public:
  320. //
  321. // Operators
  322. //
  323. CVerifierSettings &operator = (const CVerifierSettings &VerifSettings);
  324. //
  325. // Overrides
  326. //
  327. virtual void AssertValid() const;
  328. //
  329. // Methods
  330. //
  331. BOOL SaveToRegistry();
  332. public:
  333. //
  334. // Data
  335. //
  336. //
  337. // XP and earlier driver verifier settings.
  338. //
  339. CSettingsBits m_SettingsBits;
  340. CDriversSet m_DriversSet;
  341. //
  342. // Disk integrity verifier settings.
  343. //
  344. CDiskDataArray m_aDiskData;
  345. };
  346. //////////////////////////////////////////////////////////////////////
  347. //////////////////////////////////////////////////////////////////////
  348. //////////////////////////////////////////////////////////////////////
  349. //
  350. // Runtime data - queried from the kernel
  351. //
  352. //////////////////////////////////////////////////////////////////////
  353. //////////////////////////////////////////////////////////////////////
  354. //////////////////////////////////////////////////////////////////////
  355. //////////////////////////////////////////////////////////////////////
  356. //
  357. // class CRuntimeDriverData
  358. //
  359. class CRuntimeDriverData : public CObject
  360. {
  361. public:
  362. //
  363. // Construction
  364. //
  365. CRuntimeDriverData();
  366. public:
  367. //
  368. // Data
  369. //
  370. CString m_strName;
  371. ULONG Loads;
  372. ULONG Unloads;
  373. ULONG CurrentPagedPoolAllocations;
  374. ULONG CurrentNonPagedPoolAllocations;
  375. ULONG PeakPagedPoolAllocations;
  376. ULONG PeakNonPagedPoolAllocations;
  377. SIZE_T PagedPoolUsageInBytes;
  378. SIZE_T NonPagedPoolUsageInBytes;
  379. SIZE_T PeakPagedPoolUsageInBytes;
  380. SIZE_T PeakNonPagedPoolUsageInBytes;
  381. };
  382. //////////////////////////////////////////////////////////////////////
  383. //
  384. // class CRuntimeDriverDataArray
  385. //
  386. class CRuntimeDriverDataArray : public CObArray
  387. {
  388. public:
  389. ~CRuntimeDriverDataArray();
  390. public:
  391. CRuntimeDriverData *GetAt( INT_PTR nIndex );
  392. VOID DeleteAll();
  393. };
  394. //////////////////////////////////////////////////////////////////////
  395. //
  396. // class CRuntimeVerifierData
  397. //
  398. class CRuntimeVerifierData : public CObject
  399. {
  400. public:
  401. //
  402. // Construction
  403. //
  404. CRuntimeVerifierData();
  405. public:
  406. //
  407. // Methods
  408. //
  409. VOID FillWithDefaults();
  410. BOOL IsDriverVerified( LPCTSTR szDriveName );
  411. public:
  412. //
  413. // Data
  414. //
  415. BOOL m_bSpecialPool;
  416. BOOL m_bPoolTracking;
  417. BOOL m_bForceIrql;
  418. BOOL m_bIo;
  419. BOOL m_bEnhIo;
  420. BOOL m_bDeadlockDetect;
  421. BOOL m_bDMAVerif;
  422. BOOL m_bLowRes;
  423. ULONG RaiseIrqls;
  424. ULONG AcquireSpinLocks;
  425. ULONG SynchronizeExecutions;
  426. ULONG AllocationsAttempted;
  427. ULONG AllocationsSucceeded;
  428. ULONG AllocationsSucceededSpecialPool;
  429. ULONG AllocationsWithNoTag;
  430. ULONG Trims;
  431. ULONG AllocationsFailed;
  432. ULONG AllocationsFailedDeliberately;
  433. ULONG UnTrackedPool;
  434. DWORD Level;
  435. CRuntimeDriverDataArray m_RuntimeDriverDataArray;
  436. };
  437. #endif // !defined(AFX_VSETTING_H__478A94E4_3D60_4419_950C_2144CB86691D__INCLUDED_)