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.

190 lines
3.0 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 "oleds.hxx"
  14. #pragma hdrstop
  15. HRESULT
  16. CCoreADsObject::InitializeCoreObject(
  17. BSTR Parent,
  18. BSTR Name,
  19. BSTR ClassName,
  20. REFCLSID rclsid,
  21. DWORD dwObjectState
  22. )
  23. {
  24. HRESULT hr = S_OK;
  25. ADsAssert(Parent);
  26. ADsAssert(Name);
  27. ADsAssert(ClassName);
  28. hr = BuildADsPath(
  29. Parent,
  30. Name,
  31. &_ADsPath
  32. );
  33. BAIL_ON_FAILURE(hr);
  34. hr = BuildADsGuid(
  35. rclsid,
  36. &_ADsGuid
  37. );
  38. BAIL_ON_FAILURE(hr);
  39. hr = ADsAllocString(Parent, &_Parent);
  40. BAIL_ON_FAILURE(hr);
  41. hr = ADsAllocString(Name, &_Name);
  42. BAIL_ON_FAILURE(hr);
  43. hr = ADsAllocString(ClassName, &_ADsClass);
  44. BAIL_ON_FAILURE(hr);
  45. _dwObjectState = dwObjectState;
  46. error:
  47. RRETURN(hr);
  48. }
  49. CCoreADsObject::CCoreADsObject():
  50. _Name(NULL),
  51. _ADsPath(NULL),
  52. _Parent(NULL),
  53. _ADsClass(NULL),
  54. _ADsGuid(NULL),
  55. _dwObjectState(0)
  56. {
  57. }
  58. CCoreADsObject::~CCoreADsObject()
  59. {
  60. if (_Name) {
  61. ADsFreeString(_Name);
  62. }
  63. if (_ADsPath) {
  64. ADsFreeString(_ADsPath);
  65. }
  66. if (_Parent) {
  67. ADsFreeString(_Parent);
  68. }
  69. if (_ADsClass) {
  70. ADsFreeString(_ADsClass);
  71. }
  72. if (_ADsGuid) {
  73. ADsFreeString(_ADsGuid);
  74. }
  75. }
  76. HRESULT
  77. CCoreADsObject::get_CoreName(BSTR * retval)
  78. {
  79. HRESULT hr;
  80. if (FAILED(hr = ValidateOutParameter(retval))){
  81. RRETURN(hr);
  82. }
  83. RRETURN(ADsAllocString(_Name, retval));
  84. }
  85. HRESULT
  86. CCoreADsObject::get_CoreADsPath(BSTR * retval)
  87. {
  88. HRESULT hr;
  89. if (FAILED(hr = ValidateOutParameter(retval))){
  90. RRETURN(hr);
  91. }
  92. RRETURN(ADsAllocString(_ADsPath, retval));
  93. }
  94. HRESULT
  95. CCoreADsObject::get_CoreADsClass(BSTR * retval)
  96. {
  97. HRESULT hr;
  98. if (FAILED(hr = ValidateOutParameter(retval))){
  99. RRETURN(hr);
  100. }
  101. RRETURN(ADsAllocString(_ADsClass, retval));
  102. }
  103. HRESULT
  104. CCoreADsObject::get_CoreParent(BSTR * retval)
  105. {
  106. HRESULT hr;
  107. if (FAILED(hr = ValidateOutParameter(retval))){
  108. RRETURN(hr);
  109. }
  110. RRETURN(ADsAllocString(_Parent, retval));
  111. }
  112. HRESULT
  113. CCoreADsObject::get_CoreGUID(BSTR * retval)
  114. {
  115. HRESULT hr;
  116. if (FAILED(hr = ValidateOutParameter(retval))){
  117. RRETURN(hr);
  118. }
  119. RRETURN(ADsAllocString(_ADsGuid, retval));
  120. }
  121. STDMETHODIMP
  122. CCoreADsObject::GetInfo(THIS_ DWORD dwApiLevel, BOOL fExplicit)
  123. {
  124. RRETURN(E_NOTIMPL);
  125. }