relogger.idl 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * Copyright 2021 Jacek Caban for CodeWeavers
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. */
  18. import "unknwn.idl";
  19. import "oaidl.idl";
  20. import "ocidl.idl";
  21. #ifndef __WIDL__
  22. #define threading(model)
  23. #endif
  24. typedef struct _EVENT_DESCRIPTOR
  25. {
  26. USHORT Id;
  27. UCHAR Version;
  28. UCHAR Channel;
  29. UCHAR Level;
  30. UCHAR Opcode;
  31. USHORT Task;
  32. ULONGLONG Keyword;
  33. } EVENT_DESCRIPTOR, *PEVENT_DESCRIPTOR;
  34. typedef const EVENT_DESCRIPTOR *PCEVENT_DESCRIPTOR;
  35. typedef struct _EVENT_HEADER
  36. {
  37. USHORT Size;
  38. USHORT HeaderType;
  39. USHORT Flags;
  40. USHORT EventProperty;
  41. ULONG ThreadId;
  42. ULONG ProcessId;
  43. LARGE_INTEGER TimeStamp;
  44. GUID ProviderId;
  45. EVENT_DESCRIPTOR EventDescriptor;
  46. union {
  47. struct {
  48. ULONG KernelTime;
  49. ULONG UserTime;
  50. } DUMMYSTRUCTNAME;
  51. ULONG64 ProcessorTime;
  52. } DUMMYUNIONNAME;
  53. GUID ActivityId;
  54. } EVENT_HEADER, *PEVENT_HEADER;
  55. typedef struct _ETW_BUFFER_CONTEXT
  56. {
  57. union {
  58. struct {
  59. UCHAR ProcessorNumber;
  60. UCHAR Alignment;
  61. } DUMMYSTRUCTNAME;
  62. USHORT ProcessorIndex;
  63. } DUMMYUNIONNAME;
  64. USHORT LoggerId;
  65. } ETW_BUFFER_CONTEXT, *PETW_BUFFER_CONTEXT;
  66. typedef struct _EVENT_HEADER_EXTENDED_DATA_ITEM
  67. {
  68. USHORT Reserved1;
  69. USHORT ExtType;
  70. USHORT Linkage;
  71. USHORT DataSize;
  72. ULONGLONG DataPtr;
  73. } EVENT_HEADER_EXTENDED_DATA_ITEM, *PEVENT_HEADER_EXTENDED_DATA_ITEM;
  74. typedef struct _EVENT_RECORD
  75. {
  76. EVENT_HEADER EventHeader;
  77. ETW_BUFFER_CONTEXT BufferContext;
  78. USHORT ExtendedDataCount;
  79. USHORT UserDataLength;
  80. EVENT_HEADER_EXTENDED_DATA_ITEM *ExtendedData;
  81. void *UserData;
  82. void *UserContext;
  83. } EVENT_RECORD, *PEVENT_RECORD;
  84. typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
  85. [
  86. object,
  87. uuid(8cc97f40-9028-4ff3-9b62-7d1f79ca7bcb),
  88. local
  89. ]
  90. interface ITraceEvent : IUnknown
  91. {
  92. HRESULT Clone([out, retval] ITraceEvent **NewEvent);
  93. HRESULT GetUserContext([out, retval] void **UserContext);
  94. HRESULT GetEventRecord([out, retval] PEVENT_RECORD *EventRecord);
  95. HRESULT SetPayload([in, size_is(PayloadSize)] BYTE *Payload,
  96. [in] ULONG PayloadSize);
  97. HRESULT SetEventDescriptor([in] PCEVENT_DESCRIPTOR EventDescriptor);
  98. HRESULT SetProcessId([in] ULONG ProcessId);
  99. HRESULT SetProcessorIndex([in] ULONG ProcessorIndex);
  100. HRESULT SetThreadId([in] ULONG ThreadId);
  101. HRESULT SetThreadTimes([in] ULONG KernelTime,
  102. [in] ULONG UserTime);
  103. HRESULT SetActivityId([in] LPCGUID ActivityId);
  104. HRESULT SetTimeStamp([in] LARGE_INTEGER *TimeStamp);
  105. HRESULT SetProviderId([in] LPCGUID ProviderId);
  106. }
  107. interface ITraceRelogger;
  108. [
  109. object,
  110. uuid(3ed25501-593f-43e9-8f38-3ab46f5a4a52)
  111. ]
  112. interface ITraceEventCallback : IUnknown
  113. {
  114. HRESULT OnBeginProcessTrace([in] ITraceEvent *HeaderEvent,
  115. [in] ITraceRelogger *Relogger);
  116. HRESULT OnFinalizeProcessTrace([in] ITraceRelogger *Relogger);
  117. HRESULT OnEvent([in] ITraceEvent *Event,
  118. [in] ITraceRelogger *Relogger);
  119. }
  120. [
  121. object,
  122. uuid(f754ad43-3bcc-4286-8009-9c5da214e84e),
  123. local
  124. ]
  125. interface ITraceRelogger : IUnknown
  126. {
  127. HRESULT AddLogfileTraceStream([in] BSTR LogfileName,
  128. [in] void *UserContext,
  129. [out, retval] TRACEHANDLE *TraceHandle);
  130. HRESULT AddRealtimeTraceStream([in] BSTR LoggerName,
  131. [in] void *UserContext,
  132. [out, retval] TRACEHANDLE *TraceHandle);
  133. HRESULT RegisterCallback([in] ITraceEventCallback *Callback);
  134. HRESULT Inject([in] ITraceEvent *Event);
  135. HRESULT CreateEventInstance([in] TRACEHANDLE TraceHandle,
  136. [in] ULONG Flags,
  137. [out, retval] ITraceEvent **Event);
  138. HRESULT ProcessTrace();
  139. HRESULT SetOutputFilename([in] BSTR LogfileName);
  140. HRESULT SetCompressionMode([in] BOOLEAN CompressionMode);
  141. HRESULT Cancel();
  142. }
  143. [
  144. uuid(7b40792d-05ff-44c4-9058-f440c71f17d4),
  145. threading(both)
  146. ]
  147. coclass CTraceRelogger
  148. {
  149. [default] interface ITraceRelogger;
  150. }