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);
     }
 }
Exemple #2
0
 public void WriteTraceSource(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload)
 {
     if (this.TracingEnabled)
     {
         XPathNavigator data = null;
         try
         {
             string      xml      = BuildTrace(ref eventDescriptor, description, payload);
             XmlDocument document = new XmlDocument();
             document.LoadXml(xml);
             data = document.CreateNavigator();
             this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), eventDescriptor.EventId, data);
             if (this.calledShutdown)
             {
                 this.TraceSource.Flush();
             }
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             this.LogTraceFailure((data == null) ? string.Empty : data.ToString(), exception);
         }
     }
 }
Exemple #3
0
		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);
		}
Exemple #4
0
        private static string BuildTrace(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload)
        {
            StringBuilder stringBuilder = new StringBuilder();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(new StringWriter(stringBuilder, CultureInfo.CurrentCulture));

            xmlTextWriter.WriteStartElement("TraceRecord");
            xmlTextWriter.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord");
            xmlTextWriter.WriteAttributeString("Severity", TraceLevelHelper.LookupSeverity((TraceEventLevel)eventDescriptor.Level, (TraceEventOpcode)eventDescriptor.Opcode));
            xmlTextWriter.WriteAttributeString("Channel", DiagnosticTrace.LookupChannel((TraceChannel)eventDescriptor.Channel));
            xmlTextWriter.WriteElementString("TraceIdentifier", DiagnosticTrace.GenerateTraceCode(ref eventDescriptor));
            xmlTextWriter.WriteElementString("Description", description);
            xmlTextWriter.WriteElementString("AppDomain", payload.AppDomainFriendlyName);
            if (!string.IsNullOrEmpty(payload.EventSource))
            {
                xmlTextWriter.WriteElementString("Source", payload.EventSource);
            }
            if (!string.IsNullOrEmpty(payload.ExtendedData))
            {
                xmlTextWriter.WriteRaw(payload.ExtendedData);
            }
            if (!string.IsNullOrEmpty(payload.SerializedException))
            {
                xmlTextWriter.WriteRaw(payload.SerializedException);
            }
            xmlTextWriter.WriteEndElement();
            return(stringBuilder.ToString());
        }
Exemple #5
0
        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;
        }
 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);
     }
 }
Exemple #7
0
 public void Event(int eventId, TraceEventLevel traceEventLevel, TraceChannel channel, string description)
 {
     if (this.TracingEnabled)
     {
         System.Diagnostics.Eventing.EventDescriptor eventDescriptor = DiagnosticTrace.GetEventDescriptor(eventId, channel, traceEventLevel);
         this.Event(ref eventDescriptor, description);
     }
 }
Exemple #8
0
 public void Event(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description)
 {
     if (this.TracingEnabled)
     {
         TracePayload serializedPayload = DiagnosticTrace.GetSerializedPayload(null, null, null);
         this.WriteTraceSource(ref eventDescriptor, description, serializedPayload);
     }
 }
Exemple #9
0
 public bool IsEtwEventEnabled(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor)
 {
     if (!this.EtwTracingEnabled)
     {
         return(false);
     }
     return(this.etwProvider.IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords));
 }
 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);
     }
 }
Exemple #11
0
 public EtwEventCorrelator(EventProvider transferProvider, EventDescriptor transferEvent)
 {
     if (transferProvider == null)
     {
         throw new ArgumentNullException("transferProvider");
     }
     this._transferProvider = transferProvider;
     this._transferEvent = transferEvent;
 }
 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;
     }
 }
 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);
     }
 }
 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);
 }
 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)
     {
     }
 }
