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.

177 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. Exch.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 "Exch.h"
  12. #include "sadapi.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CExch property page
  20. IMPLEMENT_DYNCREATE(CExch, CPropertyPage)
  21. CExch::CExch() : CPropertyPage(CExch::IDD)
  22. {
  23. //{{AFX_DATA_INIT(CExch)
  24. m_csDomainName = _T("");
  25. m_csServerName = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. CExch::~CExch()
  29. {
  30. }
  31. void CExch::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CPropertyPage::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(CExch)
  35. DDX_Text(pDX, IDC_STATIC_DOMAIN, m_csDomainName);
  36. DDX_Text(pDX, IDC_SERVERNAME_EDIT, m_csServerName);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CExch, CPropertyPage)
  40. //{{AFX_MSG_MAP(CExch)
  41. ON_WM_SHOWWINDOW()
  42. //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CExch message handlers
  46. LRESULT CExch::OnWizardNext()
  47. {
  48. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  49. UpdateData(TRUE);
  50. if (m_csServerName == L"")
  51. {
  52. AfxMessageBox(IDS_NO_EXCH_SERVER);
  53. GetDlgItem(IDC_SERVERNAME_EDIT)->SetFocus();
  54. return -1;
  55. }
  56. pApp->m_csExchangeServer = m_csServerName;
  57. return IDD_RESTRICTIONS_DIALOG;
  58. }
  59. LRESULT CExch::OnWizardBack()
  60. {
  61. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  62. if (pApp->m_bNW) return IDD_FPNW_DLG;
  63. else if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG;
  64. else if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG;
  65. else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG;
  66. else if (pApp->m_bProfile) return IDD_PROFILE;
  67. else return IDD_OPTIONS_DIALOG;
  68. }
  69. void CExch::OnShowWindow(BOOL bShow, UINT nStatus)
  70. {
  71. CPropertyPage::OnShowWindow(bShow, nStatus);
  72. if (bShow)
  73. {
  74. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  75. m_csDomainName = pApp->m_csDomain;
  76. UpdateData(FALSE);
  77. // bind to the first Exch server
  78. /* PRPCBINDINFO pBindInfo = new RPCBINDINFO;
  79. ZeroMemory(pBindInfo, sizeof(RPCBINDINFO));
  80. TCHAR wszServer[256];
  81. // ZeroMemory(wszServer, 256);
  82. _tcscpy(wszServer, L"");
  83. RPC_SC rVal = SAD_ScBind(pBindInfo, wszServer);
  84. if (rVal != ERROR_SUCCESS)
  85. {
  86. AfxMessageBox(L"cant bind");
  87. return;
  88. }
  89. // using the first server, enumerate the rest
  90. BackupListNode* BackupNode = NULL;
  91. rVal = SAD_ScGetBackupListNodeW(pBindInfo->wszServer, &BackupNode);
  92. SAD_FreeBackupListNode(BackupNode);
  93. SAD_Unbind(pBindInfo);
  94. delete pBindInfo; */
  95. /*
  96. RPC_NS_HANDLE ic;
  97. RPC_STATUS rpcstat;
  98. RPC_BINDING_HANDLE h;
  99. BackupListNode * pBLN = NULL;
  100. #define szRPCEntryNameSAA L"/.:/MSExchangeSAA"
  101. // create context for looking up entries in the RPC name service
  102. rpcstat = RpcNsBindingImportBegin(RPC_C_NS_SYNTAX_DEFAULT,
  103. szRPCEntryNameSAA,
  104. TriggerBackupRPC_ClientIfHandle,
  105. NULL,
  106. &ic);
  107. if (rpcstat == RPC_S_OK)
  108. {
  109. do
  110. {
  111. FreeBackupListNode(pBLN);
  112. pBLN = NULL;
  113. // bind to a server somewhere out there
  114. rpcstat = RpcNsBindingImportNext(ic, &h);
  115. if (rpcstat == RPC_S_OK)
  116. {
  117. // bind successful - try to get the list of servers
  118. RPC_SC rVal = ScGetBackupListNode(h, &pBLN);
  119. RpcBindingFree(&h);
  120. if (pBLN != NULL)
  121. {
  122. ASSERT(0);
  123. break;
  124. }
  125. }
  126. }
  127. while (rpcstat != RPC_S_NO_MORE_BINDINGS);
  128. RpcNsBindingImportDone(&ic);
  129. } */
  130. }
  131. }