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.

138 lines
2.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991-1996 **/
  4. /**********************************************************************/
  5. /*
  6. LRem.cpp : implementation file
  7. CPropertyPage support for Group management wizard
  8. FILE HISTORY:
  9. Jony Apr-1996 created
  10. */
  11. #include "stdafx.h"
  12. #include "Romaine.h"
  13. #include "LRem.h"
  14. #include <lmcons.h>
  15. #include <lmaccess.h>
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. extern int ClassifyMachine(CString& csMachineName);
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CLRem property page
  24. IMPLEMENT_DYNCREATE(CLRem, CPropertyPage)
  25. CLRem::CLRem() : CPropertyPage(CLRem::IDD)
  26. {
  27. //{{AFX_DATA_INIT(CLRem)
  28. m_nLocation = 0;
  29. m_csStatic1 = _T("");
  30. //}}AFX_DATA_INIT
  31. }
  32. CLRem::~CLRem()
  33. {
  34. }
  35. void CLRem::DoDataExchange(CDataExchange* pDX)
  36. {
  37. CPropertyPage::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(CLRem)
  39. DDX_Radio(pDX, IDC_LOCAL_RADIO, m_nLocation);
  40. DDX_Text(pDX, IDC_STATIC1, m_csStatic1);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CLRem, CPropertyPage)
  44. //{{AFX_MSG_MAP(CLRem)
  45. ON_WM_SHOWWINDOW()
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CLRem message handlers
  50. LRESULT CLRem::OnWizardNext()
  51. {
  52. CRomaineApp* pApp = (CRomaineApp*)AfxGetApp();
  53. UpdateData(TRUE);
  54. if (m_nLocation == 0)
  55. {
  56. int nVal = ClassifyMachine(pApp->m_csCurrentMachine);
  57. // if we are creating a new group, go ahead and check the name for uniqueness
  58. if (pApp->m_sMode == 0)
  59. {
  60. TCHAR* pServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength());
  61. pApp->m_csServer.ReleaseBuffer();
  62. TCHAR* pGroupName = pApp->m_csGroupName.GetBuffer(pApp->m_csGroupName.GetLength());
  63. pApp->m_csGroupName.ReleaseBuffer();
  64. GROUP_INFO_0* pInfo;
  65. NET_API_STATUS nAPI = NetGroupGetInfo(pServer,
  66. pGroupName,
  67. 0,
  68. (LPBYTE*)&pInfo);
  69. if (nAPI == ERROR_SUCCESS)
  70. {
  71. AfxMessageBox(IDS_GROUP_EXISTS);
  72. return IDD_NAME_DLG;
  73. }
  74. LOCALGROUP_INFO_0* pLInfo;
  75. nAPI = NetLocalGroupGetInfo(pServer,
  76. pGroupName,
  77. 0,
  78. (LPBYTE*)&pLInfo);
  79. if (nAPI == ERROR_SUCCESS)
  80. {
  81. AfxMessageBox(IDS_GROUP_EXISTS);
  82. return IDD_NAME_DLG;
  83. }
  84. }
  85. return nVal;
  86. }
  87. else return IDD_MACHINE_DLG;
  88. }
  89. void CLRem::OnShowWindow(BOOL bShow, UINT nStatus)
  90. {
  91. CPropertyPage::OnShowWindow(bShow, nStatus);
  92. UpdateData(TRUE);
  93. if (bShow)
  94. {
  95. CRomaineApp* pApp = (CRomaineApp*)AfxGetApp();
  96. if (pApp->m_sMode == 1) m_csStatic1.LoadString(IDS_MODIFY3);
  97. else m_csStatic1.LoadString(IDS_CREATE3);
  98. UpdateData(FALSE);
  99. }
  100. }
  101. LRESULT CLRem::OnWizardBack()
  102. {
  103. UpdateData(TRUE);
  104. CRomaineApp* pApp = (CRomaineApp*)AfxGetApp();
  105. if (pApp->m_sMode == 1) return IDD_WELCOME_DLG;
  106. else return IDD_NAME_DLG;
  107. return CPropertyPage::OnWizardBack();
  108. }