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.

128 lines
3.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : Root.cpp //
  3. // //
  4. // DESCRIPTION : Implementation of the Fax extension snapin //
  5. // The snapin root is a hidden node that use to extend //
  6. // comet node. //
  7. // //
  8. // //
  9. // AUTHOR : yossg //
  10. // //
  11. // HISTORY : //
  12. // Oct 27 1999 yossg create //
  13. // Dec 9 1999 yossg Call InitDisplayName from parent //
  14. // Oct 17 2000 yossg //
  15. // //
  16. // Copyright (C) 1999 Microsoft Corporation All Rights Reserved //
  17. /////////////////////////////////////////////////////////////////////////////
  18. #include "StdAfx.h"
  19. #include "snapin.h"
  20. #include "snpnode.h"
  21. #include "Root.h"
  22. #include "FaxServerNode.h"
  23. #include "Icons.h"
  24. #include "resource.h"
  25. /****************************************************
  26. CSnapinRoot Class
  27. ****************************************************/
  28. // {89A457D1-FDF9-11d2-898A-00104B3FF735}
  29. static const GUID CSnapinRootGUID_NODETYPE =
  30. { 0x89a457d1, 0xfdf9, 0x11d2, { 0x89, 0x8a, 0x0, 0x10, 0x4b, 0x3f, 0xf7, 0x35 } };
  31. const GUID* CSnapinRoot::m_NODETYPE = &CSnapinRootGUID_NODETYPE;
  32. const OLECHAR* CSnapinRoot::m_SZNODETYPE = OLESTR("89A457D1-FDF9-11d2-898A-00104B3FF735");
  33. const OLECHAR* CSnapinRoot::m_SZDISPLAY_NAME = OLESTR("root");
  34. const CLSID* CSnapinRoot::m_SNAPIN_CLASSID = &CLSID_Snapin;
  35. /*
  36. - CSnapinRoot::PopulateScopeChildrenList
  37. -
  38. * Purpose:
  39. * Create the Fax Server snapin root node
  40. *
  41. * Arguments:
  42. *
  43. * Return:
  44. * OLE error code
  45. */
  46. HRESULT CSnapinRoot::PopulateScopeChildrenList()
  47. {
  48. DEBUG_FUNCTION_NAME( _T("CSnapinRoot::PopulateScopeChildrenList()"));
  49. HRESULT hr = S_OK;
  50. //
  51. // Add the Fax Node
  52. //
  53. CFaxServerNode * pI;
  54. pI = new CFaxServerNode(this, m_pComponentData, m_bstrServerName.m_str);
  55. if (pI == NULL)
  56. {
  57. hr = E_OUTOFMEMORY;
  58. NodeMsgBox(IDS_MEMORY);
  59. goto Cleanup;
  60. }
  61. pI->SetIcons(IMAGE_FAX, IMAGE_FAX);
  62. hr = pI->InitDisplayName();
  63. if ( FAILED(hr) )
  64. {
  65. DebugPrintEx(DEBUG_ERR,_T("Failed to display node name. (hRc: %08X)"), hr);
  66. NodeMsgBox(IDS_FAIL_TO_ADD_NODE);
  67. delete pI;
  68. goto Cleanup;
  69. }
  70. hr = AddChild(pI, &pI->m_scopeDataItem);
  71. if ( FAILED(hr) )
  72. {
  73. DebugPrintEx(DEBUG_ERR,_T("Failed to AddChild. (hRc: %08X)"), hr);
  74. NodeMsgBox(IDS_FAIL_TO_ADD_NODE);
  75. delete pI;
  76. goto Cleanup;
  77. }
  78. Cleanup:
  79. return hr;
  80. }
  81. /*
  82. - CSnapinRoot::SetServerName
  83. -
  84. * Purpose:
  85. * Set the Server machine name
  86. *
  87. * Arguments:
  88. *
  89. * Return:
  90. * OLE error code
  91. */
  92. HRESULT CSnapinRoot::SetServerName(BSTR bstrServerName)
  93. {
  94. DEBUG_FUNCTION_NAME( _T("CSnapinRoot::SetServerName"));
  95. HRESULT hRc = S_OK;
  96. m_bstrServerName = bstrServerName;
  97. if (!m_bstrServerName)
  98. {
  99. hRc = E_OUTOFMEMORY;
  100. DebugPrintEx(
  101. DEBUG_ERR,
  102. _T("Failed to allocate string - out of memory"));
  103. NodeMsgBox(IDS_MEMORY);
  104. m_bstrServerName = L"";
  105. }
  106. return hRc;
  107. }