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.

292 lines
7.5 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: crascom.h
  4. //
  5. // Synopsis: This file holds the declarations of the
  6. // CRasCom class
  7. //
  8. //
  9. // History: 2/10/97 MKarki Created
  10. //
  11. // Copyright (C) 1997-98 Microsoft Corporation
  12. // All rights reserved.
  13. //
  14. //#--------------------------------------------------------------
  15. #ifndef _CRASCOM_H_
  16. #define _CRASCOM_H_
  17. #include "resource.h"
  18. #include "vsafilter.h"
  19. class CRasCom:
  20. public IDispatchImpl<IIasComponent,
  21. &__uuidof (IIasComponent),
  22. &__uuidof (IasHelperLib)
  23. >,
  24. public IRecvRequest,
  25. public CComObjectRoot,
  26. public CComCoClass<IasHelper,&__uuidof (IasHelper)>
  27. {
  28. public:
  29. //
  30. // registry declaration for the IasHelper
  31. //
  32. IAS_DECLARE_REGISTRY (IasHelper, 1, 0, IasHelperLib)
  33. //
  34. // this COM Component is not aggregatable
  35. //
  36. DECLARE_NOT_AGGREGATABLE(CRasCom)
  37. //
  38. // this COM component is a Singleton
  39. //
  40. DECLARE_CLASSFACTORY_SINGLETON (CRasCom)
  41. //
  42. // MACROS for ATL required methods
  43. //
  44. BEGIN_COM_MAP(CRasCom)
  45. COM_INTERFACE_ENTRY2(IDispatch, IIasComponent)
  46. COM_INTERFACE_ENTRY(IIasComponent)
  47. COM_INTERFACE_ENTRY(IRecvRequest)
  48. COM_INTERFACE_ENTRY_FUNC(__uuidof (IRequestSource), (ULONG_PTR)0, &CRasCom::QueryInterfaceReqSrc)
  49. END_COM_MAP()
  50. //
  51. // MACRO to declare Controlling IUnknown method
  52. //
  53. DECLARE_GET_CONTROLLING_UNKNOWN()
  54. CRasCom (VOID);
  55. ~CRasCom (VOID);
  56. public:
  57. //
  58. // method of the IRecvRequest interface
  59. //
  60. STDMETHOD (Process) (
  61. /*[in]*/ DWORD dwAttributeCount,
  62. /*[in]*/ PIASATTRIBUTE *ppInIasAttribute,
  63. /*[out]*/ PDWORD pdwOutAttributeCount,
  64. /*[out]*/ PIASATTRIBUTE **pppOutIasAttribute,
  65. /*[in]*/ LONG IasRequest,
  66. /*[out]*/ LONG *pIasResponse,
  67. /*[in]*/ IASPROTOCOL IasProtocol,
  68. /*[out]*/ PLONG plReason,
  69. /*[in]*/ BOOL bProcessVSA
  70. );
  71. //
  72. // methods of IIasComponent interface
  73. //
  74. STDMETHOD(Initialize)();
  75. STDMETHOD(Shutdown)();
  76. STDMETHOD(GetProperty)(
  77. /*[in]*/ LONG id,
  78. /*[out]*/ VARIANT *pValue
  79. );
  80. STDMETHOD(PutProperty)(
  81. /*[in]*/ LONG id,
  82. /*[in]*/ VARIANT *pValue
  83. );
  84. STDMETHOD(InitNew)();
  85. STDMETHOD(Suspend)();
  86. STDMETHOD(Resume)();
  87. private:
  88. //
  89. // here is the class factory for the Request object
  90. //
  91. IClassFactory *m_pIClassFactory;
  92. //
  93. // here is the handle to the Request Handler
  94. //
  95. IRequestHandler *m_pIRequestHandler;
  96. //
  97. // here is the definition of the CRequestSource
  98. // which implements the method of the IRequestSource
  99. // interface
  100. //
  101. class CRequestSource : public IRequestSource
  102. {
  103. public:
  104. CRequestSource (CRasCom *pCRasCom);
  105. ~CRequestSource ();
  106. //
  107. // IUnknown methods - delegate to outer IUnknown
  108. //
  109. STDMETHOD(QueryInterface)(
  110. /*[in]*/ REFIID riid,
  111. /*[out]*/ void **ppv
  112. )
  113. {
  114. IUnknown *pUnknown = m_pCRasCom->GetControllingUnknown();
  115. return (pUnknown->QueryInterface(riid,ppv));
  116. }
  117. STDMETHOD_(ULONG,AddRef)(void)
  118. {
  119. IUnknown *pUnknown = m_pCRasCom->GetControllingUnknown();
  120. return (pUnknown->AddRef());
  121. }
  122. STDMETHOD_(ULONG,Release)(void)
  123. {
  124. IUnknown *pUnknown = m_pCRasCom->GetControllingUnknown();
  125. return (pUnknown->Release());
  126. }
  127. //
  128. // IDispatch methods - delegate to outer class object
  129. //
  130. STDMETHOD(GetTypeInfoCount)(
  131. /*[out]*/ UINT *pctinfo
  132. )
  133. {
  134. return (m_pCRasCom->GetTypeInfoCount (pctinfo));
  135. }
  136. STDMETHOD(GetTypeInfo)(
  137. /*[in]*/ UINT iTInfo,
  138. /*[in]*/ LCID lcid,
  139. /*[out]*/ ITypeInfo **ppTInfo
  140. )
  141. {
  142. return (m_pCRasCom->GetTypeInfo (iTInfo, lcid, ppTInfo));
  143. }
  144. STDMETHOD(GetIDsOfNames)(
  145. /*[in]*/ const IID& riid,
  146. /*[in]*/ LPOLESTR *rgszNames,
  147. /*[in]*/ UINT cNames,
  148. /*[in]*/ LCID lcid,
  149. /*[out]*/ DISPID *rgDispId)
  150. {
  151. return (m_pCRasCom->GetIDsOfNames (
  152. riid, rgszNames, cNames, lcid, rgDispId
  153. )
  154. );
  155. }
  156. STDMETHOD(Invoke)(
  157. /*[in]*/ DISPID dispIdMember,
  158. /*[in]*/ const IID& riid,
  159. /*[in]*/ LCID lcid,
  160. /*[in]*/ WORD wFlags,
  161. /*[in/out]*/DISPPARAMS *pDispParams,
  162. /*[out]*/ VARIANT *pVarResult,
  163. /*[out]*/ EXCEPINFO *pExcepInfo,
  164. /*[out]*/ UINT *puArgErr
  165. )
  166. {
  167. return (m_pCRasCom->Invoke (
  168. dispIdMember,
  169. riid,
  170. lcid,
  171. wFlags,
  172. pDispParams,
  173. pVarResult,
  174. pExcepInfo,
  175. puArgErr
  176. )
  177. );
  178. }
  179. //
  180. // IRequestSource Interface method
  181. //
  182. STDMETHOD(OnRequestComplete)(
  183. /*[in]*/ IRequest *pIRequest,
  184. /*[in]*/ IASREQUESTSTATUS eStatus
  185. );
  186. private:
  187. CRasCom* m_pCRasCom;
  188. }; // end of nested class CRequestSource
  189. //
  190. // private method used to remove attributes from the request
  191. //
  192. STDMETHOD (RemoveAttributesFromRequest) (
  193. /*[in]*/ LONG lResponse,
  194. /*[in]*/ IAttributesRaw *pIasAttributesRaw,
  195. /*[out]*/ PDWORD pdwOutAttributeCount,
  196. /*[out]*/ PIASATTRIBUTE **pppOutIasOutAttribute
  197. );
  198. //
  199. // this method is called when somone whants the
  200. // IRequestHandlercallback interface
  201. //
  202. static HRESULT WINAPI QueryInterfaceReqSrc (
  203. VOID *pThis,
  204. REFIID riid,
  205. LPVOID *ppv,
  206. DWORD_PTR dwValue
  207. );
  208. //
  209. // instantiate this nested class
  210. //
  211. CRequestSource m_objCRequestSource;
  212. //
  213. // now we can call into private methods of CRasCom
  214. //
  215. friend class CRequestSource;
  216. //
  217. // instantiate the VSAFilter class
  218. //
  219. VSAFilter m_objVSAFilter;
  220. //
  221. // flag to trac VSAFilter class object initialization
  222. //
  223. BOOL m_bVSAFilterInitialized;
  224. typedef enum _component_state_
  225. {
  226. COMP_SHUTDOWN,
  227. COMP_UNINITIALIZED,
  228. COMP_INITIALIZED,
  229. COMP_SUSPENDED
  230. } COMPONENTSTATE, *PCOMPONENTSTATE;
  231. COMPONENTSTATE m_eCompState;
  232. //
  233. // pending requeset count
  234. //
  235. LONG m_lRequestCount;
  236. };
  237. #endif // !define _CRASCOM_H_