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.

123 lines
3.4 KiB

  1. /*++
  2. Copyright (C) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. RefreshCooker.h
  5. Abstract:
  6. The implementation of the refresher
  7. History:
  8. a-dcrews 01-Mar-00 Created
  9. --*/
  10. #ifndef _REFRESHCOOKER_H_
  11. #define _REFRESHCOOKER_H_
  12. #include "Cache.h"
  13. #include "WMIObjCooker.h"
  14. #define WMI_COOKED_ENUM_MASK 0x70000000
  15. typedef CObjRecord<CWMISimpleObjectCooker> TObjectCookerRec;
  16. //
  17. // a Refresher in the Hi-perf world
  18. // is a container of Enumerators and Objects-By-Path
  19. // Since this Refresher is proxy for the Raw Refresher, it holds the Raw one as well
  20. // All the operations on this Refresher translates into enumerations
  21. // of the "arrays" of Enumerators and Objects, and then invocation the the distinct
  22. // refresh-yourself methods.
  23. // This class offers routine book-keeping function for adding and removing
  24. // objects/enumerators from the internal "arrays"
  25. //
  26. ///////////////////////////////////////////////////////////////////////
  27. class CRefresher : public IWMIRefreshableCooker, public IWbemRefresher
  28. {
  29. bool m_bOK; // Creation status indicator
  30. long m_lRef; // Object refrence counter
  31. CCache<CWMISimpleObjectCooker, TObjectCookerRec> m_CookingClassCache; // The cooking class cache
  32. IWbemRefresher* m_pRefresher;
  33. IWbemConfigureRefresher* m_pConfig;
  34. CEnumeratorCache m_EnumCache;
  35. DWORD m_dwRefreshId;
  36. WMISTATUS SearchCookingClassCache( WCHAR* wszCookingClass,
  37. CWMISimpleObjectCooker* & ppObjectCooker );
  38. WMISTATUS AddRawInstance( IWbemServices* pNamespace,
  39. IWbemContext * pContext,
  40. IWbemObjectAccess* pCookingInst,
  41. IWbemObjectAccess** ppRawInst );
  42. WMISTATUS AddRawEnum( IWbemServices* pNamespace,
  43. IWbemContext * pContext,
  44. WCHAR * wszRawClassName,
  45. IWbemHiPerfEnum** ppRawEnum,
  46. long* plID );
  47. WMISTATUS CreateObjectCooker( WCHAR* wszCookingClassName,
  48. IWbemObjectAccess* pCookingAccess,
  49. IWbemObjectAccess* pRawAccess,
  50. CWMISimpleObjectCooker** ppObjectCooker,
  51. IWbemServices * pNamespace = NULL);
  52. public:
  53. CRefresher();
  54. virtual ~CRefresher();
  55. // Non-interface methods
  56. // =====================
  57. bool IsOK(){ return m_bOK; }
  58. // Standard COM methods
  59. // ====================
  60. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  61. STDMETHODIMP_(ULONG) AddRef();
  62. STDMETHODIMP_(ULONG) Release();
  63. // IWMIRefreshableCooker methods
  64. // =============================
  65. STDMETHODIMP AddInstance(
  66. /*[in] */ IWbemServices* pNamespace,
  67. /*[in] */ IWbemContext * pCtx,
  68. /*[in] */ IWbemObjectAccess* pCookingClass,
  69. /*[in] */ IWbemObjectAccess* pRefreshableRawInstance,
  70. /*[out] */ IWbemObjectAccess** ppRefreshableInstance,
  71. /*[out] */ long* plId
  72. );
  73. STDMETHODIMP AddEnum(
  74. /*[in] */ IWbemServices* pNamespace,
  75. /*[in] */ IWbemContext * pCtx,
  76. /*[in,string] */ LPCWSTR szCookingClass,
  77. /*[in] */ IWbemHiPerfEnum* pRefreshableEnum,
  78. /*[out] */ long* plId
  79. );
  80. STDMETHODIMP Remove(
  81. /*[in] */ long lId
  82. );
  83. STDMETHODIMP Refresh();
  84. // IWbemRefresher methods
  85. // ======================
  86. STDMETHODIMP Refresh( /* [in] */ long lFlags );
  87. };
  88. #endif //_REFRESHCOOKER_H_