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.

167 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. OptDlg.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 "OptDlg.h"
  13. #include <lmcons.h>
  14. #include <lmerr.h>
  15. #include <lmserver.h>
  16. #include <winreg.h>
  17. #ifdef _DEBUG
  18. //#define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. /////////////////////////////////////////////////////////////////////////////
  23. // COptionsDlg property page
  24. IMPLEMENT_DYNCREATE(COptionsDlg, CWizBaseDlg)
  25. COptionsDlg::COptionsDlg() : CWizBaseDlg(COptionsDlg::IDD)
  26. {
  27. //{{AFX_DATA_INIT(COptionsDlg)
  28. m_bNW = FALSE;
  29. m_bProfile = FALSE;
  30. m_bRAS = FALSE;
  31. m_bExchange = FALSE;
  32. m_bHomeDir = FALSE;
  33. m_bLoginScript = FALSE;
  34. m_csCaption = _T("");
  35. //}}AFX_DATA_INIT
  36. }
  37. COptionsDlg::~COptionsDlg()
  38. {
  39. }
  40. void COptionsDlg::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CPropertyPage::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(COptionsDlg)
  44. DDX_Check(pDX, IDC_NW_CHECK, m_bNW);
  45. DDX_Check(pDX, IDC_PROFILE_CHECK, m_bProfile);
  46. DDX_Check(pDX, IDC_RAS_CHECK, m_bRAS);
  47. DDX_Check(pDX, IDC_EXCHANGE_CHECK, m_bExchange);
  48. DDX_Check(pDX, IDC_HOMEDIR_CHECK, m_bHomeDir);
  49. DDX_Check(pDX, IDC_LOGIN_SCRIPT_CHECK, m_bLoginScript);
  50. DDX_Text(pDX, IDC_STATIC1, m_csCaption);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(COptionsDlg, CWizBaseDlg)
  54. //{{AFX_MSG_MAP(COptionsDlg)
  55. ON_WM_SHOWWINDOW()
  56. //}}AFX_MSG_MAP
  57. END_MESSAGE_MAP()
  58. /////////////////////////////////////////////////////////////////////////////
  59. // COptionsDlg message handlers
  60. void COptionsDlg::OnShowWindow(BOOL bShow, UINT nStatus)
  61. {
  62. CWizBaseDlg::OnShowWindow(bShow, nStatus);
  63. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  64. if (bShow)
  65. {
  66. CString csTemp;
  67. csTemp.LoadString(IDS_OPTION_CAPTION);
  68. CString csTemp2;
  69. csTemp2.Format(csTemp, pApp->m_csUserName);
  70. m_csCaption = csTemp2;
  71. UpdateData(FALSE);
  72. // first find out whats installed so we know what to enable/disable
  73. TCHAR* pServer = (TCHAR*)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength());
  74. pApp->m_csServer.ReleaseBuffer();
  75. SERVER_INFO_102* pInfo;
  76. NET_API_STATUS nApi = NetServerGetInfo(pServer,
  77. 102,
  78. (LPBYTE*)&pInfo);
  79. if (nApi != ERROR_SUCCESS)
  80. {
  81. AfxMessageBox(IDS_UNKNOWN_COMPONENTS);
  82. GetDlgItem(IDC_NW_CHECK)->EnableWindow(FALSE);
  83. return;
  84. }
  85. // FPNW
  86. GetDlgItem(IDC_NW_CHECK)->EnableWindow(pInfo->sv102_type & SV_TYPE_SERVER_MFPN);
  87. m_bNW = (pInfo->sv102_type & SV_TYPE_SERVER_MFPN) ? m_bNW : FALSE;
  88. UpdateData(FALSE);
  89. // exchange- look for the usrmgr extension entry
  90. HKEY hKey;
  91. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  92. long lRet = RegConnectRegistry(
  93. (LPTSTR)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()),
  94. HKEY_LOCAL_MACHINE,
  95. &hKey);
  96. if (lRet != ERROR_SUCCESS)
  97. {
  98. GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(FALSE);
  99. m_bExchange = FALSE;
  100. UpdateData(FALSE);
  101. return;
  102. }
  103. DWORD cbProv = 0;
  104. DWORD dwRet = RegOpenKey(hKey,
  105. TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Network\\UMAddOns"), &hKey );
  106. TCHAR* lpPrimaryDomain = NULL;
  107. if ((dwRet = RegQueryValueEx( hKey, TEXT("Mailumx"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS)
  108. GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(TRUE);
  109. else GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(FALSE);
  110. RegCloseKey(hKey);
  111. }
  112. }
  113. LRESULT COptionsDlg::OnWizardNext()
  114. {
  115. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  116. UpdateData(TRUE);
  117. pApp->m_bProfile = m_bProfile;
  118. pApp->m_bLoginScript = m_bLoginScript;
  119. pApp->m_bHomeDir = m_bHomeDir;
  120. pApp->m_bRAS = m_bRAS;
  121. pApp->m_bNW = m_bNW;
  122. pApp->m_bExchange = m_bExchange;
  123. if (m_bProfile) return IDD_PROFILE;
  124. else if (m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG;
  125. else if (m_bHomeDir) return IDD_HOMEDIR_DIALOG;
  126. else if (m_bRAS) return IDD_RAS_PERM_DIALOG;
  127. else if (m_bNW) return IDD_FPNW_DLG;
  128. else if (m_bExchange) return IDD_EXCHANGE_DIALOG;
  129. else return IDD_RESTRICTIONS_DIALOG;
  130. }