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.

126 lines
2.7 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. fileprop.cpp
  5. Abstract:
  6. Implementation of the files property page.
  7. --*/
  8. #include "stdafx.h"
  9. #include "globals.h"
  10. #include "dialogs.h"
  11. #include "smcfghlp.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. USE_HANDLE_MACROS("SMLOGCFG(dialogs.cpp)");
  18. static ULONG
  19. sPASSWORD_aulHelpIds[] =
  20. {
  21. IDC_USERNAME, IDH_USERNAME,
  22. IDC_PASSWORD1, IDH_CTRS_ENTER_PWD,
  23. IDC_PASSWORD2, IDH_CTRS_REENTER_PWD,
  24. 0,0
  25. };
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CPasswordDlg dialog
  28. CPasswordDlg::CPasswordDlg(CWnd* pParent /*=NULL*/)
  29. : CDialog(CPasswordDlg::IDD, pParent)
  30. {
  31. //{{AFX_DATA_INIT(CPasswordDlg)
  32. m_strUserName = L"";
  33. m_strPassword1 = L"";
  34. m_strPassword2 = L"";
  35. //}}AFX_DATA_INIT
  36. }
  37. CPasswordDlg::~CPasswordDlg()
  38. {
  39. KillString( m_strPassword1 );
  40. KillString( m_strPassword2 );
  41. }
  42. void CPasswordDlg::DoDataExchange(CDataExchange* pDX)
  43. {
  44. CDialog::DoDataExchange(pDX);
  45. //{{AFX_DATA_MAP(CPasswordDlg)
  46. DDX_Text(pDX, IDC_USERNAME, m_strUserName);
  47. DDX_Text(pDX, IDC_PASSWORD1, m_strPassword1);
  48. DDX_Text(pDX, IDC_PASSWORD2, m_strPassword2);
  49. //}}AFX_DATA_MAP
  50. }
  51. BOOL CPasswordDlg::OnInitDialog()
  52. {
  53. if( m_strUserName.GetLength() ){
  54. GetDlgItem( IDC_USERNAME )->EnableWindow(FALSE);
  55. GetDlgItem( IDC_PASSWORD1 )->SetFocus();
  56. }
  57. CDialog::OnInitDialog();
  58. return FALSE;
  59. }
  60. void CPasswordDlg::OnOK()
  61. {
  62. UpdateData();
  63. if( m_strPassword1 != m_strPassword2 ){
  64. CString strMessage;
  65. CString strTitle;
  66. strMessage.LoadString ( IDS_BAD_PASSWORD_MATCH );
  67. strTitle.LoadString( IDS_PASSWORD_TITLE );
  68. MessageBox ( strMessage, strTitle, MB_OK | MB_ICONERROR);
  69. GetDlgItem( IDC_PASSWORD1 )->SetFocus();
  70. return;
  71. }
  72. CDialog::OnOK();
  73. }
  74. BOOL
  75. CPasswordDlg::OnHelpInfo(HELPINFO * pHelpInfo)
  76. {
  77. if (pHelpInfo->iCtrlId >= IDC_PWD_FIRST_HELP_CTRL_ID ||
  78. pHelpInfo->iCtrlId == IDOK ||
  79. pHelpInfo->iCtrlId== IDCANCEL ) {
  80. InvokeWinHelp(WM_HELP,
  81. NULL,
  82. (LPARAM) pHelpInfo,
  83. m_strHelpFilePath,
  84. sPASSWORD_aulHelpIds);
  85. }
  86. return TRUE;
  87. }
  88. DWORD
  89. CPasswordDlg::SetContextHelpFilePath(const CString& rstrPath)
  90. {
  91. DWORD dwStatus = ERROR_SUCCESS;
  92. MFC_TRY
  93. m_strHelpFilePath = rstrPath;
  94. MFC_CATCH_DWSTATUS
  95. return dwStatus;
  96. }
  97. BEGIN_MESSAGE_MAP(CPasswordDlg, CDialog)
  98. //{{AFX_MSG_MAP(CPasswordDlg)
  99. ON_WM_HELPINFO()
  100. //}}AFX_MSG_MAP
  101. END_MESSAGE_MAP()