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.

214 lines
3.6 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997
  5. //
  6. // File: core.cxx
  7. //
  8. // Contents:
  9. //
  10. // History: 11-1-95 krishnag Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "iis.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(hr);
  93. }
  94. RRETURN(ADsAllocString(_Name, retval));
  95. }
  96. HRESULT
  97. CCoreADsObject::get_CoreADsPath(BSTR * retval)
  98. {
  99. HRESULT hr;
  100. if (FAILED(hr = ValidateOutParameter(retval))){
  101. RRETURN(hr);
  102. }
  103. RRETURN(ADsAllocString(_ADsPath, retval));
  104. }
  105. HRESULT
  106. CCoreADsObject::get_CoreADsClass(BSTR * retval)
  107. {
  108. HRESULT hr;
  109. if (FAILED(hr = ValidateOutParameter(retval))){
  110. RRETURN(hr);
  111. }
  112. RRETURN(ADsAllocString(_ADsClass, retval));
  113. }
  114. HRESULT
  115. CCoreADsObject::get_CoreParent(BSTR * retval)
  116. {
  117. HRESULT hr;
  118. if (FAILED(hr = ValidateOutParameter(retval))){
  119. RRETURN(hr);
  120. }
  121. RRETURN(ADsAllocString(_Parent, retval));
  122. }
  123. HRESULT
  124. CCoreADsObject::get_CoreSchema(BSTR * retval)
  125. {
  126. HRESULT hr;
  127. if (FAILED(hr = ValidateOutParameter(retval))){
  128. RRETURN(hr);
  129. }
  130. if ( _Schema == NULL || *_Schema == 0 )
  131. RRETURN(E_ADS_PROPERTY_NOT_SUPPORTED);
  132. RRETURN(ADsAllocString(_Schema, retval));
  133. }
  134. HRESULT
  135. CCoreADsObject::get_CoreGUID(BSTR * retval)
  136. {
  137. HRESULT hr;
  138. if (FAILED(hr = ValidateOutParameter(retval))){
  139. RRETURN(hr);
  140. }
  141. RRETURN(ADsAllocString(_ADsGuid, retval));
  142. }
  143. STDMETHODIMP
  144. CCoreADsObject::GetInfo(
  145. BOOL fExplicit
  146. )
  147. {
  148. RRETURN(E_NOTIMPL);
  149. }