240 lines
9.9 KiB
C
240 lines
9.9 KiB
C
|
// WhqlObj.h : Declaration of the CWhqlObj
|
||
|
|
||
|
#ifndef __WHQLOBJ_H_
|
||
|
#define __WHQLOBJ_H_
|
||
|
|
||
|
#include "resource.h" // main symbols
|
||
|
#include "WbemProv.h"
|
||
|
#include <softpub.h>
|
||
|
|
||
|
// Macros and pre-defined values
|
||
|
#define cbX(X) sizeof(X)
|
||
|
#define cA(a) (cbX(a)/cbX(a[0]))
|
||
|
#define MALLOC(x) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x))
|
||
|
#define FREE(x) if (x) { HeapFree(GetProcessHeap(), 0, (x)); x = NULL; }
|
||
|
#define EXIST(x) (GetFileAttributes(x) != 0xFFFFFFFF)
|
||
|
#define MAX_INT 0x7FFFFFFF
|
||
|
#define HASH_SIZE 100
|
||
|
#define NUM_PAGES 2
|
||
|
|
||
|
typedef struct tagFileNode
|
||
|
{
|
||
|
LPTSTR lpFileName;
|
||
|
LPTSTR lpDirName;
|
||
|
LPTSTR lpVersion;
|
||
|
LPTSTR lpCatalog;
|
||
|
LPTSTR lpSignedBy;
|
||
|
LPTSTR lpTypeName;
|
||
|
INT iIcon;
|
||
|
BOOL bSigned;
|
||
|
BOOL bScanned;
|
||
|
BOOL bValidateAgainstAnyOs;
|
||
|
DWORD LastError;
|
||
|
SYSTEMTIME LastModified;
|
||
|
struct tagFileNode *next;
|
||
|
} FILENODE, *LPFILENODE;
|
||
|
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
// CWhqlObj
|
||
|
|
||
|
class ATL_NO_VTABLE CWhqlObj :
|
||
|
public CComObjectRootEx<CComMultiThreadModel>,
|
||
|
public CComCoClass<CWhqlObj, &CLSID_WhqlObj>,
|
||
|
public IDispatchImpl<IWhqlObj, &IID_IWhqlObj, &LIBID_MSINFO32Lib>,
|
||
|
public IWbemProviderInit,
|
||
|
public IWbemServices
|
||
|
{
|
||
|
public:
|
||
|
CWhqlObj()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
//DECLARE_REGISTRY_RESOURCEID(IDR_WHQLPROV)
|
||
|
DECLARE_REGISTRY_RESOURCEID(IDR_WHQLOBJ)
|
||
|
|
||
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||
|
|
||
|
BEGIN_COM_MAP(CWhqlObj)
|
||
|
COM_INTERFACE_ENTRY(IWhqlObj)
|
||
|
COM_INTERFACE_ENTRY(IDispatch)
|
||
|
COM_INTERFACE_ENTRY(IWbemProviderInit)
|
||
|
COM_INTERFACE_ENTRY(IWbemServices)
|
||
|
END_COM_MAP()
|
||
|
|
||
|
// IWhqlObj
|
||
|
public:
|
||
|
|
||
|
//IWbemProviderInit
|
||
|
STDMETHOD(Initialize)(
|
||
|
/* [in] */ LPWSTR pszUser,
|
||
|
/* [in] */ LONG lFlags,
|
||
|
/* [in] */ LPWSTR pszNamespace,
|
||
|
/* [in] */ LPWSTR pszLocale,
|
||
|
/* [in] */ IWbemServices *pNamespace,
|
||
|
/* [in] */ IWbemContext *pCtx,
|
||
|
/* [in] */ IWbemProviderInitSink *pInitSink);
|
||
|
|
||
|
STDMETHOD(GetByPath)(BSTR Path, IWbemClassObject FAR* FAR* pObj, IWbemContext *pCtx) {return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
//IWbemServices
|
||
|
HRESULT STDMETHODCALLTYPE OpenNamespace(
|
||
|
/* [in] */ const BSTR strNamespace,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE CancelAsyncCall(
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pSink){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE QueryObjectSink(
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE GetObject(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE GetObjectAsync(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE PutClass(
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pObject,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE PutClassAsync(
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pObject,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE DeleteClass(
|
||
|
/* [in] */ const BSTR strClass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE DeleteClassAsync(
|
||
|
/* [in] */ const BSTR strClass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE CreateClassEnum(
|
||
|
/* [in] */ const BSTR strSuperclass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
|
||
|
/* [in] */ const BSTR strSuperclass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE PutInstance(
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pInst,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE PutInstanceAsync(
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pInst,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE DeleteInstance(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
|
||
|
/* [in] */ const BSTR strClass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
|
||
|
/* [in] */ const BSTR strClass,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecQuery(
|
||
|
/* [in] */ const BSTR strQueryLanguage,
|
||
|
/* [in] */ const BSTR strQuery,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecQueryAsync(
|
||
|
/* [in] */ const BSTR strQueryLanguage,
|
||
|
/* [in] */ const BSTR strQuery,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
|
||
|
/* [in] */ const BSTR strQueryLanguage,
|
||
|
/* [in] */ const BSTR strQuery,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
|
||
|
/* [in] */ const BSTR strQueryLanguage,
|
||
|
/* [in] */ const BSTR strQuery,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecMethod(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ const BSTR strMethodName,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pInParams,
|
||
|
/* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppOutParams,
|
||
|
/* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
HRESULT STDMETHODCALLTYPE ExecMethodAsync(
|
||
|
/* [in] */ const BSTR strObjectPath,
|
||
|
/* [in] */ const BSTR strMethodName,
|
||
|
/* [in] */ long lFlags,
|
||
|
/* [in] */ IWbemContext __RPC_FAR *pCtx,
|
||
|
/* [in] */ IWbemClassObject __RPC_FAR *pInParams,
|
||
|
/* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler){return WBEM_E_NOT_SUPPORTED;};
|
||
|
|
||
|
private:
|
||
|
IWbemServices* m_pNamespace;
|
||
|
//IWbemClassObject* m_pClass;
|
||
|
//CString m_csPathStr ;
|
||
|
//CPtrArray m_ptrArr;
|
||
|
|
||
|
SCODE PutPropertyValue(IWbemClassObject*, LPCTSTR, LPCTSTR);
|
||
|
SCODE PutPropertyDTMFValue(IWbemClassObject* pInstance, LPCTSTR szName, LPCTSTR szValue);//v-stlowe
|
||
|
int WalkTree(void);
|
||
|
int CreateList(CPtrArray&, IWbemClassObject *&, IWbemContext *, Classes_Provided);
|
||
|
SCODE GetServerAndNamespace(IWbemContext*, CString&);
|
||
|
void BuildPrinterFileList(CPtrArray&, IWbemClassObject *&, IWbemContext *, Classes_Provided);
|
||
|
};
|
||
|
|
||
|
#endif //__WHQLOBJ_H_
|