Source code of Windows XP (NT5)
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.

334 lines
13 KiB

  1. //***************************************************************************
  2. //
  3. // bootini.h
  4. //
  5. // Module: WMI Instance provider code for boot parameters
  6. //
  7. // Purpose: Genral purpose include file.
  8. //
  9. // Copyright (c) 1997-1999 Microsoft Corporation
  10. //
  11. //***************************************************************************
  12. #ifndef _bootini_H_
  13. #define _bootini_H_
  14. #include <wbemprov.h>
  15. #include <stdio.h>
  16. #include <tchar.h>
  17. #include <windows.h>
  18. #include <wbemcli.h>
  19. typedef LPVOID * PPVOID;
  20. // Provider interfaces are provided by objects of this class
  21. class CBootInstPro : public IWbemServices, public IWbemProviderInit
  22. {
  23. protected:
  24. ULONG m_cRef; //Object reference count
  25. IWbemServices * m_pNamespace;
  26. public:
  27. CBootInstPro(BSTR ObjectPath = NULL, BSTR User = NULL, BSTR Password = NULL, IWbemContext * pCtx=NULL);
  28. ~CBootInstPro(void);
  29. //Non-delegating object IUnknown
  30. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  31. STDMETHODIMP_(ULONG) AddRef(void);
  32. STDMETHODIMP_(ULONG) Release(void);
  33. //IWbemProviderInit
  34. HRESULT STDMETHODCALLTYPE Initialize(LPWSTR pszUser,
  35. LONG lFlags,
  36. LPWSTR pszNamespace,
  37. LPWSTR pszLocale,
  38. IWbemServices *pNamespace,
  39. IWbemContext *pCtx,
  40. IWbemProviderInitSink *pInitSink
  41. );
  42. //IWbemServices
  43. HRESULT STDMETHODCALLTYPE OpenNamespace( const BSTR Namespace,
  44. long lFlags,
  45. IWbemContext __RPC_FAR *pCtx,
  46. IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  47. IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
  48. {
  49. return WBEM_E_NOT_SUPPORTED;
  50. };
  51. HRESULT STDMETHODCALLTYPE CancelAsyncCall( IWbemObjectSink __RPC_FAR *pSink)
  52. {
  53. return WBEM_E_NOT_SUPPORTED;
  54. };
  55. HRESULT STDMETHODCALLTYPE QueryObjectSink(long lFlags,
  56. IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler
  57. )
  58. {
  59. return WBEM_E_NOT_SUPPORTED;
  60. };
  61. HRESULT STDMETHODCALLTYPE GetObject(const BSTR ObjectPath,
  62. long lFlags,
  63. IWbemContext __RPC_FAR *pCtx,
  64. IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  65. IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult
  66. )
  67. {
  68. return WBEM_E_NOT_SUPPORTED;
  69. };
  70. HRESULT STDMETHODCALLTYPE GetObjectAsync(const BSTR ObjectPath,
  71. long lFlags,
  72. IWbemContext __RPC_FAR *pCtx,
  73. IWbemObjectSink __RPC_FAR *pResponseHandler
  74. );
  75. HRESULT STDMETHODCALLTYPE PutClass(IWbemClassObject __RPC_FAR *pObject,
  76. long lFlags,
  77. IWbemContext __RPC_FAR *pCtx,
  78. IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult
  79. )
  80. {
  81. return WBEM_E_NOT_SUPPORTED;
  82. };
  83. HRESULT STDMETHODCALLTYPE PutClassAsync(IWbemClassObject __RPC_FAR *pObject,
  84. long lFlags,
  85. IWbemContext __RPC_FAR *pCtx,
  86. IWbemObjectSink __RPC_FAR *pResponseHandler
  87. )
  88. {
  89. return WBEM_E_NOT_SUPPORTED;
  90. };
  91. HRESULT STDMETHODCALLTYPE DeleteClass(const BSTR Class,
  92. long lFlags,
  93. IWbemContext __RPC_FAR *pCtx,
  94. IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult
  95. )
  96. {
  97. return WBEM_E_NOT_SUPPORTED;
  98. };
  99. HRESULT STDMETHODCALLTYPE DeleteClassAsync(const BSTR Class,
  100. long lFlags,
  101. IWbemContext __RPC_FAR *pCtx,
  102. IWbemObjectSink __RPC_FAR *pResponseHandler
  103. )
  104. {
  105. return WBEM_E_NOT_SUPPORTED;
  106. };
  107. HRESULT STDMETHODCALLTYPE CreateClassEnum(const BSTR Superclass,
  108. long lFlags,
  109. IWbemContext __RPC_FAR *pCtx,
  110. IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum
  111. )
  112. {
  113. return WBEM_E_NOT_SUPPORTED;
  114. };
  115. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(const BSTR Superclass,
  116. long lFlags,
  117. IWbemContext __RPC_FAR *pCtx,
  118. IWbemObjectSink __RPC_FAR *pResponseHandler
  119. )
  120. {
  121. return WBEM_E_NOT_SUPPORTED;
  122. };
  123. HRESULT STDMETHODCALLTYPE PutInstance(IWbemClassObject __RPC_FAR *pInst,
  124. long lFlags,
  125. IWbemContext __RPC_FAR *pCtx,
  126. IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult
  127. )
  128. {
  129. return WBEM_E_NOT_SUPPORTED;
  130. };
  131. HRESULT STDMETHODCALLTYPE PutInstanceAsync(IWbemClassObject __RPC_FAR *pInst,
  132. long lFlags,
  133. IWbemContext __RPC_FAR *pCtx,
  134. IWbemObjectSink __RPC_FAR *pResponseHandler
  135. );
  136. HRESULT STDMETHODCALLTYPE DeleteInstance(const BSTR ObjectPath,
  137. long lFlags,
  138. IWbemContext __RPC_FAR *pCtx,
  139. IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult
  140. )
  141. {
  142. return WBEM_E_NOT_SUPPORTED;
  143. };
  144. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(const BSTR ObjectPath,
  145. long lFlags,
  146. IWbemContext __RPC_FAR *pCtx,
  147. IWbemObjectSink __RPC_FAR *pResponseHandler
  148. )
  149. {
  150. return WBEM_E_NOT_SUPPORTED;
  151. };
  152. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(const BSTR Class,
  153. long lFlags,
  154. IWbemContext __RPC_FAR *pCtx,
  155. IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum
  156. )
  157. {
  158. return WBEM_E_NOT_SUPPORTED;
  159. };
  160. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(const BSTR Class,
  161. long lFlags,
  162. IWbemContext __RPC_FAR *pCtx,
  163. IWbemObjectSink __RPC_FAR *pResponseHandler
  164. )
  165. {
  166. return WBEM_E_NOT_SUPPORTED;
  167. }
  168. HRESULT STDMETHODCALLTYPE ExecQuery(const BSTR QueryLanguage,
  169. const BSTR Query,
  170. long lFlags,
  171. IWbemContext __RPC_FAR *pCtx,
  172. IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  173. {
  174. return WBEM_E_NOT_SUPPORTED;
  175. };
  176. HRESULT STDMETHODCALLTYPE ExecQueryAsync(const BSTR QueryLanguage,
  177. const BSTR Query,
  178. long lFlags,
  179. IWbemContext __RPC_FAR *pCtx,
  180. IWbemObjectSink __RPC_FAR *pResponseHandler
  181. )
  182. {
  183. return WBEM_E_NOT_SUPPORTED;
  184. };
  185. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(const BSTR QueryLanguage,
  186. const BSTR Query,
  187. long lFlags,
  188. IWbemContext __RPC_FAR *pCtx,
  189. IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum
  190. )
  191. {
  192. return WBEM_E_NOT_SUPPORTED;
  193. };
  194. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(const BSTR QueryLanguage,
  195. const BSTR Query,
  196. long lFlags,
  197. IWbemContext __RPC_FAR *pCtx,
  198. IWbemObjectSink __RPC_FAR *pResponseHandler
  199. )
  200. {
  201. return WBEM_E_NOT_SUPPORTED;
  202. };
  203. HRESULT STDMETHODCALLTYPE ExecMethod(const BSTR,
  204. const BSTR,
  205. long, IWbemContext*,
  206. IWbemClassObject*,
  207. IWbemClassObject**,
  208. IWbemCallResult**
  209. )
  210. {
  211. return WBEM_E_NOT_SUPPORTED;
  212. }
  213. HRESULT STDMETHODCALLTYPE ExecMethodAsync(const BSTR,
  214. const BSTR,
  215. long,
  216. IWbemContext*,
  217. IWbemClassObject*,
  218. IWbemObjectSink*
  219. )
  220. {
  221. return WBEM_E_NOT_SUPPORTED;
  222. }
  223. };
  224. typedef CBootInstPro *PCBootInstPro;
  225. // This class is the class factory for CInstPro objects.
  226. class CBootProvFactory : public IClassFactory
  227. {
  228. protected:
  229. ULONG m_cRef;
  230. public:
  231. CBootProvFactory(void);
  232. ~CBootProvFactory(void);
  233. //IUnknown members
  234. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  235. STDMETHODIMP_(ULONG) AddRef(void);
  236. STDMETHODIMP_(ULONG) Release(void);
  237. //IClassFactory members
  238. STDMETHODIMP CreateInstance(LPUNKNOWN,
  239. REFIID,
  240. PPVOID
  241. );
  242. STDMETHODIMP LockServer(BOOL);
  243. };
  244. typedef CBootProvFactory *PCBootProvFactory;
  245. // These variables keep track of when the module can be unloaded
  246. extern long g_cObj;
  247. extern long g_cLock;
  248. // General purpose utilities.
  249. SCODE
  250. GetBootLoaderParameters(IWbemServices *m_pNamespace,
  251. IWbemClassObject *pNewInst,
  252. IWbemContext *pCtx
  253. );
  254. extern "C" BOOL WINAPI LibMain32(HINSTANCE hInstance,
  255. ULONG ulReason,
  256. LPVOID pvReserved
  257. );
  258. LONG
  259. SaveBootFile(IWbemClassObject *pInst,
  260. IWbemClassObject *pClass
  261. );
  262. HANDLE GetFileHandle(PCHAR data,
  263. DWORD dwCreationDisposition,
  264. DWORD dwAccess
  265. );
  266. PCHAR
  267. GetBootFileName(
  268. );
  269. typedef struct {
  270. CHAR Default[256];
  271. long Delay;
  272. CHAR Redirect[32];
  273. } BootLoaderParams;
  274. #if DBG==1
  275. LPVOID BPAlloc(int len);
  276. VOID BPFree(LPVOID mem);
  277. #else
  278. #define BPAlloc(x) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, x)
  279. #define BPFree(x) HeapFree(GetProcessHeap(), 0, x)
  280. #endif
  281. extern BootLoaderParams blp;
  282. #endif