Source code of Windows XP (NT5)
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
2.4 KiB

  1. /*****************************************************************************\
  2. Author: Corey Morgan (coreym)
  3. Copyright (c) 1998-2000 Microsoft Corporation
  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 G_ALLOC( s ) HeapAlloc( GetProcessHeap(), 0, s )
  15. #define G_FREE( s ) if( s != NULL ) { HeapFree( GetProcessHeap(), 0, s ); }
  16. ULONG EtsGetMaxEnableFlags();
  17. HRESULT
  18. EtsSetExtendedFlags(
  19. SAFEARRAY *saFlags,
  20. PEVENT_TRACE_PROPERTIES pLoggerInfo,
  21. ULONG offset
  22. );
  23. class CEventTrace : public Provider
  24. {
  25. public:
  26. CEventTrace(LPCWSTR chsClassName, LPCWSTR lpszNameSpace);
  27. virtual ~CEventTrace();
  28. protected:
  29. virtual HRESULT EnumerateInstances(MethodContext* pMethodContext, long lFlags = 0L);
  30. virtual HRESULT GetObject(CInstance* pInstance, long lFlags = 0L);
  31. virtual HRESULT PutInstance(const CInstance& Instance, long lFlags = 0L);
  32. virtual HRESULT ExecMethod( const CInstance& Instance,
  33. const BSTR bstrMethodName,
  34. CInstance *pInParams,
  35. CInstance *pOutParams,
  36. long lFlags = 0L
  37. );
  38. HRESULT LoadPropertyValues(
  39. CInstance *pInstance,
  40. PEVENT_TRACE_PROPERTIES pLoggerInfo,
  41. PTRACE_GUID_PROPERTIES *GuidPropertiesArray,
  42. ULONG nGuidCount
  43. );
  44. HRESULT LoadGuidArray(
  45. PVOID* Storage,
  46. PULONG pnGuidCount
  47. );
  48. private:
  49. HRESULT WmiFlushTrace( const CInstance &Instance );
  50. HRESULT WmiStopTrace( const CInstance &Instance );
  51. HRESULT WmiEnableTrace( const CInstance &Instance, bool bEnable, SAFEARRAY *saFlags, SAFEARRAY *saLevel, SAFEARRAY *saGuid, TRACEHANDLE LoggerHandle );
  52. HRESULT StartGlobalLogger( IN PEVENT_TRACE_PROPERTIES LoggerInfo );
  53. HRESULT DeleteGlobalLogger( IN PEVENT_TRACE_PROPERTIES LoggerInfo );
  54. HRESULT InitTraceProperties( PEVENT_TRACE_PROPERTIES* ppLoggerInfo );
  55. HRESULT DecodeFileMode( CInstance* pInstance, PEVENT_TRACE_PROPERTIES pLoggerInfo, DWORD dwFlags );
  56. };