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.

239 lines
9.9 KiB

  1. // WhqlObj.h : Declaration of the CWhqlObj
  2. #ifndef __WHQLOBJ_H_
  3. #define __WHQLOBJ_H_
  4. #include "resource.h" // main symbols
  5. #include "WbemProv.h"
  6. #include <softpub.h>
  7. // Macros and pre-defined values
  8. #define cbX(X) sizeof(X)
  9. #define cA(a) (cbX(a)/cbX(a[0]))
  10. #define MALLOC(x) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x))
  11. #define FREE(x) if (x) { HeapFree(GetProcessHeap(), 0, (x)); x = NULL; }
  12. #define EXIST(x) (GetFileAttributes(x) != 0xFFFFFFFF)
  13. #define MAX_INT 0x7FFFFFFF
  14. #define HASH_SIZE 100
  15. #define NUM_PAGES 2
  16. typedef struct tagFileNode
  17. {
  18. LPTSTR lpFileName;
  19. LPTSTR lpDirName;
  20. LPTSTR lpVersion;
  21. LPTSTR lpCatalog;
  22. LPTSTR lpSignedBy;
  23. LPTSTR lpTypeName;
  24. INT iIcon;
  25. BOOL bSigned;
  26. BOOL bScanned;
  27. BOOL bValidateAgainstAnyOs;
  28. DWORD LastError;
  29. SYSTEMTIME LastModified;
  30. struct tagFileNode *next;
  31. } FILENODE, *LPFILENODE;
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CWhqlObj
  34. class ATL_NO_VTABLE CWhqlObj :
  35. public CComObjectRootEx<CComMultiThreadModel>,
  36. public CComCoClass<CWhqlObj, &CLSID_WhqlObj>,
  37. public IDispatchImpl<IWhqlObj, &IID_IWhqlObj, &LIBID_MSINFO32Lib>,
  38. public IWbemProviderInit,
  39. public IWbemServices
  40. {
  41. public:
  42. CWhqlObj()
  43. {
  44. }
  45. //DECLARE_REGISTRY_RESOURCEID(IDR_WHQLPROV)
  46. DECLARE_REGISTRY_RESOURCEID(IDR_WHQLOBJ)
  47. DECLARE_PROTECT_FINAL_CONSTRUCT()
  48. BEGIN_COM_MAP(CWhqlObj)
  49. COM_INTERFACE_ENTRY(IWhqlObj)
  50. COM_INTERFACE_ENTRY(IDispatch)
  51. COM_INTERFACE_ENTRY(IWbemProviderInit)
  52. COM_INTERFACE_ENTRY(IWbemServices)
  53. END_COM_MAP()
  54. // IWhqlObj
  55. public:
  56. //IWbemProviderInit
  57. STDMETHOD(Initialize)(
  58. /* [in] */ LPWSTR pszUser,
  59. /* [in] */ LONG lFlags,
  60. /* [in] */ LPWSTR pszNamespace,
  61. /* [in] */ LPWSTR pszLocale,
  62. /* [in] */ IWbemServices *pNamespace,
  63. /* [in] */ IWbemContext *pCtx,
  64. /* [in] */ IWbemProviderInitSink *pInitSink);
  65. STDMETHOD(GetByPath)(BSTR Path, IWbemClassObject FAR* FAR* pObj, IWbemContext *pCtx) {return WBEM_E_NOT_SUPPORTED;};
  66. //IWbemServices
  67. HRESULT STDMETHODCALLTYPE OpenNamespace(
  68. /* [in] */ const BSTR strNamespace,
  69. /* [in] */ long lFlags,
  70. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  71. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  72. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult){return WBEM_E_NOT_SUPPORTED;};
  73. HRESULT STDMETHODCALLTYPE CancelAsyncCall(
  74. /* [in] */ IWbemObjectSink __RPC_FAR *pSink){return WBEM_E_NOT_SUPPORTED;};
  75. HRESULT STDMETHODCALLTYPE QueryObjectSink(
  76. /* [in] */ long lFlags,
  77. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  78. HRESULT STDMETHODCALLTYPE GetObject(
  79. /* [in] */ const BSTR strObjectPath,
  80. /* [in] */ long lFlags,
  81. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  82. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  83. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  84. HRESULT STDMETHODCALLTYPE GetObjectAsync(
  85. /* [in] */ const BSTR strObjectPath,
  86. /* [in] */ long lFlags,
  87. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  88. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  89. HRESULT STDMETHODCALLTYPE PutClass(
  90. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  91. /* [in] */ long lFlags,
  92. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  93. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  94. HRESULT STDMETHODCALLTYPE PutClassAsync(
  95. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  96. /* [in] */ long lFlags,
  97. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  98. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  99. HRESULT STDMETHODCALLTYPE DeleteClass(
  100. /* [in] */ const BSTR strClass,
  101. /* [in] */ long lFlags,
  102. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  103. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  104. HRESULT STDMETHODCALLTYPE DeleteClassAsync(
  105. /* [in] */ const BSTR strClass,
  106. /* [in] */ long lFlags,
  107. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  108. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  109. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  110. /* [in] */ const BSTR strSuperclass,
  111. /* [in] */ long lFlags,
  112. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  113. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
  114. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  115. /* [in] */ const BSTR strSuperclass,
  116. /* [in] */ long lFlags,
  117. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  118. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  119. HRESULT STDMETHODCALLTYPE PutInstance(
  120. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  121. /* [in] */ long lFlags,
  122. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  123. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  124. HRESULT STDMETHODCALLTYPE PutInstanceAsync(
  125. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  126. /* [in] */ long lFlags,
  127. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  128. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  129. HRESULT STDMETHODCALLTYPE DeleteInstance(
  130. /* [in] */ const BSTR strObjectPath,
  131. /* [in] */ long lFlags,
  132. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  133. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  134. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
  135. /* [in] */ const BSTR strObjectPath,
  136. /* [in] */ long lFlags,
  137. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  138. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  139. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  140. /* [in] */ const BSTR strClass,
  141. /* [in] */ long lFlags,
  142. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  143. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
  144. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
  145. /* [in] */ const BSTR strClass,
  146. /* [in] */ long lFlags,
  147. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  148. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  149. HRESULT STDMETHODCALLTYPE ExecQuery(
  150. /* [in] */ const BSTR strQueryLanguage,
  151. /* [in] */ const BSTR strQuery,
  152. /* [in] */ long lFlags,
  153. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  154. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
  155. HRESULT STDMETHODCALLTYPE ExecQueryAsync(
  156. /* [in] */ const BSTR strQueryLanguage,
  157. /* [in] */ const BSTR strQuery,
  158. /* [in] */ long lFlags,
  159. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  160. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  161. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  162. /* [in] */ const BSTR strQueryLanguage,
  163. /* [in] */ const BSTR strQuery,
  164. /* [in] */ long lFlags,
  165. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  166. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
  167. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
  168. /* [in] */ const BSTR strQueryLanguage,
  169. /* [in] */ const BSTR strQuery,
  170. /* [in] */ long lFlags,
  171. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  172. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  173. HRESULT STDMETHODCALLTYPE ExecMethod(
  174. /* [in] */ const BSTR strObjectPath,
  175. /* [in] */ const BSTR strMethodName,
  176. /* [in] */ long lFlags,
  177. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  178. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  179. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppOutParams,
  180. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
  181. HRESULT STDMETHODCALLTYPE ExecMethodAsync(
  182. /* [in] */ const BSTR strObjectPath,
  183. /* [in] */ const BSTR strMethodName,
  184. /* [in] */ long lFlags,
  185. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  186. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  187. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
  188. private:
  189. IWbemServices* m_pNamespace;
  190. //IWbemClassObject* m_pClass;
  191. //CString m_csPathStr ;
  192. //CPtrArray m_ptrArr;
  193. SCODE PutPropertyValue(IWbemClassObject*, LPCTSTR, LPCTSTR);
  194. SCODE PutPropertyDTMFValue(IWbemClassObject* pInstance, LPCTSTR szName, LPCTSTR szValue);//v-stlowe
  195. int WalkTree(void);
  196. int CreateList(CPtrArray&, IWbemClassObject *&, IWbemContext *, Classes_Provided);
  197. SCODE GetServerAndNamespace(IWbemContext*, CString&);
  198. void BuildPrinterFileList(CPtrArray&, IWbemClassObject *&, IWbemContext *, Classes_Provided);
  199. };
  200. #endif //__WHQLOBJ_H_