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.

75 lines
3.1 KiB

  1. // GenericClass.h: interface for the CGenericClass class.
  2. // Copyright (c)1997-1999 Microsoft Corporation
  3. //
  4. //////////////////////////////////////////////////////////////////////
  5. #if !defined(AFX_GENERICCLASS_H__c5f6cc21_6195_4555_b9d8_3ef327763cae__INCLUDED_)
  6. #define AFX_GENERICCLASS_H__c5f6cc21_6195_4555_b9d8_3ef327763cae__INCLUDED_
  7. #include "requestobject.h"
  8. #if _MSC_VER >= 1000
  9. #pragma once
  10. #endif // _MSC_VER >= 1000
  11. class CGenericClass
  12. {
  13. public:
  14. CGenericClass(CRequestObject *pObj, IWbemServices *pNamespace, IWbemContext *pCtx = NULL);
  15. virtual ~CGenericClass();
  16. //The instance write class which can optionally be implemented
  17. virtual HRESULT PutInst(IWbemClassObject *pInst, IWbemObjectSink *pHandler, IWbemContext *pCtx) = 0;
  18. IWbemClassObject *m_pObj;
  19. //The instance creation class which must be implemented
  20. virtual HRESULT CreateObject(IWbemObjectSink *pHandler, ACTIONTYPE atAction) = 0;
  21. //The method execution class which can be optionally be implemented
  22. virtual HRESULT ExecMethod(BSTR bstrMethod, bool bIsInstance, IWbemClassObject *pInParams,IWbemObjectSink *pHandler, IWbemContext *pCtx) = 0;
  23. void CleanUp();
  24. CRequestObject *m_pRequest;
  25. protected:
  26. //Property Methods
  27. HRESULT PutProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, WCHAR *wcValue);
  28. HRESULT PutProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, int iValue);
  29. HRESULT PutProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, float dValue);
  30. HRESULT PutProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, bool bValue);
  31. HRESULT PutProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, WCHAR *mszValue, CIMTYPE cimtype);
  32. //Key Property Methods
  33. HRESULT PutKeyProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, WCHAR *wcValue,
  34. bool *bKey, CRequestObject *pRequest);
  35. HRESULT PutKeyProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, int iValue,
  36. bool *bKey, CRequestObject *pRequest);
  37. //Utility Methods
  38. bool FindIn(BSTR bstrProp[], BSTR bstrSearch, int *iPos);
  39. HRESULT SetSinglePropertyPath(WCHAR wcProperty[]);
  40. HRESULT GetProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, WCHAR *wcValue);
  41. HRESULT GetProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, BSTR *wcValue);
  42. HRESULT GetProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, int *piValue);
  43. HRESULT GetProperty(IWbemClassObject *pObj, const WCHAR *wcProperty, bool *pbValue);
  44. WCHAR * GetFirstGUID(WCHAR wcIn[], WCHAR wcOut[]);
  45. WCHAR * RemoveFinalGUID(WCHAR wcIn[], WCHAR wcOut[]);
  46. HRESULT SpawnAnInstance(IWbemServices *pNamespace, IWbemContext *pCtx,
  47. IWbemClassObject **pObj, BSTR bstrName);
  48. HRESULT SpawnAnInstance(IWbemClassObject **pObj);
  49. int m_iRecurs;
  50. IWbemServices *m_pNamespace;
  51. IWbemClassObject *m_pClassForSpawning;
  52. IWbemContext *m_pCtx;
  53. WCHAR * GetNextVar(WCHAR *pwcStart);
  54. long GetVarCount(void * pEnv);
  55. };
  56. #endif // !defined(AFX_GENERICCLASS_H__c5f6cc21_6195_4555_b9d8_3ef327763cae__INCLUDED_)