Example #1
0
        private static unsafe uint TraceInternal(Guid guid, string xml, TraceType type, int eventId)
        {
            uint maxValue = uint.MaxValue;

            if ((Provider != null) && Provider.ShouldTrace)
            {
                int       num2   = (((xml.Length + 1) * 2) < 0xffce) ? ((xml.Length + 1) * 2) : 0xffce;
                Mof3Event event2 = new Mof3Event();
                event2.Header.Guid          = WsatTraceGuid;
                event2.Header.Type          = (byte)type;
                event2.Header.ClientContext = 0;
                event2.Header.Flags         = 0x120000;
                event2.Header.BufferSize    = 0x60;
                event2.Mof2.Length          = (uint)num2;
                event2.Mof1.Length          = 0x10;
                event2.Mof1.Data            = (IntPtr) & guid;
                event2.Mof3.Length          = 4;
                event2.Mof3.Data            = (IntPtr) & eventId;
                fixed(char *str = ((char *)xml))
                {
                    char *chPtr = str;

                    event2.Mof2.Data = (IntPtr)chPtr;
                    if (Provider != null)
                    {
                        maxValue = provider.Trace((MofEvent *)&event2);
                    }
                }
            }
            return(maxValue);
        }
 private static unsafe uint TraceInternal(Guid guid, string xml, TraceType type, int eventId)
 {
     uint maxValue = uint.MaxValue;
     if ((Provider != null) && Provider.ShouldTrace)
     {
         int num2 = (((xml.Length + 1) * 2) < 0xffce) ? ((xml.Length + 1) * 2) : 0xffce;
         Mof3Event event2 = new Mof3Event();
         event2.Header.Guid = WsatTraceGuid;
         event2.Header.Type = (byte) type;
         event2.Header.ClientContext = 0;
         event2.Header.Flags = 0x120000;
         event2.Header.BufferSize = 0x60;
         event2.Mof2.Length = (uint) num2;
         event2.Mof1.Length = 0x10;
         event2.Mof1.Data = (IntPtr) &guid;
         event2.Mof3.Length = 4;
         event2.Mof3.Data = (IntPtr) &eventId;
         fixed (char* str = ((char*) xml))
         {
             char* chPtr = str;
             event2.Mof2.Data = (IntPtr) chPtr;
             if (Provider != null)
             {
                 maxValue = provider.Trace((MofEvent*) &event2);
             }
         }
     }
     return maxValue;
 }