Exemple #16
0
        internal void WriteEvent(PSEventId id, PSChannel channel, PSOpcode opcode, PSLevel level, PSTask task, PSKeyword keyword, params object[] args)
        {
            long keywords = 0L;

            if ((keyword == PSKeyword.UseAlwaysAnalytic) || (keyword == PSKeyword.UseAlwaysOperational))
            {
                keywords = 0L;
            }
            else
            {
                keywords = (long)keyword;
            }
            System.Diagnostics.Eventing.EventDescriptor eventDescriptor = new System.Diagnostics.Eventing.EventDescriptor((int)id, 1, (byte)channel, (byte)level, (byte)opcode, (int)task, keywords);
            etwProvider.WriteEvent(ref eventDescriptor, args);
        }
        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);
        }
Exemple #18
0
 public void WriteTraceSource(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload)
 {
     if (this.TracingEnabled)
     {
         XPathNavigator xPathNavigator = null;
         try
         {
             string            str              = DiagnosticTrace.BuildTrace(ref eventDescriptor, description, payload);
             XmlDocument       xmlDocument      = new XmlDocument();
             StringReader      stringReader     = new StringReader(str);
             XmlReaderSettings xmlReaderSetting = new XmlReaderSettings()
             {
                 DtdProcessing = DtdProcessing.Prohibit
             };
             using (XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSetting))
             {
                 xmlDocument.Load(xmlReader);
             }
             xPathNavigator = xmlDocument.CreateNavigator();
             this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), eventDescriptor.EventId, xPathNavigator);
             if (this.calledShutdown)
             {
                 this.TraceSource.Flush();
             }
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             this.LogTraceFailure((xPathNavigator == null ? string.Empty : xPathNavigator.ToString()), exception);
         }
     }
 }
 protected bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, int dataCount, IntPtr data)
 {
   return default(bool);
 }
