static object GetValue()

in Source/Tx.Windows/EtwTdh/EtwTdhEventInfo.cs [246:326]


        static object GetValue(TdhInType type, uint len, ref EtwNativeEvent evt)
        {
            // please keep the code below in the same order is the reader methods in EtwNativeEvent
            switch (type)
            {
                case TdhInType.AnsiChar:
                    return evt.ReadAnsiChar();

                case TdhInType.UnicodeChar:
                    return evt.ReadChar();

                case TdhInType.Int8:
                    return evt.ReadByte();

                case TdhInType.UInt8:
                    return evt.ReadUInt8();

                case TdhInType.Int16:
                    return evt.ReadInt16();

                case TdhInType.UInt16:
                    return evt.ReadUInt16();

                case TdhInType.Int32:
                    return evt.ReadInt32();

                case TdhInType.UInt32:
                case TdhInType.HexInt32:
                    return evt.ReadUInt32();

                case TdhInType.Int64:
                    return evt.ReadInt64();

                case TdhInType.UInt64:
                case TdhInType.HexInt64:
                    return evt.ReadUInt64();

                case TdhInType.Pointer:
                    return evt.ReadPointer();

                case TdhInType.Boolean:
                    return evt.ReadBoolean();

                case TdhInType.Float:
                    return evt.ReadFloat();

                case TdhInType.Double:
                    return evt.ReadDouble();

                case TdhInType.FileTime:
                    return evt.ReadFileTime();

                case TdhInType.SystemTime:
                    return evt.ReadSystemTime();

                case TdhInType.Guid:
                    return evt.ReadGuid();

                case TdhInType.Binary:
                    return evt.ReadBytes(len);

                case TdhInType.UnicodeString:
                case TdhInType.SID:
                    if (len > 0)
                    {
                        return evt.ReadUnicodeString((int)len);
                    }
                    else
                    {
                        return evt.ReadUnicodeString();
                    }

                case TdhInType.AnsiString:
                    return evt.ReadAnsiString();

                default:
                    var ex = new Exception("Unknown type " + type.ToString());
                    ex.Data ["ProviderGuid"] = evt.ProviderId;
                    throw ex;
            }
        }