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.

141 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Abstract:
  4. @doc
  5. @module SwTstDlg.cpp | Implementation of the Software Snapshot dialog
  6. @end
  7. Author:
  8. Adi Oltean [aoltean] 07/26/1999
  9. Revision History:
  10. Name Date Comments
  11. aoltean 07/26/1999 Created
  12. aoltean 08/05/1999 Splitting wizard functionality in a base class
  13. aoltean 09/11/1999 More validation of log file name
  14. aoltean 09/09/1999 Adding a default value for the log file name
  15. --*/
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Includes
  18. #include "stdafx.hxx"
  19. #include "resource.h"
  20. #include "vsswprv.h"
  21. #include "GenDlg.h"
  22. #include "SwTstDlg.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. #define STR2W(str) ((LPTSTR)((LPCTSTR)(str)))
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CSoftwareSnapshotTestDlg dialog
  31. CSoftwareSnapshotTestDlg::CSoftwareSnapshotTestDlg(
  32. CWnd* pParent /*=NULL*/
  33. )
  34. : CVssTestGenericDlg(CSoftwareSnapshotTestDlg::IDD, pParent)
  35. {
  36. //{{AFX_DATA_INIT(CSoftwareSnapshotTestDlg)
  37. //}}AFX_DATA_INIT
  38. // m_strLogFileName = _T("e:\\snap.log");
  39. m_nLogFileSize = 100;
  40. m_bReadOnly = TRUE;
  41. }
  42. CSoftwareSnapshotTestDlg::~CSoftwareSnapshotTestDlg()
  43. {
  44. }
  45. void CSoftwareSnapshotTestDlg::DoDataExchange(CDataExchange* pDX)
  46. {
  47. CVssTestGenericDlg::DoDataExchange(pDX);
  48. //{{AFX_DATA_MAP(CSoftwareSnapshotTestDlg)
  49. // DDX_Text(pDX, IDC_SWTST_LOGFILE, m_strLogFileName);
  50. DDX_Text(pDX, IDC_SWTST_LOGFILE_SIZE, m_nLogFileSize);
  51. DDX_Check(pDX,IDC_SWTST_READONLY, m_bReadOnly);
  52. //}}AFX_DATA_MAP
  53. }
  54. BEGIN_MESSAGE_MAP(CSoftwareSnapshotTestDlg, CVssTestGenericDlg)
  55. //{{AFX_MSG_MAP(CSoftwareSnapshotTestDlg)
  56. ON_BN_CLICKED(IDC_NEXT, OnNext)
  57. //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CSoftwareSnapshotTestDlg message handlers
  61. BOOL CSoftwareSnapshotTestDlg::OnInitDialog()
  62. {
  63. CVssFunctionTracer ft( VSSDBG_VSSTEST, L"CCoordDlg::OnInitDialog" );
  64. USES_CONVERSION;
  65. try
  66. {
  67. CVssTestGenericDlg::OnInitDialog();
  68. UpdateData(FALSE);
  69. }
  70. VSS_STANDARD_CATCH(ft)
  71. return TRUE; // return TRUE unless you set the focus to a control
  72. }
  73. void CSoftwareSnapshotTestDlg::OnNext()
  74. {
  75. CVssFunctionTracer ft( VSSDBG_VSSTEST, L"CSoftwareSnapshotTestDlg::OnNext" );
  76. USES_CONVERSION;
  77. try
  78. {
  79. UpdateData();
  80. /*
  81. // Check if file name is empty
  82. if (m_strLogFileName.IsEmpty())
  83. ft.ErrBox( VSSDBG_VSSTEST, E_UNEXPECTED, _T("Invalid value for the Log file name"));
  84. // Check if file name has a drive letter
  85. m_strLogFileName.MakeUpper();
  86. WCHAR* wszLogFileName = T2W((LPTSTR)(LPCTSTR)m_strLogFileName);
  87. WCHAR wszDrive[_MAX_DRIVE];
  88. WCHAR wszDir[_MAX_DIR];
  89. WCHAR wszFileName[_MAX_FNAME];
  90. WCHAR wszExt[_MAX_EXT];
  91. _wsplitpath(wszLogFileName, wszDrive, wszDir, wszFileName, wszExt);
  92. if (wszDrive[0] == L'\0')
  93. ft.ErrBox( VSSDBG_VSSTEST, E_UNEXPECTED, _T("Drive letter not specified for the Log file name"));
  94. if (wszDir[0] == L'\0')
  95. ft.ErrBox( VSSDBG_VSSTEST, E_UNEXPECTED, _T("Directory not specified for the Log file name"));
  96. */
  97. // Check if file name has a drive letter
  98. if (m_nLogFileSize <= 0)
  99. ft.ErrBox( VSSDBG_VSSTEST, E_UNEXPECTED, _T("Invalid value for the Log file initial size"));
  100. EndDialog(IDOK);
  101. }
  102. VSS_STANDARD_CATCH(ft)
  103. }