Exemple #20
0
        public bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, params object[] eventPayload)
        {
            uint status = 0;

            if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
            {
                Guid activityId = GetActivityId();

                unsafe
                {
                    int        argCount    = 0;
                    EventData *userDataPtr = null;

                    if ((eventPayload != null) && (eventPayload.Length != 0))
                    {
                        argCount = eventPayload.Length;
                        if (argCount > s_etwMaxNumberArguments)
                        {
                            //
                            // too many arguments to log
                            //
                            throw new ArgumentOutOfRangeException("eventPayload",
                                                                  string.Format(CultureInfo.CurrentCulture, DotNetEventingStrings.ArgumentOutOfRange_MaxArgExceeded, s_etwMaxNumberArguments));
                        }

                        uint       totalEventSize = 0;
                        int        index;
                        int        stringIndex    = 0;
                        int[]      stringPosition = new int[s_etwAPIMaxStringCount];                       // used to keep the position of strings in the eventPayload parameter
                        string[]   dataString     = new string[s_etwAPIMaxStringCount];                    // string arrays from the eventPayload parameter
                        EventData *userData       = stackalloc EventData[argCount];                        // allocation for the data descriptors
                        userDataPtr = (EventData *)userData;
                        byte *dataBuffer    = stackalloc byte[s_basicTypeAllocationBufferSize * argCount]; // 16 byte for unboxing non-string argument
                        byte *currentBuffer = dataBuffer;

                        //
                        // The loop below goes through all the arguments and fills in the data
                        // descriptors. For strings save the location in the dataString array.
                        // Calculates the total size of the event by adding the data descriptor
                        // size value set in EncodeObjec method.
                        //
                        for (index = 0; index < eventPayload.Length; index++)
                        {
                            string isString;
                            isString        = EncodeObject(ref eventPayload[index], userDataPtr, currentBuffer);
                            currentBuffer  += s_basicTypeAllocationBufferSize;
                            totalEventSize += userDataPtr->Size;
                            userDataPtr++;
                            if (isString != null)
                            {
                                if (stringIndex < s_etwAPIMaxStringCount)
                                {
                                    dataString[stringIndex]     = isString;
                                    stringPosition[stringIndex] = index;
                                    stringIndex++;
                                }
                                else
                                {
                                    throw new ArgumentOutOfRangeException("eventPayload",
                                                                          string.Format(CultureInfo.CurrentCulture, DotNetEventingStrings.ArgumentOutOfRange_MaxStringsExceeded, s_etwAPIMaxStringCount));
                                }
                            }
                        }

                        if (totalEventSize > s_traceEventMaximumSize)
                        {
                            t_returnCode = WriteEventErrorCode.EventTooBig;
                            return(false);
                        }

                        fixed(char *v0 = dataString[0], v1 = dataString[1], v2 = dataString[2], v3 = dataString[3],
                              v4       = dataString[4], v5 = dataString[5], v6 = dataString[6], v7 = dataString[7])
                        {
                            userDataPtr = (EventData *)userData;
                            if (dataString[0] != null)
                            {
                                userDataPtr[stringPosition[0]].DataPointer = (ulong)v0;
                            }

                            if (dataString[1] != null)
                            {
                                userDataPtr[stringPosition[1]].DataPointer = (ulong)v1;
                            }

                            if (dataString[2] != null)
                            {
                                userDataPtr[stringPosition[2]].DataPointer = (ulong)v2;
                            }

                            if (dataString[3] != null)
                            {
                                userDataPtr[stringPosition[3]].DataPointer = (ulong)v3;
                            }

                            if (dataString[4] != null)
                            {
                                userDataPtr[stringPosition[4]].DataPointer = (ulong)v4;
                            }

                            if (dataString[5] != null)
                            {
                                userDataPtr[stringPosition[5]].DataPointer = (ulong)v5;
                            }

                            if (dataString[6] != null)
                            {
                                userDataPtr[stringPosition[6]].DataPointer = (ulong)v6;
                            }

                            if (dataString[7] != null)
                            {
                                userDataPtr[stringPosition[7]].DataPointer = (ulong)v7;
                            }
                        }
                    }

                    status = UnsafeNativeMethods.EventWriteTransfer(_regHandle,
                                                                    ref eventDescriptor,
                                                                    (activityId == Guid.Empty) ? null : &activityId,
                                                                    (relatedActivityId == Guid.Empty) ? null : &relatedActivityId,
                                                                    (uint)argCount,
                                                                    userDataPtr);
                }
            }

            if (status != 0)
            {
                SetLastError((int)status);
                return(false);
            }

            return(true);
        }
Exemple #21
0
 internal static extern unsafe uint EventWriteTransfer([In] long registrationHandle, [In] ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, [In] ref Guid activityId, [In] ref Guid relatedActivityId, [In] uint userDataCount, [In] UnsafeNativeMethods.EventData *userData);
        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;
        }
 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);
     }
 }
        internal unsafe bool TemplateT_FILETIME(
            ref EventDescriptor eventDescriptor,
            DateTime Prop_FileTime
            )
        {
            int argumentCount = 1;
            bool status = true;

            if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
            {
                byte* userData = stackalloc byte[sizeof(EventData) * argumentCount];
                EventData* userDataPtr = (EventData*)userData;

                long Prop_FileTimeFileTime = Prop_FileTime.ToFileTime();
                userDataPtr[0].DataPointer = (UInt64)(&Prop_FileTimeFileTime);
                userDataPtr[0].Size = (uint)(sizeof(long));

                status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(userData));
            }

            return status;
        }
 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());
     }
 }
 public bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, Object[] eventPayload)
 {
     return(default(bool));
 }
