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.

150 lines
3.1 KiB

  1. //
  2. // Driver Verifier UI
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. // module: DrvVCtrl.cxx
  7. // author: DMihai
  8. // created: 01/04/98
  9. //
  10. // Description:
  11. //
  12. // Defines the class behaviors for the application..
  13. //
  14. #include "stdafx.h"
  15. #include "DrvVCtrl.hxx"
  16. #include "DrvCSht.hxx"
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. static BOOL IsBuildNumberAcceptable()
  23. {
  24. if( g_OsVersion.dwMajorVersion < 5 || g_OsVersion.dwBuildNumber < 1954 )
  25. {
  26. ::AfxMessageBox( IDS_BUILD_WARN,
  27. MB_OK | MB_ICONSTOP );
  28. return FALSE;
  29. }
  30. return TRUE;
  31. }
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CDrvVCtrlApp
  34. BEGIN_MESSAGE_MAP(CDrvVCtrlApp, CWinApp)
  35. //{{AFX_MSG_MAP(CDrvVCtrlApp)
  36. // NOTE - the ClassWizard will add and remove mapping macros here.
  37. // DO NOT EDIT what you see in these blocks of generated code!
  38. //}}AFX_MSG
  39. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CDrvVCtrlApp construction
  43. CDrvVCtrlApp::CDrvVCtrlApp()
  44. {
  45. // TODO: add construction code here,
  46. // Place all significant initialization in InitInstance
  47. CString strAppName;
  48. if( strAppName.LoadString( IDS_APPTITLE ) )
  49. {
  50. m_pszAppName = _tcsdup( (LPCTSTR)strAppName );
  51. }
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // The one and only CDrvVCtrlApp object
  55. CDrvVCtrlApp theApp;
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CDrvVCtrlApp initialization
  58. BOOL CDrvVCtrlApp::InitInstance()
  59. {
  60. DWORD dwExitCode;
  61. //
  62. // Get the OS version and build nuber
  63. //
  64. ZeroMemory (&g_OsVersion, sizeof g_OsVersion);
  65. g_OsVersion.dwOSVersionInfoSize = sizeof g_OsVersion;
  66. GetVersionEx (&g_OsVersion);
  67. //
  68. // check for command line arguments
  69. //
  70. if( __argc > 1 )
  71. {
  72. //
  73. // run just in command line mode
  74. //
  75. dwExitCode = VrfExecuteCommandLine( __argc, __targv );
  76. exit( dwExitCode );
  77. }
  78. else
  79. {
  80. FreeConsole();
  81. //
  82. // check if the build # is acceptable
  83. //
  84. if( ! ::IsBuildNumberAcceptable() )
  85. {
  86. return FALSE;
  87. }
  88. }
  89. AfxEnableControlContainer();
  90. //
  91. // There is only one property sheet in this program so
  92. // we declare it static. It is embedding very big KRN_VERIFIER_STATE and
  93. // VRF_VERIFIER_STATE structures so we don't want them pushed on the stack
  94. //
  95. static CDrvChkSheet dlg;
  96. //
  97. // show the dialog
  98. //
  99. m_pMainWnd = &dlg;
  100. dlg.DoModal();
  101. //
  102. // all done, exit the application
  103. //
  104. if( g_bSettingsSaved )
  105. {
  106. exit( EXIT_CODE_REBOOT_NEEDED );
  107. }
  108. else
  109. {
  110. exit( EXIT_CODE_SUCCESS );
  111. }
  112. //
  113. // not reached
  114. //
  115. return FALSE;
  116. }