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.

107 lines
2.9 KiB

  1. //============================================================================
  2. // Copyright (C) Microsoft Corporation, 1996 - 1999
  3. //
  4. // File: CnctDlg.cpp
  5. //
  6. // History:
  7. // 05/24/96 Michael Clark Created.
  8. //
  9. // Implements the Router Connection dialog
  10. //============================================================================
  11. //
  12. #include "stdafx.h"
  13. #include "CnctDlg.h"
  14. #include "lsa.h" // RtlEncodeW/RtlDecodeW
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. //
  22. // CConnectAsDlg dialog
  23. //
  24. /////////////////////////////////////////////////////////////////////////////
  25. CConnectAsDlg::CConnectAsDlg(CWnd* pParent /*=NULL*/)
  26. : CBaseDialog(CConnectAsDlg::IDD, pParent)
  27. {
  28. //{{AFX_DATA_INIT(CConnectAsDlg)
  29. m_sUserName = _T("");
  30. m_sPassword = _T("");
  31. m_stTempPassword = m_sPassword;
  32. m_sRouterName= _T("");
  33. //}}AFX_DATA_INIT
  34. // SetHelpMap(m_dwHelpMap);
  35. }
  36. void CConnectAsDlg::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CBaseDialog::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CConnectAsDlg)
  40. DDX_Text(pDX, IDC_EDIT_USERNAME, m_sUserName);
  41. DDX_Text(pDX, IDC_EDIT_USER_PASSWORD, m_stTempPassword);
  42. //}}AFX_DATA_MAP
  43. if (pDX->m_bSaveAndValidate)
  44. {
  45. // Copy the data into the new buffer
  46. // ------------------------------------------------------------
  47. m_sPassword = m_stTempPassword;
  48. // Clear out the temp password, by copying 0's
  49. // into its buffer
  50. // ------------------------------------------------------------
  51. int cPassword = m_stTempPassword.GetLength();
  52. ::SecureZeroMemory(m_stTempPassword.GetBuffer(0),
  53. cPassword * sizeof(TCHAR));
  54. m_stTempPassword.ReleaseBuffer();
  55. // Encode the password into the real password buffer
  56. // ------------------------------------------------------------
  57. m_ucSeed = CONNECTAS_ENCRYPT_SEED;
  58. RtlEncodeW(&m_ucSeed, m_sPassword.GetBuffer(0));
  59. m_sPassword.ReleaseBuffer();
  60. }
  61. }
  62. BEGIN_MESSAGE_MAP(CConnectAsDlg, CBaseDialog)
  63. //{{AFX_MSG_MAP(CConnectAsDlg)
  64. // NOTE: the ClassWizard will add message map macros here
  65. //}}AFX_MSG_MAP
  66. END_MESSAGE_MAP()
  67. DWORD CConnectAsDlg::m_dwHelpMap[] =
  68. {
  69. // IDC_USER_NAME, HIDC_USER_NAME,
  70. // IDC_USER, HIDC_USER,
  71. // IDC_USER_PASSWORD, HIDC_USER_PASSWORD,
  72. // IDC_PASSWORD, HIDC_PASSWORD,
  73. // IDC_INACCESSIBLE_RESOURCE, HIDC_INACCESSIBLE_RESOURCE,
  74. // IDC_MACHINE_NAME, HIDC_MACHINE_NAME,
  75. 0,0
  76. };
  77. BOOL CConnectAsDlg::OnInitDialog()
  78. {
  79. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  80. BOOL fReturn;
  81. CString st;
  82. fReturn = CBaseDialog::OnInitDialog();
  83. st.Format(IDS_CONNECT_AS_TEXT, (LPCTSTR) m_sRouterName);
  84. SetDlgItemText(IDC_TEXT_INACCESSIBLE_RESOURCE, st);
  85. // Bring this window to the top
  86. BringWindowToTop();
  87. return fReturn;
  88. }