Exemple #27
0
        internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, string value1, string value2, string value3, string value4,
            string value5, string value6, string value7, string value8, string value9, string value10, string value11)
        {
            const int argumentCount = 11;
            bool status = true;

            //check all strings for null
            value1 = (value1 ?? string.Empty);
            value2 = (value2 ?? string.Empty);
            value3 = (value3 ?? string.Empty);
            value4 = (value4 ?? string.Empty);
            value5 = (value5 ?? string.Empty);
            value6 = (value6 ?? string.Empty);
            value7 = (value7 ?? string.Empty);
            value8 = (value8 ?? string.Empty);
            value9 = (value9 ?? string.Empty);
            value10 = (value10 ?? string.Empty);
            value11 = (value11 ?? string.Empty);

            fixed (char* string1Bytes = value1, string2Bytes = value2, string3Bytes = value3, string4Bytes = value4, string5Bytes = value5, string6Bytes = value6,
            string7Bytes = value7, string8Bytes = value8, string9Bytes = value9, string10Bytes = value10, string11Bytes = value11)
            {
                byte* eventData = stackalloc byte[sizeof(UnsafeNativeMethods.EventData) * argumentCount];
                UnsafeNativeMethods.EventData* eventDataPtr = (UnsafeNativeMethods.EventData*)eventData;

                eventDataPtr[0].DataPointer = (ulong)string1Bytes;
                eventDataPtr[0].Size = (uint)(value1.Length + 1) * sizeof(char);

                eventDataPtr[1].DataPointer = (ulong)string2Bytes;
                eventDataPtr[1].Size = (uint)(value2.Length + 1) * sizeof(char);

                eventDataPtr[2].DataPointer = (ulong)string3Bytes;
                eventDataPtr[2].Size = (uint)(value3.Length + 1) * sizeof(char);

                eventDataPtr[3].DataPointer = (ulong)string4Bytes;
                eventDataPtr[3].Size = (uint)(value4.Length + 1) * sizeof(char);

                eventDataPtr[4].DataPointer = (ulong)string5Bytes;
                eventDataPtr[4].Size = (uint)(value5.Length + 1) * sizeof(char);

                eventDataPtr[5].DataPointer = (ulong)string6Bytes;
                eventDataPtr[5].Size = (uint)(value6.Length + 1) * sizeof(char);

                eventDataPtr[6].DataPointer = (ulong)string7Bytes;
                eventDataPtr[6].Size = (uint)(value7.Length + 1) * sizeof(char);

                eventDataPtr[7].DataPointer = (ulong)string8Bytes;
                eventDataPtr[7].Size = (uint)(value8.Length + 1) * sizeof(char);

                eventDataPtr[8].DataPointer = (ulong)string9Bytes;
                eventDataPtr[8].Size = (uint)(value9.Length + 1) * sizeof(char);

                eventDataPtr[9].DataPointer = (ulong)string10Bytes;
                eventDataPtr[9].Size = (uint)(value10.Length + 1) * sizeof(char);

                eventDataPtr[10].DataPointer = (ulong)string11Bytes;
                eventDataPtr[10].Size = (uint)(value11.Length + 1) * sizeof(char);

                status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(eventData));
            }

            return status;
        }
 protected bool WriteEvent(ref EventDescriptor eventDescriptor, int dataCount, IntPtr data)
 {
     return(default(bool));
 }
Exemple #29
0
 /// <summary>
 /// WriteEvent method to write parameters with event schema properties.
 /// </summary>
 /// <param name="eventDescriptor">
 /// Event Descriptor for this event.
 /// </param>
 /// <param name="eventPayload">
 /// </param>
 public bool WriteEvent(ref EventDescriptor eventDescriptor, params object[] eventPayload)
 {
     return(WriteTransferEvent(ref eventDescriptor, Guid.Empty, eventPayload));
 }
Exemple #30
0
 internal static extern unsafe uint EventWrite([In] long registrationHandle, [In] ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, [In] uint userDataCount, [In] UnsafeNativeMethods.EventData *userData);
 protected bool WriteEvent(ref EventDescriptor eventDescriptor, int dataCount, IntPtr data)
 {
   return default(bool);
 }
