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.

150 lines
3.2 KiB

  1. /////////////////////////////////////////////////////////////////////
  2. //
  3. // CopyRight ( c ) 1999 Microsoft Corporation
  4. //
  5. // Module Name: dnsbase.cpp
  6. //
  7. // Description:
  8. // Implementation of CDnsbase class
  9. //
  10. // Author:
  11. // Henry Wang ( henrywa ) March 8, 2000
  12. //
  13. //
  14. //////////////////////////////////////////////////////////////////////
  15. #include "DnsWmi.h"
  16. //////////////////////////////////////////////////////////////////////
  17. // Construction/Destruction
  18. //////////////////////////////////////////////////////////////////////
  19. CDnsBase::CDnsBase()
  20. {
  21. }
  22. /////////////////////////////////////////////////////////////////////////////
  23. //++
  24. //
  25. // CProvBase::CProvBase
  26. //
  27. // Description:
  28. // constructor
  29. //
  30. // Arguments:
  31. // wzName [IN] class name
  32. // pNamespace [IN] WMI namespace
  33. //
  34. // Return Value:
  35. // none
  36. //
  37. //--
  38. /////////////////////////////////////////////////////////////////////////////
  39. CDnsBase::CDnsBase(
  40. const WCHAR * wzName,
  41. CWbemServices * pNamespace)
  42. :m_pNamespace(NULL),
  43. m_pClass(NULL)
  44. {
  45. m_pNamespace = pNamespace;
  46. BSTR bstrClass = SysAllocString(wzName);
  47. SCODE sc;
  48. if(bstrClass == NULL)
  49. {
  50. sc = WBEM_E_OUT_OF_MEMORY;
  51. }
  52. else
  53. {
  54. sc = m_pNamespace->GetObject(
  55. bstrClass,
  56. 0,
  57. 0,
  58. &m_pClass,
  59. NULL);
  60. SysFreeString(bstrClass);
  61. }
  62. // failed to construct object,
  63. if( FAILED ( sc ) )
  64. {
  65. throw sc;
  66. }
  67. }
  68. CDnsBase::~CDnsBase()
  69. {
  70. if(m_pClass)
  71. m_pClass->Release();
  72. }
  73. /////////////////////////////////////////////////////////////////////////////
  74. //++
  75. //
  76. // CDnsBase::PutInstance
  77. //
  78. // Description:
  79. // default implementation of PutInstance
  80. //
  81. // Arguments:
  82. // pInst [IN] WMI object to be saved
  83. // lFlags [IN] WMI flag
  84. // pCtx* [IN] WMI context
  85. // pHandler* [IN] WMI sink pointer
  86. //
  87. // Return Value:
  88. // WBEM_E_NOT_SUPPORTED
  89. //
  90. //--
  91. /////////////////////////////////////////////////////////////////////////////
  92. SCODE CDnsBase::PutInstance(
  93. IWbemClassObject * pInst ,
  94. long lFlags,
  95. IWbemContext* pCtx ,
  96. IWbemObjectSink * pHandler)
  97. {
  98. return WBEM_E_NOT_SUPPORTED;
  99. };
  100. /////////////////////////////////////////////////////////////////////////////
  101. //++
  102. //
  103. // CProvBase::DeleteInstance
  104. //
  105. // Description:
  106. // delete the instance pointed by ObjectPath
  107. //
  108. // Arguments:
  109. // ObjectPath [IN] ObjPath for the instance to be deleted
  110. // lFlags [IN] WMI flag
  111. // pCtx* [IN] WMI context
  112. // pHandler* [IN] WMI sink pointer
  113. //
  114. // Return Value:
  115. // WBEM_E_NOT_SUPPORTED
  116. //
  117. //--
  118. /////////////////////////////////////////////////////////////////////////////
  119. SCODE CDnsBase::DeleteInstance(
  120. CObjPath& ObjectPath,
  121. long lFlags,
  122. IWbemContext * pCtx,
  123. IWbemObjectSink * pHandler)
  124. {
  125. return WBEM_E_NOT_SUPPORTED;
  126. }
  127. SCODE CDnsBase::ExecQuery(
  128. CSqlEval* pSqlEval,
  129. long lFlags,
  130. IWbemContext * pCtx,
  131. IWbemObjectSink * pHandler)
  132. {
  133. return EnumInstance(
  134. lFlags,
  135. pCtx,
  136. pHandler);
  137. }