Source code of Windows XP (NT5)
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.

155 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. CRasPerm.cpp : implementation file
  5. CPropertyPage support for User mgmt wizard
  6. File History:
  7. JonY Apr-96 created
  8. --*/
  9. #include "stdafx.h"
  10. #include "Speckle.h"
  11. #include "wizbased.h"
  12. #include "RasPerm.h"
  13. #include <rassapi.h>
  14. #ifdef _DEBUG
  15. //#define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CRasPerm property page
  21. IMPLEMENT_DYNCREATE(CRasPerm, CWizBaseDlg)
  22. CRasPerm::CRasPerm() : CWizBaseDlg(CRasPerm::IDD)
  23. {
  24. //{{AFX_DATA_INIT(CRasPerm)
  25. m_csRasPhoneNumber = _T("");
  26. m_nCallBackRadio = 0;
  27. m_csCaption = _T("");
  28. //}}AFX_DATA_INIT
  29. }
  30. CRasPerm::~CRasPerm()
  31. {
  32. }
  33. void CRasPerm::DoDataExchange(CDataExchange* pDX)
  34. {
  35. CPropertyPage::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(CRasPerm)
  37. DDX_Text(pDX, IDC_RASPHONE_EDIT, m_csRasPhoneNumber);
  38. DDX_Radio(pDX, IDC_CALL_BACK_RADIO, m_nCallBackRadio);
  39. DDX_Text(pDX, IDC_STATIC1, m_csCaption);
  40. //}}AFX_DATA_MAP
  41. }
  42. BEGIN_MESSAGE_MAP(CRasPerm, CWizBaseDlg)
  43. //{{AFX_MSG_MAP(CRasPerm)
  44. ON_WM_SHOWWINDOW()
  45. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  46. ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  47. ON_BN_CLICKED(IDC_CALL_BACK_RADIO, OnCallBackRadio)
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CRasPerm message handlers
  52. LRESULT CRasPerm::OnWizardNext()
  53. {
  54. UpdateData(TRUE);
  55. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  56. if ((m_nCallBackRadio == 2) && (m_csRasPhoneNumber == L""))
  57. {
  58. AfxMessageBox(IDS_NO_RAS_NUMBER);
  59. return -1;
  60. }
  61. // check for invalid phone number
  62. if (m_nCallBackRadio == 2)
  63. {
  64. if (m_csRasPhoneNumber.GetLength() > RASSAPI_MAX_PHONENUMBER_SIZE)
  65. {
  66. AfxMessageBox(IDS_RAS_NUMBER_TOO_LONG);
  67. GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus();
  68. return -1;
  69. }
  70. TCHAR* pNum = m_csRasPhoneNumber.GetBuffer(m_csRasPhoneNumber.GetLength());
  71. TCHAR pValid[] = {L"0123456789TPW()@- "};
  72. if (_tcsspnp(pNum, pValid) != NULL)
  73. {
  74. AfxMessageBox(IDS_BAD_RAS_NUMBER);
  75. GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus();
  76. return -1;
  77. }
  78. }
  79. pApp->m_csRasPhoneNumber = m_csRasPhoneNumber;
  80. pApp->m_sCallBackType = m_nCallBackRadio;
  81. if (pApp->m_bNW) return IDD_FPNW_DLG;
  82. else if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG;
  83. else return IDD_RESTRICTIONS_DIALOG;
  84. }
  85. LRESULT CRasPerm::OnWizardBack()
  86. {
  87. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  88. if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG;
  89. else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG;
  90. else if (pApp->m_bProfile) return IDD_PROFILE;
  91. else return IDD_OPTIONS_DIALOG;
  92. }
  93. void CRasPerm::OnShowWindow(BOOL bShow, UINT nStatus)
  94. {
  95. CWizBaseDlg::OnShowWindow(bShow, nStatus);
  96. if (bShow)
  97. {
  98. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  99. CString csTemp;
  100. csTemp.LoadString(IDS_RAS_CAPTION);
  101. CString csTemp2;
  102. csTemp2.Format(csTemp, pApp->m_csUserName);
  103. m_csCaption = csTemp2;
  104. UpdateData(FALSE);
  105. }
  106. }
  107. void CRasPerm::OnRadio3()
  108. {
  109. GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(TRUE);
  110. GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus();
  111. }
  112. void CRasPerm::OnRadio2()
  113. {
  114. GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(FALSE);
  115. }
  116. void CRasPerm::OnCallBackRadio()
  117. {
  118. GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(FALSE);
  119. }