Exemple #32
0
        internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, long value1, long value2, long value3)
        {
            const int argumentCount = 3;
            bool status = true;

            {
                byte* eventData = stackalloc byte[sizeof(UnsafeNativeMethods.EventData) * argumentCount];
                UnsafeNativeMethods.EventData* eventDataPtr = (UnsafeNativeMethods.EventData*)eventData;

                eventDataPtr[0].DataPointer = (UInt64)(&value1);
                eventDataPtr[0].Size = (uint)(sizeof(long));

                eventDataPtr[1].DataPointer = (UInt64)(&value2);
                eventDataPtr[1].Size = (uint)(sizeof(long));

                eventDataPtr[2].DataPointer = (UInt64)(&value3);
                eventDataPtr[2].Size = (uint)(sizeof(long));

                status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(eventData));
            }

            return status;
        }
 public bool WriteEvent(ref EventDescriptor eventDescriptor, string data)
 {
   return default(bool);
 }
Exemple #34
0
        internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, Guid value1, long value2, long value3, string value4,
            string value5, string value6, string value7, string value8, string value9, string value10, string value11, string value12,
            bool value13, string value14, string value15, string value16, string value17)
        {
            const int argumentCount = 17;
            bool status = true;

            //check all strings for null
            value4 = (value4 ?? string.Empty);
            value5 = (value5 ?? string.Empty);
            value6 = (value6 ?? string.Empty);
            value7 = (value7 ?? string.Empty);
            value8 = (value8 ?? string.Empty);
            value9 = (value9 ?? string.Empty);
            value10 = (value10 ?? string.Empty);
            value11 = (value11 ?? string.Empty);
            value12 = (value12 ?? string.Empty);
            //value13 is not string
            value14 = (value14 ?? string.Empty);
            value15 = (value15 ?? string.Empty);
            value16 = (value16 ?? string.Empty);
            value17 = (value17 ?? string.Empty);

            fixed (char* string1Bytes = value4, string2Bytes = value5, string3Bytes = value6, string4Bytes = value7, string5Bytes = value8, string6Bytes = value9,
            string7Bytes = value10, string8Bytes = value11, string9Bytes = value12, string10Bytes = value14, string11Bytes = value15,
            string12Bytes = value16, string13Bytes = value17)
            {
                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)(&value2);
                eventDataPtr[1].Size = (uint)(sizeof(long));

                eventDataPtr[2].DataPointer = (ulong)(&value3);
                eventDataPtr[2].Size = (uint)(sizeof(long));

                eventDataPtr[3].DataPointer = (ulong)string1Bytes;
                eventDataPtr[3].Size = (uint)(value4.Length + 1) * sizeof(char);

                eventDataPtr[4].DataPointer = (ulong)string2Bytes;
                eventDataPtr[4].Size = (uint)(value5.Length + 1) * sizeof(char);

                eventDataPtr[5].DataPointer = (ulong)string3Bytes;
                eventDataPtr[5].Size = (uint)(value6.Length + 1) * sizeof(char);

                eventDataPtr[6].DataPointer = (ulong)string4Bytes;
                eventDataPtr[6].Size = (uint)(value7.Length + 1) * sizeof(char);

                eventDataPtr[7].DataPointer = (ulong)string5Bytes;
                eventDataPtr[7].Size = (uint)(value8.Length + 1) * sizeof(char);

                eventDataPtr[8].DataPointer = (ulong)string6Bytes;
                eventDataPtr[8].Size = (uint)(value9.Length + 1) * sizeof(char);

                eventDataPtr[9].DataPointer = (ulong)string7Bytes;
                eventDataPtr[9].Size = (uint)(value10.Length + 1) * sizeof(char);

                eventDataPtr[10].DataPointer = (ulong)string8Bytes;
                eventDataPtr[10].Size = (uint)(value11.Length + 1) * sizeof(char);

                eventDataPtr[11].DataPointer = (ulong)string9Bytes;
                eventDataPtr[11].Size = (uint)(value12.Length + 1) * sizeof(char);

                eventDataPtr[12].DataPointer = (ulong)(&value13);
                eventDataPtr[12].Size = (uint)(sizeof(bool));

                eventDataPtr[13].DataPointer = (ulong)string10Bytes;
                eventDataPtr[13].Size = (uint)(value14.Length + 1) * sizeof(char);

                eventDataPtr[14].DataPointer = (ulong)string11Bytes;
                eventDataPtr[14].Size = (uint)(value15.Length + 1) * sizeof(char);

                eventDataPtr[15].DataPointer = (ulong)string12Bytes;
                eventDataPtr[15].Size = (uint)(value16.Length + 1) * sizeof(char);

                eventDataPtr[16].DataPointer = (ulong)string13Bytes;
                eventDataPtr[16].Size = (uint)(value17.Length + 1) * sizeof(char);

                status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(eventData));
            }

            return status;
        }
        internal unsafe bool TemplateT_SID(
            ref EventDescriptor eventDescriptor,
            SecurityIdentifier Prop_SID
            )
        {
            int argumentCount = 1;
            bool status = true;

            if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords))
            {
                byte* userData = stackalloc byte[sizeof(EventData) * argumentCount];
                EventData* userDataPtr = (EventData*)userData;

                byte [] Prop_SIDBin = new byte[Prop_SID.BinaryLength];
                Prop_SID.GetBinaryForm(Prop_SIDBin, 0);
                userDataPtr[0].Size = (uint)(Prop_SID.BinaryLength);

                fixed (byte* a0 = Prop_SIDBin)
                {
                    userDataPtr[0].DataPointer = (ulong)a0;
                    status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(userData));
                }
            }

            return status;
        }
