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.

198 lines
3.7 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995
  5. //
  6. // File: core.cxx
  7. //
  8. // Contents:
  9. //
  10. // History: 11-1-95 krishnag Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "nds.hxx"
  14. #pragma hdrstop
  15. HRESULT
  16. CCoreADsObject::InitializeCoreObject(
  17. BSTR Parent,
  18. BSTR Name,
  19. BSTR ClassName,
  20. BSTR Schema,
  21. REFCLSID rclsid,
  22. DWORD dwObjectState
  23. )
  24. {
  25. HRESULT hr = S_OK;
  26. ADsAssert(Parent);
  27. ADsAssert(Name);
  28. ADsAssert(ClassName);
  29. hr = BuildADsPath(
  30. Parent,
  31. Name,
  32. &_ADsPath
  33. );
  34. BAIL_ON_FAILURE(hr);
  35. hr = BuildADsGuid(
  36. rclsid,
  37. &_ADsGuid
  38. );
  39. BAIL_ON_FAILURE(hr);
  40. hr = ADsAllocString( Parent, &_Parent);
  41. BAIL_ON_FAILURE(hr);
  42. hr = ADsAllocString( Name, &_Name);
  43. BAIL_ON_FAILURE(hr);
  44. hr = ADsAllocString( ClassName, &_ADsClass);
  45. BAIL_ON_FAILURE(hr);
  46. hr = BuildSchemaPath(
  47. _ADsPath,
  48. ClassName,
  49. &_Schema
  50. );
  51. BAIL_ON_FAILURE(hr);
  52. _dwObjectState = dwObjectState;
  53. error:
  54. RRETURN(hr);
  55. }
  56. CCoreADsObject::CCoreADsObject():
  57. _Name(NULL),
  58. _ADsPath(NULL),
  59. _Parent(NULL),
  60. _ADsClass(NULL),
  61. _Schema(NULL),
  62. _ADsGuid(NULL),
  63. _dwObjectState(0)
  64. {
  65. }
  66. CCoreADsObject::~CCoreADsObject()
  67. {
  68. if (_Name) {
  69. ADsFreeString(_Name);
  70. }
  71. if (_ADsPath) {
  72. ADsFreeString(_ADsPath);
  73. }
  74. if (_Parent) {
  75. ADsFreeString(_Parent);
  76. }
  77. if (_ADsClass) {
  78. ADsFreeString(_ADsClass);
  79. }
  80. if (_Schema) {
  81. ADsFreeString(_Schema);
  82. }
  83. if (_ADsGuid) {
  84. ADsFreeString(_ADsGuid);
  85. }
  86. }
  87. HRESULT
  88. CCoreADsObject::get_CoreName(BSTR * retval)
  89. {
  90. HRESULT hr;
  91. if (FAILED(hr = ValidateOutParameter(retval))){
  92. RRETURN_EXP_IF_ERR(hr);
  93. }
  94. hr = ADsAllocString(_Name, retval);
  95. RRETURN_EXP_IF_ERR(hr);
  96. }
  97. HRESULT
  98. CCoreADsObject::get_CoreADsPath(BSTR * retval)
  99. {
  100. HRESULT hr;
  101. if (FAILED(hr = ValidateOutParameter(retval))){
  102. RRETURN_EXP_IF_ERR(hr);
  103. }
  104. hr = ADsAllocString(_ADsPath, retval);
  105. RRETURN_EXP_IF_ERR(hr);
  106. }
  107. HRESULT
  108. CCoreADsObject::get_CoreADsClass(BSTR * retval)
  109. {
  110. HRESULT hr;
  111. if (FAILED(hr = ValidateOutParameter(retval))){
  112. RRETURN_EXP_IF_ERR(hr);
  113. }
  114. hr = ADsAllocString(_ADsClass, retval);
  115. RRETURN_EXP_IF_ERR(hr);
  116. }
  117. HRESULT
  118. CCoreADsObject::get_CoreParent(BSTR * retval)
  119. {
  120. HRESULT hr;
  121. if (FAILED(hr = ValidateOutParameter(retval))){
  122. RRETURN_EXP_IF_ERR(hr);
  123. }
  124. hr = ADsAllocString(_Parent, retval);
  125. RRETURN_EXP_IF_ERR(hr);
  126. }
  127. HRESULT
  128. CCoreADsObject::get_CoreSchema(BSTR * retval)
  129. {
  130. HRESULT hr;
  131. if (FAILED(hr = ValidateOutParameter(retval))){
  132. RRETURN_EXP_IF_ERR(hr);
  133. }
  134. if ( _Schema == NULL || *_Schema == 0 )
  135. RRETURN(E_ADS_PROPERTY_NOT_SUPPORTED);
  136. hr = ADsAllocString(_Schema, retval);
  137. RRETURN_EXP_IF_ERR(hr);
  138. }
  139. HRESULT
  140. CCoreADsObject::get_CoreGUID(BSTR * retval)
  141. {
  142. HRESULT hr;
  143. if (FAILED(hr = ValidateOutParameter(retval))){
  144. RRETURN_EXP_IF_ERR(hr);
  145. }
  146. hr = ADsAllocString(_ADsGuid, retval);
  147. RRETURN_EXP_IF_ERR(hr);
  148. }
  149. STDMETHODIMP
  150. CCoreADsObject::GetInfo(
  151. BOOL fExplicit
  152. )
  153. {
  154. RRETURN_EXP_IF_ERR(E_NOTIMPL);
  155. }