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.

261 lines
9.9 KiB

  1. #ifndef __WBEM_POLICY_SOM__H_
  2. #define __WBEM_POLICY_SOM__H_
  3. class CPolicySOM : public CUnk
  4. {
  5. public:
  6. enum
  7. {
  8. AD_LOCAL_CONTEXT = 0,
  9. AD_GLOBAL_CONTEXT,
  10. AD_MAX_CONTEXT
  11. };
  12. CPolicySOM(CLifeControl* pControl = NULL, IUnknown* pOuter = NULL)
  13. : CUnk(pControl, pOuter), m_XProvider(this), m_XInit(this),
  14. m_pWMIMgmt(NULL)
  15. {}
  16. ~CPolicySOM();
  17. void* GetInterface(REFIID riid);
  18. IWbemServices* GetWMIServices();
  19. IADsContainer* GetADServices(CComBSTR &, HRESULT &hres);
  20. bool SetWMIServices(IWbemServices* pServices);
  21. bool SetADServices(IADsContainer* ,unsigned);
  22. protected:
  23. class XProvider : public CImpl<IWbemServices, CPolicySOM>
  24. {
  25. public:
  26. /* construction & de- */
  27. XProvider(CPolicySOM* pObj)
  28. : CImpl<IWbemServices, CPolicySOM>(pObj)
  29. { /* this page intentionally left blank */ }
  30. ~XProvider() {}
  31. /* Internals */
  32. protected:
  33. /* Method support */
  34. HRESULT Evaluate(IWbemClassObject* pObj, IWbemClassObject* pOutInstance);
  35. HRESULT BatchEvaluate(IWbemClassObject* pObj, IWbemClassObject* pOutClass, IWbemServices* pPolicyNamespace);
  36. HRESULT EvaluateRule(IWbemServices*& pNamespace, BSTR& namespaceName, IWbemClassObject* pRule, bool& bResult);
  37. /* class object management */
  38. IWbemClassObject* GetSomClass();
  39. IWbemClassObject* GetSomInstance();
  40. /* communication w/ winmgmt management */
  41. HRESULT GetLocator(IWbemLocator*& pLocator);
  42. HRESULT GetNewNamespace(BSTR namespaceName, IWbemServices*& pNamespace);
  43. HRESULT ValidateRules(IWbemClassObject* pInst, IWbemClassObject*& pErrorObject);
  44. private:
  45. // templates for each type of object we support
  46. // NULL until we need it
  47. CComQIPtr<IWbemClassObject> m_pSOMClassObject;
  48. // NULL until we need it -
  49. // access through GetLocator;
  50. CComQIPtr<IWbemLocator> m_pLocator;
  51. /* IWbemServices */
  52. public:
  53. HRESULT STDMETHODCALLTYPE OpenNamespace(
  54. /* [in] */ const BSTR Namespace,
  55. /* [in] */ long lFlags,
  56. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  57. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  58. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
  59. {return WBEM_E_NOT_SUPPORTED;};
  60. HRESULT STDMETHODCALLTYPE CancelAsyncCall(
  61. /* [in] */ IWbemObjectSink __RPC_FAR *pSink)
  62. {return WBEM_E_NOT_SUPPORTED;};
  63. HRESULT STDMETHODCALLTYPE QueryObjectSink(
  64. /* [in] */ long lFlags,
  65. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
  66. {return WBEM_E_NOT_SUPPORTED;};
  67. HRESULT STDMETHODCALLTYPE GetObject(
  68. /* [in] */ const BSTR ObjectPath,
  69. /* [in] */ long lFlags,
  70. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  71. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  72. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  73. {return WBEM_E_NOT_SUPPORTED;};
  74. HRESULT STDMETHODCALLTYPE GetObjectAsync(
  75. /* [in] */ const BSTR ObjectPath,
  76. /* [in] */ long lFlags,
  77. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  78. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  79. HRESULT STDMETHODCALLTYPE PutClass(
  80. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  81. /* [in] */ long lFlags,
  82. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  83. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  84. {return WBEM_E_NOT_SUPPORTED;};
  85. HRESULT STDMETHODCALLTYPE PutClassAsync(
  86. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  87. /* [in] */ long lFlags,
  88. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  89. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  90. {return WBEM_E_NOT_SUPPORTED;};
  91. HRESULT STDMETHODCALLTYPE DeleteClass(
  92. /* [in] */ const BSTR Class,
  93. /* [in] */ long lFlags,
  94. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  95. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  96. {return WBEM_E_NOT_SUPPORTED;};
  97. HRESULT STDMETHODCALLTYPE DeleteClassAsync(
  98. /* [in] */ const BSTR Class,
  99. /* [in] */ long lFlags,
  100. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  101. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  102. {return WBEM_E_NOT_SUPPORTED;};
  103. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  104. /* [in] */ const BSTR Superclass,
  105. /* [in] */ long lFlags,
  106. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  107. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  108. {return WBEM_E_NOT_SUPPORTED;};
  109. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  110. /* [in] */ const BSTR Superclass,
  111. /* [in] */ long lFlags,
  112. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  113. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  114. {return WBEM_E_NOT_SUPPORTED;};
  115. HRESULT STDMETHODCALLTYPE PutInstance(
  116. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  117. /* [in] */ long lFlags,
  118. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  119. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  120. {return WBEM_E_NOT_SUPPORTED;};
  121. HRESULT STDMETHODCALLTYPE PutInstanceAsync(
  122. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  123. /* [in] */ long lFlags,
  124. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  125. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  126. HRESULT STDMETHODCALLTYPE DeleteInstance(
  127. /* [in] */ const BSTR ObjectPath,
  128. /* [in] */ long lFlags,
  129. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  130. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  131. {return WBEM_E_NOT_SUPPORTED;};
  132. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
  133. /* [in] */ const BSTR ObjectPath,
  134. /* [in] */ long lFlags,
  135. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  136. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  137. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  138. /* [in] */ const BSTR Class,
  139. /* [in] */ long lFlags,
  140. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  141. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  142. {return WBEM_E_NOT_SUPPORTED;};
  143. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
  144. /* [in] */ const BSTR Class,
  145. /* [in] */ long lFlags,
  146. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  147. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  148. HRESULT STDMETHODCALLTYPE ExecQuery(
  149. /* [in] */ const BSTR QueryLanguage,
  150. /* [in] */ const BSTR Query,
  151. /* [in] */ long lFlags,
  152. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  153. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  154. {return WBEM_E_NOT_SUPPORTED;};
  155. HRESULT STDMETHODCALLTYPE ExecQueryAsync(
  156. /* [in] */ const BSTR QueryLanguage,
  157. /* [in] */ const BSTR Query,
  158. /* [in] */ long lFlags,
  159. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  160. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  161. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  162. /* [in] */ const BSTR QueryLanguage,
  163. /* [in] */ const BSTR Query,
  164. /* [in] */ long lFlags,
  165. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  166. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  167. {return WBEM_E_NOT_SUPPORTED;};
  168. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
  169. /* [in] */ const BSTR QueryLanguage,
  170. /* [in] */ const BSTR Query,
  171. /* [in] */ long lFlags,
  172. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  173. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  174. {return WBEM_E_NOT_SUPPORTED;};
  175. HRESULT STDMETHODCALLTYPE ExecMethod( const BSTR, const BSTR, long, IWbemContext*,
  176. IWbemClassObject*, IWbemClassObject**, IWbemCallResult**)
  177. {return WBEM_E_NOT_SUPPORTED;}
  178. HRESULT STDMETHODCALLTYPE ExecMethodAsync(
  179. /* [in] */ const BSTR strObjectPath,
  180. /* [in] */ const BSTR strMethodName,
  181. /* [in] */ long lFlags,
  182. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  183. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  184. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  185. } m_XProvider;
  186. friend XProvider;
  187. class XInit : public CImpl<IWbemProviderInit, CPolicySOM>
  188. {
  189. public:
  190. XInit(CPolicySOM* pObj)
  191. : CImpl<IWbemProviderInit, CPolicySOM>(pObj){}
  192. HRESULT STDMETHODCALLTYPE Initialize(
  193. LPWSTR, LONG, LPWSTR, LPWSTR, IWbemServices*, IWbemContext*,
  194. IWbemProviderInitSink*);
  195. } m_XInit;
  196. friend XInit;
  197. private:
  198. CComPtr<IADsPathname> m_pADPathObj;
  199. // pointer back to win management
  200. CComPtr<IWbemServices> m_pWMIMgmt;
  201. // pointer to AD policy template table
  202. CComPtr<IADsContainer> m_pADMgmt[AD_MAX_CONTEXT];
  203. CComVariant
  204. m_vDsConfigContext,
  205. m_vDsLocalContext;
  206. // a little something to keep our threads from getting tangled
  207. // will use a single critical section to protect all instance variables
  208. CCritSec m_CS;
  209. };
  210. #endif // __WBEM_POLICY_SOM__H_