Exemple #36
0
 private static string GenerateTraceCode(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor)
 {
     return(eventDescriptor.EventId.ToString(CultureInfo.InvariantCulture));
 }
        internal unsafe bool TemplateT_FixedCount_Int8(
            ref EventDescriptor eventDescriptor,
            sbyte[] Prop_FixedCount_Int8
            )
        {
            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].Size = (uint)(sizeof(byte)*15);

                fixed (sbyte* a0 = Prop_FixedCount_Int8)
                {
                    userDataPtr[0].DataPointer = (ulong)a0;
                    status = WriteEvent(ref eventDescriptor, argumentCount, (IntPtr)(userData));
                }
            }

            return status;
        }
Exemple #38
0
        /// <summary>
        /// Writes an event
        /// </summary>
        /// <param name="id"></param>
        /// <param name="channel"></param>
        /// <param name="opcode"></param>
        /// <param name="level"></param>
        /// <param name="task"></param>
        /// <param name="keyword"></param>
        /// <param name="args"></param>
        internal void WriteEvent(PSEventId id, PSChannel channel, PSOpcode opcode, PSLevel level, PSTask task, PSKeyword keyword, params object[] args)
        {
            long longKeyword = 0x00;

            if (keyword == PSKeyword.UseAlwaysAnalytic ||
                keyword == PSKeyword.UseAlwaysOperational)
            {
                longKeyword = 0x00;
            }
            else
            {
                longKeyword = (long)keyword;
            }

            EventDescriptor desc = new EventDescriptor((int)id, (byte)PSEventVersion.One, (byte)channel,
                (byte)level, (byte)opcode, (int)task, longKeyword);

            etwProvider.WriteEvent(ref desc, args);
        }
        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;
        }
