本文整理汇总了C#中System.Diagnostics.Eventing.EventDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# EventDescriptor类的具体用法?C# EventDescriptor怎么用?C# EventDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventDescriptor类属于System.Diagnostics.Eventing命名空间,在下文中一共展示了EventDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteEvent
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, Guid value1, string value2, string value3)
{
const int argumentCount = 3;
bool status = true;
//check all strings for null
value2 = (value2 ?? string.Empty);
value3 = (value3 ?? string.Empty);
fixed (char* string1Bytes = value2, string2Bytes = value3)
{
byte* eventData = stackalloc byte[sizeof(UnsafeNativeMethods.EventData) * argumentCount];
UnsafeNativeMethods.EventData* eventDataPtr = (UnsafeNativeMethods.EventData*)eventData;
eventDataPtr[0].DataPointer = (ulong)(&value1);
eventDataPtr[0].Size = (uint)(sizeof(Guid));
eventDataPtr[1].DataPointer = (ulong)string1Bytes;
eventDataPtr[1].Size = (uint)(value2.Length + 1) * sizeof(char);
eventDataPtr[2].DataPointer = (ulong)string2Bytes;
eventDataPtr[2].Size = (uint)(value3.Length + 1) * sizeof(char);
status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(eventData));
}
return status;
}
示例2: PowwaEvents
static PowwaEvents()
{
PowwaEvents.m_provider = new EventProviderVersionTwo(new Guid("ead6595b-5613-414c-a5ee-069bb1eca485"));
PowwaEvents.EVENT_AUTHENTICATION_FAILURE = new EventDescriptor(0x101, 0, 16, 4, 0, 1, -9223372036854775800L);
PowwaEvents.EVENT_AUTHORIZATION_FAILURE = new EventDescriptor(0x102, 0, 16, 4, 0, 2, -9223372036854775792L);
PowwaEvents.EVENT_GATEWAY_AUTHORIZATION_FAILURE = new EventDescriptor(0x103, 0, 16, 4, 0, 2, -9223372036854775792L);
PowwaEvents.EVENT_SESSION_LIMIT_REACHED = new EventDescriptor(0x104, 0, 16, 4, 0, 12, -9223372036854775792L);
PowwaEvents.EVENT_LOGON_FAILURE = new EventDescriptor(0x105, 0, 16, 4, 0, 13, -9223372036854775800L);
PowwaEvents.EVENT_AUTHORIZATION_FAILURE_INVALID_RULES = new EventDescriptor(0x10b, 0, 16, 3, 0, 2, -9223372036854775792L);
PowwaEvents.EVENT_PSRCONNECTION_FAILURE = new EventDescriptor(0x201, 0, 16, 4, 0, 13, -9223372036854775806L);
PowwaEvents.EVENT_PSREXECUTION_FAILURE = new EventDescriptor(0x202, 0, 16, 4, 0, 5, -9223372036854775806L);
PowwaEvents.EVENT_SESSION_START = new EventDescriptor(0x301, 0, 16, 4, 1, 3, -9223372036854775806L);
PowwaEvents.EVENT_SESSION_END = new EventDescriptor(0x302, 0, 16, 4, 2, 3, -9223372036854775806L);
PowwaEvents.EVENT_TERMINATE_SESSION_ERROR = new EventDescriptor(0x307, 0, 16, 2, 0, 3, -9223372036854775806L);
PowwaEvents.EVENT_GENERIC_FAILURE = new EventDescriptor(0x401, 0, 16, 4, 0, 6, -9223372036854775808L);
PowwaEvents.EVENT_ACTIVITYID_TRANSFER = new EventDescriptor(0x402, 0, 16, 4, 0, 7, -9223372036854775808L);
PowwaEvents.EVENT_INVALID_APPLICATION_SETTING = new EventDescriptor(0x501, 0, 16, 2, 0, 14, -9223372036854775808L);
PowwaEvents.EVENT_INVALID_SESSION_KEY = new EventDescriptor(0x601, 0, 16, 2, 0, 3, -9223372036854775807L);
PowwaEvents.EVENT_INVALID_SESSION_USER = new EventDescriptor(0x602, 0, 16, 2, 0, 3, -9223372036854775807L);
PowwaEvents.EVENT_MALICIOUS_DATA = new EventDescriptor(0x603, 0, 16, 2, 0, 3, -9223372036854775807L);
PowwaEvents.EVENT_AUTHENTICATION_START = new EventDescriptor(0x106, 0, 18, 4, 1, 1, 0x2000000000000008L);
PowwaEvents.EVENT_AUTHENTICATION_STOP = new EventDescriptor(0x107, 0, 18, 4, 2, 1, 0x2000000000000008L);
PowwaEvents.EVENT_GATEWAY_AUTHORIZATION_START = new EventDescriptor(0x108, 0, 18, 4, 1, 2, 0x2000000000000010L);
PowwaEvents.EVENT_GATEWAY_AUTHORIZATION_STOP = new EventDescriptor(0x109, 0, 18, 4, 2, 2, 0x2000000000000010L);
PowwaEvents.EVENT_SESSION_LIMIT_CHECK = new EventDescriptor(0x10a, 0, 18, 4, 0, 12, 0x2000000000000008L);
PowwaEvents.EVENT_DEBUG_CONNECT_USING_COMPUTERNAME = new EventDescriptor(0x303, 0, 17, 4, 0, 3, 0x4000000000000002L);
PowwaEvents.EVENT_DEBUG_CONNECT_USING_URI = new EventDescriptor(0x304, 0, 17, 4, 0, 3, 0x4000000000000002L);
PowwaEvents.EVENT_DEBUG_LOG0 = new EventDescriptor(0x403, 0, 17, 4, 0, 8, 0x4000000000000000L);
PowwaEvents.EVENT_DEBUG_LOG1 = new EventDescriptor(0x404, 0, 17, 4, 0, 8, 0x4000000000000000L);
PowwaEvents.EVENT_DEBUG_LOG2 = new EventDescriptor(0x405, 0, 17, 4, 0, 8, 0x4000000000000000L);
}
示例3: ProviderJyTrace
static ProviderJyTrace()
{
unchecked
{
FunctionEntry = new EventDescriptor(0x65, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x1);
FunctionExit = new EventDescriptor(0x66, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x1);
InfoW = new EventDescriptor(0x67, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
ErrorW = new EventDescriptor(0x68, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
InfoA = new EventDescriptor(0x69, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
ErrorA = new EventDescriptor(0x6a, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
WideStrInfo = new EventDescriptor(0x6b, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
WideStrError = new EventDescriptor(0x6c, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
AnsiStrInfo = new EventDescriptor(0x6d, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
AnsiStrError = new EventDescriptor(0x6e, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
HresultError = new EventDescriptor(0x6f, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
LastError = new EventDescriptor(0x70, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
PointerInfo = new EventDescriptor(0x71, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
PointerError = new EventDescriptor(0x72, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
NumberInfo = new EventDescriptor(0x73, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
NumberError = new EventDescriptor(0x74, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
HexInfo = new EventDescriptor(0x75, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
HexError = new EventDescriptor(0x76, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
BoolInfo = new EventDescriptor(0x77, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
BoolError = new EventDescriptor(0x78, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
GuidInfo = new EventDescriptor(0x79, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
GuidError = new EventDescriptor(0x7a, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
FloatInfo = new EventDescriptor(0x7b, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
FloatError = new EventDescriptor(0x7c, 0x0, 0x0, 0x2, 0x0, 0x0, (long)0x2);
Simple = new EventDescriptor(0x7d, 0x0, 0x0, 0x5, 0x0, 0x0, (long)0x2);
}
}
示例4: WriteEventHelper
private void WriteEventHelper(int eventId)
{
if (this.provider != null)
{
EventDescriptor descriptor = new EventDescriptor(eventId, 0, 0, 0, 0, 0, 0);
this.provider.WriteEvent(ref descriptor);
}
}
示例5: TEST_SUITE_EVENTS
public TEST_SUITE_EVENTS()
{
unchecked
{
TestSuiteLog = new EventDescriptor(0x1, 0x0, 0x9, 0x4, 0x0, 0x0, (long)0x8000000000000000);
RawMessage = new EventDescriptor(0x2, 0x0, 0x9, 0x4, 0x0, 0x0, (long)0x8000000000000000);
}
}
示例6: EnsureEventDescriptors
private static void EnsureEventDescriptors()
{
if (object.ReferenceEquals(TD.eventDescriptors, null))
{
EventDescriptor[] eventDescriptors = new EventDescriptor[] { new EventDescriptor(0x1069, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0x106a, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0x106b, 0, 0x13, 2, 0, 0, 0x1000000000000000L), new EventDescriptor(0x106d, 0, 0x13, 2, 0, 0, 0x1000000000000000L), new EventDescriptor(0x106e, 0, 0x13, 2, 0, 0, 0x1000000000000000L), new EventDescriptor(0x106f, 0, 0x13, 4, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1070, 0, 0x13, 4, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1071, 0, 0x13, 2, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1072, 0, 0x13, 3, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1074, 0, 0x13, 3, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1073, 0, 0x13, 3, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1075, 0, 0x13, 2, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1076, 0, 0x13, 2, 0, 0, 0x1000000000000000L) };
FxTrace.UpdateEventDefinitions(eventDescriptors);
TD.eventDescriptors = eventDescriptors;
}
}
示例7: EtwEventCorrelator
public EtwEventCorrelator(EventProvider transferProvider, EventDescriptor transferEvent)
{
if (transferProvider == null)
{
throw new ArgumentNullException("transferProvider");
}
this._transferProvider = transferProvider;
this._transferEvent = transferEvent;
}
示例8: MicrosoftWindowsSDKSampleSimpleProviderCs
public MicrosoftWindowsSDKSampleSimpleProviderCs()
{
unchecked
{
SampleEvt_INT32 = new EventDescriptor(0x65, 0x0, 0x9, 0x4, 0x0, 0x0, (long)0x8000000000000000);
SampleEvt_Float = new EventDescriptor(0x66, 0x0, 0x10, 0x3, 0x0, 0x0, (long)0x4000000000000000);
SampleEvt_Bool = new EventDescriptor(0x67, 0x0, 0x10, 0x2, 0x0, 0x0, (long)0x4000000000000000);
SampleEvt_UnicodeString = new EventDescriptor(0x68, 0x0, 0x9, 0x1, 0x0, 0x0, (long)0x8000000000000000);
SampleEvt_Guid = new EventDescriptor(0x69, 0x0, 0x9, 0x1, 0x0, 0x0, (long)0x8000000000000000);
}
}
示例9: LogToEtw
private void LogToEtw(TraceEventType eventType, int id, string eventMessage)
{
EtwEventLevel level = this.ConvertTraceEventTypeToEventLevel(eventType);
EventDescriptor eventDescriptor = new EventDescriptor(0xf01c, 0, 0, (byte)level, 0, 0, 0L); // From DiagnosticMonitorTraceListener
try
{
this.m_eventProvider.WriteEvent(ref eventDescriptor, new object[] { (ulong)id, eventMessage });
}
catch (ArgumentException)
{
}
catch (System.ComponentModel.Win32Exception)
{
}
}
示例10: Trace
private bool Trace(PowerShellTraceEvent traceEvent, PowerShellTraceLevel level, PowerShellTraceOperationCode operationCode, PowerShellTraceTask task, params object[] args)
{
EventDescriptor eventDescriptor = new EventDescriptor((int) traceEvent, 1, (byte) this._traceChannel, (byte) level, (byte) operationCode, (int) task, (long) this._keywords);
if (args != null)
{
for (int i = 0; i < args.Length; i++)
{
if (args[i] == null)
{
args[i] = string.Empty;
}
}
}
return _provider.WriteEvent(ref eventDescriptor, args);
}
示例11: CalculatorServiceEventProvider
public CalculatorServiceEventProvider()
{
Guid providerId;
if (HostingEnvironment.IsHosted) {
DiagnosticSection config = (DiagnosticSection)WebConfigurationManager.GetSection(DiagnosticsConfigSectionName);
providerId = new Guid(config.EtwProviderId);
hostReferenceIsComplete = false;
} else {
DiagnosticSection config = (DiagnosticSection)ConfigurationManager.GetSection(DiagnosticsConfigSectionName);
providerId = new Guid(config.EtwProviderId);
hostReference = string.Empty;
hostReferenceIsComplete = true;
}
innerEventProvider = new EventProvider(providerId);
errorDescriptor = new EventDescriptor(ErrorEventId, Version, Channel, ErrorLevel, Opcode, Task, Keywords);
warningDescriptor = new EventDescriptor(WarningEventId, Version, Channel, WarningLevel, Opcode, Task, Keywords);
infoDescriptor = new EventDescriptor(InfoEventId, Version, Channel, InfoLevel, Opcode, Task, Keywords);
}
示例12: TemplateT_POINTER
internal unsafe bool TemplateT_POINTER(
ref EventDescriptor eventDescriptor,
IntPtr Prop_Pointer
)
{
int argumentCount = 1;
bool status = true;
if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
{
byte* userData = stackalloc byte[sizeof(EventData) * argumentCount];
EventData* userDataPtr = (EventData*)userData;
userDataPtr[0].DataPointer = (UInt64)(&Prop_Pointer);
userDataPtr[0].Size = (uint)(sizeof(IntPtr) );
status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(userData));
}
return status;
}
示例13: WriteImpl
private void WriteImpl(TraceSeverity level, Payload payload)
{
EventDescriptor descriptor = new EventDescriptor(0, 0, 0, (byte)level, 0, 0, 0);
using (EVENT_DATA_DESCRIPTOR data = new EVENT_DATA_DESCRIPTOR(payload))
using (DataDescriptorWrapper wrapper = new DataDescriptorWrapper(data))
{
bool fResult = WriteEvent(ref descriptor, 1, wrapper.Ptr);
if (!fResult)
Console.WriteLine("Failed to call WriteEvent for real payload {0}", Marshal.GetLastWin32Error());
}
}
示例14: MicrosoftWindowsSDKSampleAdvancedProviderCs
public MicrosoftWindowsSDKSampleAdvancedProviderCs()
{
unchecked
{
SampleEvt_INT8 = new EventDescriptor(0x66, 0x0, 0x8, 0x1, 0x1, 0x64, (long)0x8000000000000000);
SampleEvt_UINT8 = new EventDescriptor(0x67, 0x0, 0x8, 0x1, 0x2, 0x64, (long)0x8040000000000000);
SampleEvt_UINT8_HEXINT8 = new EventDescriptor(0x68, 0x0, 0x8, 0x1, 0x0, 0x64, (long)0x8000000000000000);
SampleEvt_INT16 = new EventDescriptor(0x69, 0x0, 0x8, 0x1, 0x7, 0x64, (long)0x8000000000000000);
SampleEvt_UINT16 = new EventDescriptor(0x6a, 0x0, 0x8, 0x1, 0x8, 0x64, (long)0x8000000000000000);
SampleEvt_UINT16_HexInt16 = new EventDescriptor(0x6b, 0x0, 0x8, 0x1, 0x9, 0x64, (long)0x8000000000000000);
SampleEvt_INT32 = new EventDescriptor(0x6c, 0x0, 0x8, 0x1, 0xf0, 0x64, (long)0x8000000000000000);
SampleEvt_UINT32 = new EventDescriptor(0x6d, 0x0, 0x8, 0x1, 0xa, 0x64, (long)0x8000000000000000);
SampleEvt_UINT32_PID = new EventDescriptor(0x6e, 0x0, 0x8, 0x1, 0xb, 0x64, (long)0x8000000000000000);
SampleEvt_UINT32_TID = new EventDescriptor(0x6f, 0x0, 0x8, 0x1, 0x1, 0x65, (long)0x8000000000000000);
SampleEvt_UINT32_IPV4 = new EventDescriptor(0x70, 0x0, 0x8, 0x1, 0x2, 0x65, (long)0x8000000000000000);
SampleEvt_UINT32_ERRORCODE = new EventDescriptor(0x72, 0x0, 0x8, 0x1, 0x0, 0x65, (long)0x8000000000000000);
SampleEvt_UINT32_HEXINT32 = new EventDescriptor(0x73, 0x0, 0x8, 0x1, 0x7, 0x65, (long)0x8000000000000000);
SampleEvt_INT64 = new EventDescriptor(0x74, 0x0, 0x8, 0x1, 0x8, 0x65, (long)0x8000000000000000);
SampleEvt_UINT64 = new EventDescriptor(0x75, 0x0, 0x8, 0x1, 0x9, 0x65, (long)0x8000000000000000);
SampleEvt_UINT64_HEXInt64 = new EventDescriptor(0x76, 0x0, 0x8, 0x1, 0xf0, 0x65, (long)0x8000000000000000);
SampleEvt_FLOAT = new EventDescriptor(0x77, 0x0, 0x8, 0x1, 0xa, 0x65, (long)0x8000000000000000);
SampleEvt_DOUBLE = new EventDescriptor(0x78, 0x0, 0x8, 0x1, 0xb, 0x65, (long)0x8000000000000000);
SampleEvt_BOOL = new EventDescriptor(0x79, 0x0, 0x8, 0x1, 0x1, 0x66, (long)0x8000000000000000);
SampleEvt_GUID = new EventDescriptor(0x7d, 0x0, 0x8, 0x1, 0x2, 0x66, (long)0x8000000000000000);
SampleEvt_POINTER = new EventDescriptor(0x7e, 0x0, 0x8, 0x1, 0x0, 0x66, (long)0x8000000000000000);
SampleEvt_FILETIME = new EventDescriptor(0x7f, 0x0, 0x8, 0x1, 0x7, 0x66, (long)0x8000000000000000);
SampleEvt_SID = new EventDescriptor(0x80, 0x0, 0x8, 0x1, 0x9, 0x66, (long)0x8000000000000000);
SampleEvt_UnicodeString = new EventDescriptor(0xc8, 0x0, 0x9, 0x4, 0xf0, 0x66, (long)0x4000000000000000);
SampleEvt_FixedLength_UnicodeString = new EventDescriptor(0xc9, 0x0, 0x9, 0x4, 0xb, 0x66, (long)0x4000000000000000);
SampleEvt_ParamLength_UnicodeString = new EventDescriptor(0xca, 0x0, 0x9, 0x4, 0x0, 0x67, (long)0x4000000000000000);
SampleEvt_UserChannel_UnicodeString = new EventDescriptor(0x258, 0x0, 0x11, 0x2, 0xe, 0x65, (long)0x1000000000000000);
SampleEvt_UserChannel_UINT8 = new EventDescriptor(0x259, 0x0, 0x11, 0x2, 0x5, 0x66, (long)0x1000000000000000);
SampleEvt_UserKeyword_UINT8 = new EventDescriptor(0x25a, 0x0, 0x11, 0x2, 0x6, 0x66, (long)0x1000000000000020);
SampleEvt_Alignment_UInt8_UnicodeString = new EventDescriptor(0x25b, 0x0, 0x11, 0x2, 0xc, 0x66, (long)0x1000000000000020);
SampleEvt_ValueMap_UInt8 = new EventDescriptor(0x25d, 0x0, 0x11, 0x2, 0xd, 0x66, (long)0x1000000000000020);
SampleEvt_BitMap_UInt8 = new EventDescriptor(0x25e, 0x0, 0x11, 0x2, 0xe, 0x66, (long)0x1000000000000020);
SampleEvt_UInt32_Win32Error = new EventDescriptor(0x2bc, 0x0, 0x11, 0x3, 0x5, 0x67, (long)0x1000000000000000);
SampleEvt_UInt32_NTSTATUS = new EventDescriptor(0x2bd, 0x0, 0x11, 0x3, 0x6, 0x67, (long)0x1000000000000000);
SampleEvt_Int32_HResult = new EventDescriptor(0x2be, 0x0, 0x11, 0x3, 0xc, 0x67, (long)0x1000000000000000);
SampleEvt_INT8_V1 = new EventDescriptor(0x66, 0x1, 0x8, 0x1, 0xd, 0x67, (long)0x8000000000000000);
SampleEvt_INT8_V2 = new EventDescriptor(0x66, 0x2, 0x8, 0x1, 0xe, 0x67, (long)0x8000000000000000);
SampleEvt_UnicodeString_V1 = new EventDescriptor(0xc8, 0x1, 0x9, 0x4, 0x5, 0x68, (long)0x4000000000000000);
SampleEvt_FixedCount_Int8_V1 = new EventDescriptor(0x12c, 0x1, 0x11, 0x3, 0x6, 0x68, (long)0x1000000000000000);
SampleEvt_FixedCount_Int8_V3 = new EventDescriptor(0x12c, 0x3, 0x11, 0x3, 0xc, 0x68, (long)0x1000000000000000);
SampleEvt_Int32_HResult_V2 = new EventDescriptor(0x2be, 0x2, 0x11, 0x3, 0xd, 0x68, (long)0x1000000000000000);
}
}
示例15: TemplateT_ParamLength_UnicodeString
internal unsafe bool TemplateT_ParamLength_UnicodeString(
ref EventDescriptor eventDescriptor,
uint Prop_ParamLength_UnicodString_Length,
string Prop_ParamLength_UnicodeString
)
{
int argumentCount = 2;
bool status = true;
if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
{
byte* userData = stackalloc byte[sizeof(EventData) * argumentCount];
EventData* userDataPtr = (EventData*)userData;
userDataPtr[0].DataPointer = (UInt64)(&Prop_ParamLength_UnicodString_Length);
userDataPtr[0].Size = (uint)(sizeof(int) );
userDataPtr[1].Size = (uint)(sizeof(char)*Prop_ParamLength_UnicodString_Length);
fixed (char* a0 = Prop_ParamLength_UnicodeString)
{
userDataPtr[1].DataPointer = (ulong)a0;
status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(userData));
}
}
return status;
}