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.

101 lines
4.0 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright � Microsoft Corporation. All rights reserved.
  4. //
  5. // Instance.h
  6. //
  7. // Purpose: Definition of CInstance class
  8. //
  9. //***************************************************************************
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #ifndef _INSTANCE_H_
  14. #define _INSTANCE_H_
  15. #define WBEMINT64 CHString
  16. #define WBEMINT16 short
  17. ///////////////////////////////////////////
  18. //
  19. // CLASS CInstance
  20. //
  21. // base instance class
  22. // encapsulation of IWbemClassObject
  23. ///////////////////////////////////////////
  24. class
  25. __declspec(uuid("3402945E-D19A-11d2-B35E-00104BC97924"))
  26. POLARITY CInstance
  27. {
  28. public:
  29. CInstance(IWbemClassObject *piClassObject, MethodContext *pMethodContext);
  30. virtual ~CInstance();
  31. // AddRef/Release
  32. LONG AddRef( void );
  33. LONG Release( void );
  34. // Get and Set for various data types
  35. bool SetNull(LPCWSTR name );
  36. bool SetStringArray(LPCWSTR name, const SAFEARRAY &strArray);
  37. bool SetWORD(LPCWSTR name, WORD w);
  38. bool SetDWORD(LPCWSTR name, DWORD d);
  39. bool Setbool(LPCWSTR name, bool b);
  40. bool SetVariant(LPCWSTR name, const VARIANT& variant );
  41. #ifdef FRAMEWORK_ALLOW_DEPRECATED
  42. bool SetCharSplat(LPCWSTR name, DWORD dwResID);
  43. #endif
  44. bool SetCharSplat(LPCWSTR name, LPCWSTR pStr);
  45. bool SetCharSplat( LPCWSTR name, LPCSTR pStr);
  46. bool SetWCHARSplat(LPCWSTR name, LPCWSTR pStr);
  47. bool SetDateTime(LPCWSTR name, const WBEMTime& wbemtime );
  48. bool SetTimeSpan(LPCWSTR name, const WBEMTimeSpan& wbemtimespan );
  49. bool SetWBEMINT64(LPCWSTR name, const WBEMINT64& wbemint64 );
  50. bool SetWBEMINT64(LPCWSTR name, const LONGLONG i64Value );
  51. bool SetWBEMINT64( LPCWSTR name, const ULONGLONG i64Value );
  52. bool SetWBEMINT16(LPCWSTR name, const WBEMINT16& wbemint16 );
  53. bool SetByte(LPCWSTR name, BYTE b );
  54. bool SetEmbeddedObject (LPCWSTR name, CInstance& cInstance ) ;
  55. bool SetDOUBLE(LPCWSTR name, DOUBLE dub );
  56. bool SetCHString(LPCWSTR name, LPCWSTR str);
  57. bool SetCHString(LPCWSTR name, const CHString& str);
  58. bool SetCHString(LPCWSTR name, LPCSTR str);
  59. bool GetStringArray(LPCWSTR name, SAFEARRAY *& strArray) const;
  60. bool GetCHString(LPCWSTR name, CHString& str) const;
  61. bool GetWCHAR(LPCWSTR name, WCHAR **pW) const;
  62. bool GetWORD(LPCWSTR name, WORD& w) const;
  63. bool GetDWORD(LPCWSTR name, DWORD& d) const;
  64. bool Getbool(LPCWSTR name, bool& b) const;
  65. bool GetVariant(LPCWSTR name, VARIANT& variant ) const;
  66. bool GetDateTime(LPCWSTR name, WBEMTime& wbemtime ) const;
  67. bool GetTimeSpan(LPCWSTR name, WBEMTimeSpan& wbemtimespan ) const;
  68. bool GetWBEMINT64(LPCWSTR name, WBEMINT64& wbemint64 ) const;
  69. bool GetWBEMINT64(LPCWSTR name, LONGLONG& i64Value ) const;
  70. bool GetWBEMINT64( LPCWSTR name, ULONGLONG& i64Value) const;
  71. bool GetWBEMINT16(LPCWSTR name, WBEMINT16& wbemint16 ) const;
  72. bool GetByte(LPCWSTR name, BYTE& b ) const;
  73. bool GetEmbeddedObject(LPCWSTR name, CInstance** pInstance, MethodContext *pMethodContext) const;
  74. bool GetDOUBLE(LPCWSTR name, DOUBLE& dub) const;
  75. bool IsNull(LPCWSTR name) const;
  76. bool GetStatus(LPCWSTR name, bool &a_Exists , VARTYPE &a_VarType ) const ;
  77. HRESULT Commit(void);
  78. IWbemClassObject *GetClassObjectInterface();
  79. MethodContext *GetMethodContext() const;
  80. protected:
  81. // All items in this section intended for Microsoft internal use only
  82. // use by third parties is unsupported and unrecommended
  83. void LogError(LPCWSTR errorStr, LPCWSTR pFunctionName, LPCWSTR pArgs = NULL, HRESULT hError = -1) const;
  84. IWbemClassObject *m_piClassObject;
  85. MethodContext* m_pMethodContext;
  86. LONG m_nRefCount;
  87. friend class CWbemProviderGlue;
  88. };
  89. #endif