Exemple #40
0
 /// <summary>
 /// Creates a new instance of EtwEventArgs class.
 /// </summary>
 /// <param name="descriptor">Event descriptor</param>
 /// <param name="success">Indicate whether the event is successfully written</param>
 /// <param name="payload">Event payload</param>
 public EtwEventArgs(EventDescriptor descriptor, bool success, object[] payload)
 {
     this.Descriptor = descriptor;
     this.Payload = payload;
     this.Success = success;
 }
 protected bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, int dataCount, IntPtr data)
 {
     return(default(bool));
 }
 public bool WriteEvent(ref EventDescriptor eventDescriptor, string data)
 {
     return(default(bool));
 }
 private static void EnsureEventDescriptors()
 {
     if (object.ReferenceEquals(TD.eventDescriptors, null))
     {
         EventDescriptor[] eventDescriptors = new EventDescriptor[] { 
             new EventDescriptor(0x3ce8, 0, 0x13, 4, 0, 0, 0x1000000000000000L), new EventDescriptor(0x1f5, 0, 20, 4, 1, 0x9c5, 0x800000000000080L), new EventDescriptor(0x1f6, 0, 20, 4, 2, 0x9c5, 0x800000000000080L), new EventDescriptor(0x1f7, 0, 20, 4, 1, 0x9c6, 0x800000000000080L), new EventDescriptor(0x1f8, 0, 20, 4, 2, 0x9c6, 0x800000000000080L), new EventDescriptor(0x1f9, 0, 20, 4, 1, 0x9c7, 0x800000000000080L), new EventDescriptor(0x1fa, 0, 20, 4, 2, 0x9c7, 0x800000000000080L), new EventDescriptor(0x1fb, 0, 20, 4, 1, 0x9c8, 0x800000000000080L), new EventDescriptor(0x1fc, 0, 20, 4, 2, 0x9c8, 0x800000000000080L), new EventDescriptor(0x1ff, 0, 20, 4, 1, 0, 0x800000000000080L), new EventDescriptor(0x200, 0, 20, 4, 2, 0, 0x800000000000080L), new EventDescriptor(0x201, 0, 20, 4, 1, 0, 0x800000000000080L), new EventDescriptor(0x202, 0, 20, 4, 2, 0, 0x800000000000080L), new EventDescriptor(0x25b, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0x25c, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0xd5, 0, 0x12, 0, 0, 0, 0x20000000000e0001L), 
             new EventDescriptor(0x259, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0x25a, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0xde1, 0, 20, 4, 1, 0, 0x800000000000080L), new EventDescriptor(0xde2, 0, 20, 4, 2, 0, 0x800000000000080L), new EventDescriptor(0x25d, 0, 0x13, 5, 0, 0, 0x1000000000000000L), new EventDescriptor(0x25e, 0, 0x13, 5, 0, 0, 0x1000000000000000L)
          };
         FxTrace.UpdateEventDefinitions(eventDescriptors);
         TD.eventDescriptors = eventDescriptors;
     }
 }
 public bool WriteEvent(ref EventDescriptor eventDescriptor, Object[] eventPayload)
 {
   return default(bool);
 }
Exemple #45
0
        /// <summary>
        /// This is the main method that write the messages to the trace.
        /// All derived classes must use this method to write to the provider log.
        /// </summary>
        /// <param name="ed">EventDescriptor</param>
        /// <param name="payload">payload</param>
        protected void WriteEvent(EventDescriptor ed, params object[] payload)
        {
            EventProvider provider = GetProvider();

            if (!provider.IsEnabled())
                return;

            if (payload != null)
            {
                for (int i = 0; i < payload.Length; i++)
                {
                    if (payload[i] == null)
                    {
                        payload[i] = string.Empty;
                    }
                }
            }

            bool success = provider.WriteEvent(ref ed, payload);
            if (EventWritten != null)
            {
                EventWritten.Invoke(this, new EtwEventArgs(ed, success, payload));
            }
        }
 public bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, Object[] eventPayload)
 {
   return default(bool);
 }
 public bool WriteEvent(ref EventDescriptor eventDescriptor, Object[] eventPayload)
 {
     return(default(bool));
 }
 internal static extern unsafe uint EventWrite(
     [In] long registrationHandle,
     [In] ref EventDescriptor eventDescriptor,
     [In] uint userDataCount,
     [In] void *userData
     );