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.

287 lines
8.0 KiB

  1. //
  2. // Driver Verifier UI
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. //
  7. // module: CSetPage.cpp
  8. // author: DMihai
  9. // created: 11/1/00
  10. //
  11. // Description:
  12. //
  13. #include "stdafx.h"
  14. #include "verifier.h"
  15. #include "CSetPage.h"
  16. #include "VrfUtil.h"
  17. #include "VGlobal.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. //
  24. // Change this if you add/remove/change order
  25. // of radio buttons on this page
  26. //
  27. #define FIRST_RADIO_BUTTON_ID IDC_CUSTSETT_PREDEF_RADIO
  28. //
  29. // Help IDs
  30. //
  31. static DWORD MyHelpIds[] =
  32. {
  33. IDC_CUSTSETT_PREDEF_RADIO, IDH_DV_EnablePredefined,
  34. IDC_CUSTSETT_FULLLIST_RADIO, IDH_DV_IndividualSettings,
  35. IDC_CUSTSETT_TYPICAL_CHECK, IDH_DV_Standard,
  36. IDC_CUSTSETT_EXCESS_CHECK, IDH_DV_Rigorous,
  37. IDC_CUSTSETT_LOWRES_CHECK, IDH_DV_LowResource,
  38. IDC_CUSTSETT_DISK_CHECK, IDH_DV_DiskCheck,
  39. 0, 0
  40. };
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CCustSettPage property page
  43. IMPLEMENT_DYNCREATE(CCustSettPage, CVerifierPropertyPage)
  44. CCustSettPage::CCustSettPage()
  45. : CVerifierPropertyPage( CCustSettPage::IDD )
  46. {
  47. //{{AFX_DATA_INIT(CCustSettPage)
  48. m_bTypicalTests = FALSE;
  49. m_bExcessiveTests = FALSE;
  50. m_bLowResTests = FALSE;
  51. m_bDiskTests = FALSE;
  52. m_nCrtRadio = -1;
  53. //}}AFX_DATA_INIT
  54. }
  55. CCustSettPage::~CCustSettPage()
  56. {
  57. }
  58. void CCustSettPage::DoDataExchange(CDataExchange* pDX)
  59. {
  60. CVerifierPropertyPage::DoDataExchange(pDX);
  61. //{{AFX_DATA_MAP(CCustSettPage)
  62. DDX_Control(pDX, IDC_CUSTSETT_NEXT_DESCR_STATIC, m_NextDescription);
  63. DDX_Control(pDX, IDC_CUSTSETT_TYPICAL_CHECK, m_TypicalTestsCheck);
  64. DDX_Control(pDX, IDC_CUSTSETT_LOWRES_CHECK, m_LowresTestsCheck);
  65. DDX_Control(pDX, IDC_CUSTSETT_DISK_CHECK, m_DiskTestsCheck);
  66. DDX_Control(pDX, IDC_CUSTSETT_EXCESS_CHECK, m_ExcessTestsCheck);
  67. DDX_Check(pDX, IDC_CUSTSETT_TYPICAL_CHECK, m_bTypicalTests);
  68. DDX_Check(pDX, IDC_CUSTSETT_EXCESS_CHECK, m_bExcessiveTests);
  69. DDX_Check(pDX, IDC_CUSTSETT_LOWRES_CHECK, m_bLowResTests);
  70. DDX_Check(pDX, IDC_CUSTSETT_DISK_CHECK, m_bDiskTests);
  71. DDX_Radio(pDX, IDC_CUSTSETT_PREDEF_RADIO, m_nCrtRadio);
  72. //}}AFX_DATA_MAP
  73. }
  74. BEGIN_MESSAGE_MAP(CCustSettPage, CVerifierPropertyPage)
  75. //{{AFX_MSG_MAP(CCustSettPage)
  76. ON_BN_CLICKED(IDC_CUSTSETT_FULLLIST_RADIO, OnFulllistRadio)
  77. ON_BN_CLICKED(IDC_CUSTSETT_PREDEF_RADIO, OnPredefRadio)
  78. ON_WM_CONTEXTMENU()
  79. ON_MESSAGE( WM_HELP, OnHelp )
  80. //}}AFX_MSG_MAP
  81. END_MESSAGE_MAP()
  82. /////////////////////////////////////////////////////////////////////////////
  83. VOID CCustSettPage::EnablePredefCheckboxes( BOOL bEnable )
  84. {
  85. m_TypicalTestsCheck.EnableWindow( bEnable );
  86. m_LowresTestsCheck.EnableWindow( bEnable );
  87. m_ExcessTestsCheck.EnableWindow( bEnable );
  88. m_DiskTestsCheck.EnableWindow( bEnable );
  89. }
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CCustSettPage message handlers
  92. /////////////////////////////////////////////////////////////////////////////
  93. LRESULT CCustSettPage::OnWizardNext()
  94. {
  95. LRESULT lNextPageId;
  96. //
  97. // Let's assume we cannot continue
  98. //
  99. lNextPageId = -1;
  100. if( UpdateData() == TRUE )
  101. {
  102. if( IDC_CUSTSETT_PREDEF_RADIO - FIRST_RADIO_BUTTON_ID == m_nCrtRadio )
  103. {
  104. //
  105. // Use predefined settings
  106. //
  107. if( FALSE == m_bTypicalTests &&
  108. FALSE == m_bExcessiveTests &&
  109. FALSE == m_bLowResTests &&
  110. FALSE == m_bDiskTests )
  111. {
  112. //
  113. // No tests are currently selected - we cannot continue
  114. //
  115. VrfErrorResourceFormat( IDS_NO_TESTS_SELECTED );
  116. }
  117. else
  118. {
  119. //
  120. // Set our data according to the GUI
  121. //
  122. //
  123. // Use predefined settings
  124. //
  125. g_NewVerifierSettings.m_SettingsBits.EnableTypicalTests( m_bTypicalTests );
  126. g_NewVerifierSettings.m_SettingsBits.EnableExcessiveTests( m_bExcessiveTests );
  127. g_NewVerifierSettings.m_SettingsBits.EnableLowResTests( m_bLowResTests );
  128. g_bShowDiskPropertyPage = m_bDiskTests;
  129. //
  130. // Go to the next page
  131. //
  132. if( FALSE != m_bTypicalTests ||
  133. FALSE != m_bExcessiveTests ||
  134. FALSE != m_bLowResTests )
  135. {
  136. //
  137. // We have at least one type of test that applies to drivers.
  138. //
  139. lNextPageId = IDD_DRVSET_PAGE;
  140. }
  141. else
  142. {
  143. //
  144. // Only the disk integrity checking is enabled.
  145. //
  146. ASSERT( FALSE != m_bDiskTests );
  147. lNextPageId = IDD_DISK_LIST_PAGE;
  148. }
  149. }
  150. }
  151. else
  152. {
  153. //
  154. // Select the tests to be performed from a full list
  155. //
  156. lNextPageId = IDD_FULL_LIST_SETT_PAGE;
  157. }
  158. }
  159. if( -1 != lNextPageId )
  160. {
  161. //
  162. // Have some valid custom settings and we are going to the next page
  163. //
  164. g_NewVerifierSettings.m_SettingsBits.m_SettingsType = CSettingsBits::SettingsTypeCustom;
  165. }
  166. GoingToNextPageNotify( lNextPageId );
  167. return lNextPageId;
  168. }
  169. /////////////////////////////////////////////////////////////////////////////
  170. LRESULT CCustSettPage::OnWizardBack()
  171. {
  172. g_bShowDiskPropertyPage = FALSE;
  173. return CVerifierPropertyPage::OnWizardBack();
  174. }
  175. /////////////////////////////////////////////////////////////////////////////
  176. BOOL CCustSettPage::OnInitDialog()
  177. {
  178. //
  179. // Don't try to reconstruct the current data from the registry
  180. // to the GUI because it's too hard. Always start with standard tests.
  181. //
  182. m_nCrtRadio = IDC_CUSTSETT_PREDEF_RADIO - FIRST_RADIO_BUTTON_ID;
  183. m_bTypicalTests = TRUE;
  184. m_bExcessiveTests = FALSE;
  185. m_bLowResTests = FALSE;
  186. m_bDiskTests = FALSE;
  187. CVerifierPropertyPage::OnInitDialog();
  188. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_PREDEFINED );
  189. return TRUE; // return TRUE unless you set the focus to a control
  190. // EXCEPTION: OCX Property Pages should return FALSE
  191. }
  192. /////////////////////////////////////////////////////////////////////////////
  193. void CCustSettPage::OnFulllistRadio()
  194. {
  195. EnablePredefCheckboxes( FALSE );
  196. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_LIST );
  197. }
  198. /////////////////////////////////////////////////////////////////////////////
  199. void CCustSettPage::OnPredefRadio()
  200. {
  201. EnablePredefCheckboxes( TRUE );
  202. VrfSetWindowText( m_NextDescription, IDS_TAS_PAGE_NEXT_DESCR_PREDEFINED );
  203. }
  204. /////////////////////////////////////////////////////////////
  205. BOOL CCustSettPage::OnSetActive()
  206. {
  207. m_pParentSheet->SetWizardButtons( PSWIZB_NEXT |
  208. PSWIZB_BACK );
  209. return CVerifierPropertyPage::OnSetActive();
  210. }
  211. /////////////////////////////////////////////////////////////
  212. LONG CCustSettPage::OnHelp( WPARAM wParam, LPARAM lParam )
  213. {
  214. LONG lResult = 0;
  215. LPHELPINFO lpHelpInfo = (LPHELPINFO)lParam;
  216. ::WinHelp(
  217. (HWND) lpHelpInfo->hItemHandle,
  218. g_szVerifierHelpFile,
  219. HELP_WM_HELP,
  220. (DWORD_PTR) MyHelpIds );
  221. return lResult;
  222. }
  223. /////////////////////////////////////////////////////////////////////////////
  224. void CCustSettPage::OnContextMenu(CWnd* pWnd, CPoint point)
  225. {
  226. ::WinHelp(
  227. pWnd->m_hWnd,
  228. g_szVerifierHelpFile,
  229. HELP_CONTEXTMENU,
  230. (DWORD_PTR) MyHelpIds );
  231. }