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.

269 lines
3.5 KiB

  1. // SsrCore.cpp : Implementation of CSsrCore
  2. #include "stdafx.h"
  3. #include "SSRTE.h"
  4. #include "ActionData.h"
  5. #include "SSRTEngine.h"
  6. #include "SsrCore.h"
  7. #include "SSRLog.h"
  8. #include "global.h"
  9. #include "util.h"
  10. //-------------------------------------------------------------------------------
  11. // ISsrCore implementation
  12. //-------------------------------------------------------------------------------
  13. /*
  14. Routine Description:
  15. Name:
  16. CSsrCore::CSsrCore
  17. Functionality:
  18. constructor
  19. Virtual:
  20. no.
  21. Arguments:
  22. none.
  23. Return Value:
  24. none.
  25. Notes:
  26. */
  27. CSsrCore::CSsrCore() : m_pEngine(NULL)
  28. {
  29. if (SUCCEEDED(CComObject<CSsrEngine>::CreateInstance(&m_pEngine)))
  30. {
  31. m_pEngine->AddRef();
  32. }
  33. }
  34. /*
  35. Routine Description:
  36. Name:
  37. CSsrCore::~CSsrCore
  38. Functionality:
  39. destructor
  40. Virtual:
  41. yes.
  42. Arguments:
  43. none.
  44. Return Value:
  45. none.
  46. Notes:
  47. */
  48. CSsrCore::~CSsrCore()
  49. {
  50. if (m_pEngine != NULL)
  51. {
  52. m_pEngine->Release();
  53. }
  54. }
  55. /*
  56. Routine Description:
  57. Name:
  58. CSsrCore::get_ActionData
  59. Functionality:
  60. It returns the engine's action data object (the property bag) which
  61. holds all runtime and static data needed to carry out the action.
  62. Virtual:
  63. Yes.
  64. Arguments:
  65. pVal - out parameter receives the ISsrActionData object of the engine.
  66. Return Value:
  67. Success:
  68. S_OK
  69. Failure:
  70. various error codes.
  71. Notes:
  72. */
  73. STDMETHODIMP
  74. CSsrCore::get_ActionData (
  75. OUT VARIANT * pVal // [out, retval]
  76. )
  77. {
  78. HRESULT hr = E_NOTIMPL;
  79. if (pVal == NULL)
  80. {
  81. hr = E_INVALIDARG;
  82. }
  83. ::VariantInit(pVal);
  84. if (m_pEngine != NULL)
  85. {
  86. pVal->vt = VT_DISPATCH;
  87. hr = m_pEngine->GetActionData((ISsrActionData **)&(pVal->pdispVal));
  88. if (hr != S_OK)
  89. {
  90. pVal->vt = VT_EMPTY;
  91. }
  92. }
  93. else
  94. {
  95. hr = E_SSR_ENGINE_NOT_AVAILABLE;
  96. }
  97. return hr;
  98. }
  99. /*
  100. Routine Description:
  101. Name:
  102. CSsrCore::get_Engine
  103. Functionality:
  104. It returns the engine itself.
  105. Virtual:
  106. Yes.
  107. Arguments:
  108. pVal - out parameter receives the ISsrEngine object.
  109. Return Value:
  110. Success:
  111. S_OK
  112. Failure:
  113. various error codes.
  114. Notes:
  115. */
  116. STDMETHODIMP
  117. CSsrCore::get_Engine (
  118. OUT VARIANT * pVal // [out, retval]
  119. )
  120. {
  121. HRESULT hr = S_OK;
  122. if (pVal == NULL)
  123. {
  124. hr = E_INVALIDARG;
  125. }
  126. ::VariantInit(pVal);
  127. if (m_pEngine != NULL)
  128. {
  129. pVal->vt = VT_DISPATCH;
  130. hr = m_pEngine->QueryInterface(IID_ISsrEngine, (LPVOID*)&(pVal->pdispVal));
  131. if (hr != S_OK)
  132. {
  133. pVal->vt = VT_EMPTY;
  134. hr = E_SSR_ENGINE_NOT_SUPPORT_INTERFACE;
  135. }
  136. }
  137. else
  138. {
  139. hr = E_SSR_ENGINE_NOT_AVAILABLE;
  140. }
  141. return hr;
  142. }
  143. /*
  144. Routine Description:
  145. Name:
  146. CSsrCore::get_SsrLog
  147. Functionality:
  148. It returns the engine's logging object.
  149. Virtual:
  150. Yes.
  151. Arguments:
  152. pVal - out parameter receives the ISsrPreProcessor object.
  153. Return Value:
  154. Success:
  155. S_OK
  156. Failure:
  157. various error codes.
  158. Notes:
  159. */
  160. STDMETHODIMP
  161. CSsrCore::get_SsrLog (
  162. OUT VARIANT * pVal // [out, retval]
  163. )
  164. {
  165. return g_fblog.GetLogObject(pVal);
  166. }