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.

270 lines
9.7 KiB

  1. //***************************************************************************
  2. //
  3. // podprov.h
  4. //
  5. // Module: Sample WMI provider (ESCAPE attachment)
  6. //
  7. // Purpose: Genral purpose include file.
  8. //
  9. // Copyright (c) 1997-1999 Microsoft Corporation
  10. //
  11. //***************************************************************************
  12. #ifndef _PodProv_H_
  13. #define _PodProv_H_
  14. #include <wbemidl.h>
  15. #include <wbemprov.h>
  16. #include <eh.h>
  17. typedef LPVOID * PPVOID;
  18. #define BUFF_SIZE 512
  19. #define QUERY_SIZE 128
  20. #define POD_KEY_LIST_SIZE 10
  21. #define POD_NULL_INTEGER 0x80000000L
  22. typedef enum tagACTIONTYPE
  23. {
  24. ACTIONTYPE_ENUM = 0,
  25. ACTIONTYPE_GET = 1,
  26. ACTIONTYPE_QUERY = 2,
  27. ACTIONTYPE_DELETE = 3
  28. } ACTIONTYPE;
  29. /**************************************************************
  30. *
  31. **************************************************************/
  32. class CHeap_Exception
  33. {
  34. public:
  35. enum HEAP_ERROR
  36. {
  37. E_ALLOCATION_ERROR = 0 ,
  38. E_FREE_ERROR
  39. };
  40. private:
  41. HEAP_ERROR m_Error;
  42. public:
  43. CHeap_Exception ( HEAP_ERROR e ) : m_Error ( e ) {}
  44. ~CHeap_Exception () {}
  45. HEAP_ERROR GetError() { return m_Error ; }
  46. } ;
  47. // Provider interfaces are provided by objects of this class
  48. class CPodTestProv : public IWbemServices, public IWbemProviderInit
  49. {
  50. protected:
  51. ULONG m_cRef; //Object reference count
  52. IWbemClassObject * m_pTemplateClass;
  53. IWbemClassObject * m_pPasswordClass;
  54. public:
  55. IWbemServices *m_pNamespace;
  56. CPodTestProv();
  57. ~CPodTestProv();
  58. //Non-delegating object IUnknown
  59. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  60. STDMETHODIMP_(ULONG) AddRef(void);
  61. STDMETHODIMP_(ULONG) Release(void);
  62. //IWbemProviderInit
  63. HRESULT STDMETHODCALLTYPE Initialize(
  64. /* [in] */ LPWSTR pszUser,
  65. /* [in] */ LONG lFlags,
  66. /* [in] */ LPWSTR pszNamespace,
  67. /* [in] */ LPWSTR pszLocale,
  68. /* [in] */ IWbemServices *pNamespace,
  69. /* [in] */ IWbemContext *pCtx,
  70. /* [in] */ IWbemProviderInitSink *pInitSink
  71. );
  72. //IWbemServices
  73. HRESULT STDMETHODCALLTYPE OpenNamespace(
  74. /* [in] */ const BSTR Namespace,
  75. /* [in] */ long lFlags,
  76. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  77. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  78. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult) {return WBEM_E_NOT_SUPPORTED;};
  79. HRESULT STDMETHODCALLTYPE CancelAsyncCall(
  80. /* [in] */ IWbemObjectSink __RPC_FAR *pSink) {return WBEM_E_NOT_SUPPORTED;};
  81. HRESULT STDMETHODCALLTYPE QueryObjectSink(
  82. /* [in] */ long lFlags,
  83. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler) {return WBEM_E_NOT_SUPPORTED;};
  84. HRESULT STDMETHODCALLTYPE GetObject(
  85. /* [in] */ const BSTR ObjectPath,
  86. /* [in] */ long lFlags,
  87. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  88. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  89. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) {return WBEM_E_NOT_SUPPORTED;};
  90. HRESULT STDMETHODCALLTYPE GetObjectAsync(
  91. /* [in] */ const BSTR ObjectPath,
  92. /* [in] */ long lFlags,
  93. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  94. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  95. HRESULT STDMETHODCALLTYPE PutClass(
  96. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  97. /* [in] */ long lFlags,
  98. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  99. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) {return WBEM_E_NOT_SUPPORTED;};
  100. HRESULT STDMETHODCALLTYPE PutClassAsync(
  101. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  102. /* [in] */ long lFlags,
  103. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  104. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) {return WBEM_E_NOT_SUPPORTED;};
  105. HRESULT STDMETHODCALLTYPE DeleteClass(
  106. /* [in] */ const BSTR Class,
  107. /* [in] */ long lFlags,
  108. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  109. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) {return WBEM_E_NOT_SUPPORTED;};
  110. HRESULT STDMETHODCALLTYPE DeleteClassAsync(
  111. /* [in] */ const BSTR Class,
  112. /* [in] */ long lFlags,
  113. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  114. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) {return WBEM_E_NOT_SUPPORTED;};
  115. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  116. /* [in] */ const BSTR Superclass,
  117. /* [in] */ long lFlags,
  118. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  119. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) {return WBEM_E_NOT_SUPPORTED;};
  120. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  121. /* [in] */ const BSTR Superclass,
  122. /* [in] */ long lFlags,
  123. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  124. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) {return WBEM_E_NOT_SUPPORTED;};
  125. HRESULT STDMETHODCALLTYPE PutInstance(
  126. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  127. /* [in] */ long lFlags,
  128. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  129. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) {return WBEM_E_NOT_SUPPORTED;};
  130. HRESULT STDMETHODCALLTYPE PutInstanceAsync(
  131. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  132. /* [in] */ long lFlags,
  133. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  134. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  135. HRESULT STDMETHODCALLTYPE DeleteInstance(
  136. /* [in] */ const BSTR ObjectPath,
  137. /* [in] */ long lFlags,
  138. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  139. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) {return WBEM_E_NOT_SUPPORTED;};
  140. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
  141. /* [in] */ const BSTR ObjectPath,
  142. /* [in] */ long lFlags,
  143. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  144. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  145. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  146. /* [in] */ const BSTR Class,
  147. /* [in] */ long lFlags,
  148. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  149. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) {return WBEM_E_NOT_SUPPORTED;};
  150. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
  151. /* [in] */ const BSTR Class,
  152. /* [in] */ long lFlags,
  153. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  154. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  155. HRESULT STDMETHODCALLTYPE ExecQuery(
  156. /* [in] */ const BSTR QueryLanguage,
  157. /* [in] */ const BSTR Query,
  158. /* [in] */ long lFlags,
  159. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  160. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) {return WBEM_E_NOT_SUPPORTED;};
  161. HRESULT STDMETHODCALLTYPE ExecQueryAsync(
  162. /* [in] */ const BSTR QueryLanguage,
  163. /* [in] */ const BSTR Query,
  164. /* [in] */ long lFlags,
  165. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  166. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  167. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  168. /* [in] */ const BSTR QueryLanguage,
  169. /* [in] */ const BSTR Query,
  170. /* [in] */ long lFlags,
  171. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  172. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) {return WBEM_E_NOT_SUPPORTED;};
  173. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
  174. /* [in] */ const BSTR QueryLanguage,
  175. /* [in] */ const BSTR Query,
  176. /* [in] */ long lFlags,
  177. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  178. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) {return WBEM_E_NOT_SUPPORTED;};
  179. HRESULT STDMETHODCALLTYPE ExecMethod( const BSTR, const BSTR, long, IWbemContext*,
  180. IWbemClassObject*, IWbemClassObject**, IWbemCallResult**) {return WBEM_E_NOT_SUPPORTED;}
  181. HRESULT STDMETHODCALLTYPE ExecMethodAsync( const BSTR, const BSTR, long,
  182. IWbemContext*, IWbemClassObject*, IWbemObjectSink*);
  183. private:
  184. static CHeap_Exception m_he;
  185. };
  186. typedef CPodTestProv *PCPodTestProv;
  187. // This class is the class factory for CServExtPro objects.
  188. class CProvFactory : public IClassFactory
  189. {
  190. protected:
  191. ULONG m_cRef;
  192. public:
  193. CProvFactory(void);
  194. ~CProvFactory(void);
  195. //IUnknown members
  196. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  197. STDMETHODIMP_(ULONG) AddRef(void);
  198. STDMETHODIMP_(ULONG) Release(void);
  199. //IClassFactory members
  200. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID
  201. , PPVOID);
  202. STDMETHODIMP LockServer(BOOL);
  203. };
  204. typedef CProvFactory *PCProvFactory;
  205. // These variables keep track of when the module can be unloaded
  206. extern long g_cObj;
  207. extern long g_cLock;
  208. HRESULT CheckAndExpandPath(BSTR bstrIn,BSTR *bstrOut );
  209. #endif