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.

161 lines
3.6 KiB

  1. /////////////////////////////////////////////////////////////////////
  2. //
  3. // CopyRight ( c ) 1999 Microsoft Corporation
  4. //
  5. // Module Name: DnsServerDomainContainment.cpp
  6. //
  7. // Description:
  8. // Implementation of CDnsServerDomainContainment class
  9. //
  10. // Author:
  11. // Henry Wang ( henrywa ) March 8, 2000
  12. //
  13. //
  14. //////////////////////////////////////////////////////////////////////
  15. #include "DnsWmi.h"
  16. /////////////////////////////////////////////////////////////////////////////
  17. //++
  18. //
  19. // Description:
  20. // create an instance of CDnsServerDomainContainment
  21. //
  22. // Arguments:
  23. // wszName [IN] class name
  24. // pNamespace [IN] wmi namespace
  25. // szType [IN] child class name of resource record class
  26. //
  27. // Return Value:
  28. // WBEM_S_NO_ERROR
  29. //
  30. //--
  31. /////////////////////////////////////////////////////////////////////////////
  32. CDnsBase*
  33. CDnsServerDomainContainment::CreateThis(
  34. const WCHAR * wszName,
  35. CWbemServices * pNamespace,
  36. const char * szType
  37. )
  38. {
  39. return new CDnsServerDomainContainment(wszName, pNamespace);
  40. }
  41. CDnsServerDomainContainment::CDnsServerDomainContainment()
  42. {
  43. }
  44. CDnsServerDomainContainment::CDnsServerDomainContainment(
  45. const WCHAR* wszName,
  46. CWbemServices *pNamespace)
  47. :CDnsBase(wszName, pNamespace)
  48. {
  49. }
  50. CDnsServerDomainContainment::~CDnsServerDomainContainment()
  51. {
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. //++
  55. //
  56. // Description:
  57. // enum instances of dns server and domain association
  58. //
  59. // Arguments:
  60. // lFlags [IN] WMI flag
  61. // pCtx [IN] WMI context
  62. // pHandler [IN] WMI sink pointer
  63. //
  64. // Return Value:
  65. // WBEM_S_NO_ERROR
  66. //
  67. //--
  68. /////////////////////////////////////////////////////////////////////////////
  69. SCODE
  70. CDnsServerDomainContainment::EnumInstance(
  71. long lFlags,
  72. IWbemContext * pCtx,
  73. IWbemObjectSink * pHandler
  74. )
  75. {
  76. list<CObjPath> opList;
  77. list<CObjPath>::iterator i;
  78. SCODE sc;
  79. CDnsWrap& dns = CDnsWrap::DnsObject();
  80. sc = dns.dnsEnumDomainForServer(&opList);
  81. if (FAILED(sc))
  82. {
  83. return sc;
  84. }
  85. CObjPath opServer;
  86. opServer.SetClass(PVD_CLASS_SERVER);
  87. opServer.AddProperty(
  88. PVD_SRV_SERVER_NAME,
  89. dns.GetServerName().data());
  90. for(i=opList.begin(); i!=opList.end(); ++i)
  91. {
  92. CWbemClassObject Inst;
  93. m_pClass->SpawnInstance(0, &Inst);
  94. Inst.SetProperty(
  95. opServer.GetObjectPathString(),
  96. PVD_ASSOC_PARENT);
  97. Inst.SetProperty(
  98. (*i).GetObjectPathString(),
  99. PVD_ASSOC_CHILD);
  100. pHandler->Indicate(1, &Inst);
  101. }
  102. return WBEM_S_NO_ERROR;
  103. }
  104. /////////////////////////////////////////////////////////////////////////////
  105. //++
  106. //
  107. // Description:
  108. // retrieve server domain association object pointed by the
  109. // given object path
  110. //
  111. // Arguments:
  112. // ObjectPath [IN] object path to object
  113. // lFlags [IN] WMI flag
  114. // pCtx [IN] WMI context
  115. // pHandler [IN] WMI sink pointer
  116. //
  117. // Return Value:
  118. // WBEM_S_NO_ERROR
  119. //
  120. //--
  121. /////////////////////////////////////////////////////////////////////////////
  122. SCODE
  123. CDnsServerDomainContainment::GetObject(
  124. CObjPath & ObjectPath,
  125. long lFlags,
  126. IWbemContext * pCtx,
  127. IWbemObjectSink * pHandler
  128. )
  129. {
  130. return WBEM_E_NOT_SUPPORTED;
  131. }
  132. SCODE
  133. CDnsServerDomainContainment::ExecuteMethod(
  134. CObjPath&,
  135. WCHAR*,
  136. long,
  137. IWbemClassObject*,
  138. IWbemObjectSink*)
  139. {
  140. return WBEM_E_NOT_SUPPORTED;
  141. }