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.

86 lines
2.7 KiB

  1. /*****************************************************************************\
  2. Author: Corey Morgan (coreym)
  3. Copyright (c) Microsoft Corporation. All rights reserved.
  4. \*****************************************************************************/
  5. #include <wmistr.h>
  6. #include <initguid.h>
  7. #include <guiddef.h>
  8. #include <evntrace.h>
  9. #define MAXSTR 1024
  10. #define MAXIMUM_LOGGERS 64 // should be in sync with wmiumkm.h
  11. #define PROVIDER_NAME_EVENTTRACE L"TraceLogger"
  12. #define DECODE_MODE_WBEM_TO_TRACE 1
  13. #define DECODE_MODE_TRACE_TO_WBEM 2
  14. #define VALUETYPE_INDEX 1
  15. #define VALUETYPE_FLAG 2
  16. #define G_ALLOC( s ) HeapAlloc( GetProcessHeap(), 0, s )
  17. #define G_FREE( s ) if( s != NULL ) { HeapFree( GetProcessHeap(), 0, s ); }
  18. extern GUID gHeapGuid;
  19. extern GUID gCritSecGuid;
  20. ULONG EtsGetMaxEnableFlags();
  21. HRESULT
  22. EtsSetExtendedFlags(
  23. SAFEARRAY *saFlags,
  24. PEVENT_TRACE_PROPERTIES pLoggerInfo,
  25. ULONG offset
  26. );
  27. class CEventTrace : public Provider
  28. {
  29. public:
  30. CEventTrace(LPCWSTR chsClassName, LPCWSTR lpszNameSpace);
  31. virtual ~CEventTrace();
  32. protected:
  33. virtual HRESULT EnumerateInstances(MethodContext* pMethodContext, long lFlags = 0L);
  34. virtual HRESULT GetObject(CInstance* pInstance, long lFlags = 0L);
  35. virtual HRESULT PutInstance(const CInstance& Instance, long lFlags = 0L);
  36. virtual HRESULT ExecMethod( const CInstance& Instance,
  37. const BSTR bstrMethodName,
  38. CInstance *pInParams,
  39. CInstance *pOutParams,
  40. long lFlags = 0L
  41. );
  42. HRESULT LoadPropertyValues(
  43. CInstance *pInstance,
  44. PEVENT_TRACE_PROPERTIES pLoggerInfo,
  45. PTRACE_GUID_PROPERTIES *GuidPropertiesArray,
  46. ULONG nGuidCount
  47. );
  48. HRESULT LoadGuidArray(
  49. PVOID* Storage,
  50. PULONG pnGuidCount
  51. );
  52. private:
  53. HRESULT WmiFlushTrace( const CInstance &Instance );
  54. HRESULT WmiStopTrace( const CInstance &Instance );
  55. HRESULT WmiEnableTrace( const CInstance &Instance, bool bEnable, SAFEARRAY *saFlags, SAFEARRAY *saLevel, SAFEARRAY *saGuid, TRACEHANDLE LoggerHandle );
  56. HRESULT StartGlobalLogger( IN PEVENT_TRACE_PROPERTIES LoggerInfo );
  57. HRESULT DeleteGlobalLogger( IN PEVENT_TRACE_PROPERTIES LoggerInfo );
  58. HRESULT InitTraceProperties( PEVENT_TRACE_PROPERTIES* ppLoggerInfo );
  59. HRESULT DecodePropertyValue(
  60. CInstance* pInstance,
  61. LPCWSTR szProperty,
  62. DWORD* pdwValue,
  63. DWORD dwFlags );
  64. };