/// <summary> Serializing constructor. </summary> /// <param name="BinaryStream"> Stream to serialize data from </param> public FModuleInfo(BinaryReader BinaryStream) { BaseOfImage = BinaryStream.ReadUInt64(); ImageSize = BinaryStream.ReadUInt32(); TimeDateStamp = BinaryStream.ReadUInt32(); PdbSig = BinaryStream.ReadUInt32(); PdbAge = BinaryStream.ReadUInt32(); uint v; v = BinaryStream.ReadUInt32(); // data1 v = BinaryStream.ReadUInt16(); // data2 v = BinaryStream.ReadUInt16(); // data3 v = BinaryStream.ReadUInt32(); // data4.0 v = BinaryStream.ReadUInt32(); // data4.4 ModuleName = FStreamParser.ReadString(BinaryStream); ImageName = FStreamParser.ReadString(BinaryStream); LoadedImageName = FStreamParser.ReadString(BinaryStream); Debug.WriteLine("Loaded Module:" + ModuleName); Debug.WriteLine("ImageName:" + ImageName); Debug.WriteLine("LoadedImageName:" + LoadedImageName); Debug.WriteLine("BaseOfImage:" + BaseOfImage.ToString()); Debug.WriteLine("ImageSize:" + ImageSize.ToString()); }
/** * Constructor, serializing header from passed in stream. * * @param BinaryStream Stream to serialize header from. */ public FProfileDataHeader(BinaryReader BinaryStream) { // Serialize the file format magic first. Magic = BinaryStream.ReadUInt32(); // Stop serializing data if magic number doesn't match. Most likely endian issue. if (Magic == ExpectedMagic) { // Version info for backward compatible serialization. Version = BinaryStream.ReadUInt32(); FStreamToken.Version = Version; // We can no longer load anything < version 4 if (Version < 4) { throw new InvalidDataException(String.Format("File version is too old! File Version: {0}, but we can only load >= 4.", Version)); } // Read platform name. PlatformName = FStreamParser.ReadString(BinaryStream); // Whether symbol information was serialized. bShouldSerializeSymbolInfo = BinaryStream.ReadUInt32() == 0 ? false : true; if (Version >= 6) { // Meta-data table offset in file and number of entries. MetaDataTableOffset = BinaryStream.ReadUInt64(); MetaDataTableEntries = BinaryStream.ReadUInt64(); } else { MetaDataTableOffset = 0; MetaDataTableEntries = 0; } if (Version >= 5) { // Name table offset in file and number of entries. NameTableOffset = BinaryStream.ReadUInt64(); NameTableEntries = BinaryStream.ReadUInt64(); // CallStack address table offset and number of entries. CallStackAddressTableOffset = BinaryStream.ReadUInt64(); CallStackAddressTableEntries = BinaryStream.ReadUInt64(); // CallStack table offset and number of entries. CallStackTableOffset = BinaryStream.ReadUInt64(); CallStackTableEntries = BinaryStream.ReadUInt64(); if (Version >= 7) { // Tags table offset and number of entries. TagsTableOffset = BinaryStream.ReadUInt64(); TagsTableEntries = BinaryStream.ReadUInt64(); } else { TagsTableOffset = 0; TagsTableEntries = 0; } ModulesOffset = BinaryStream.ReadUInt64(); ModuleEntries = BinaryStream.ReadUInt64(); NumDataFiles = 1; } else { // Name table offset in file and number of entries. NameTableOffset = BinaryStream.ReadUInt32(); NameTableEntries = BinaryStream.ReadUInt32(); // CallStack address table offset and number of entries. CallStackAddressTableOffset = BinaryStream.ReadUInt32(); CallStackAddressTableEntries = BinaryStream.ReadUInt32(); // CallStack table offset and number of entries. CallStackTableOffset = BinaryStream.ReadUInt32(); CallStackTableEntries = BinaryStream.ReadUInt32(); ModulesOffset = BinaryStream.ReadUInt32(); ModuleEntries = BinaryStream.ReadUInt32(); // Number of data files the stream spans. NumDataFiles = BinaryStream.ReadUInt32(); } // Name of executable. ExecutableName = FStreamParser.ReadString(BinaryStream); } }
/** * Constructor, serializing header from passed in stream. * * @param BinaryStream Stream to serialize header from. */ public FProfileDataHeader(BinaryReader BinaryStream) { // Serialize the file format magic first. Magic = BinaryStream.ReadUInt32(); // Stop serializing data if magic number doesn't match. Most likely endian issue. if (Magic == ExpectedMagic) { // Version info for backward compatible serialization. Version = BinaryStream.ReadUInt32(); if (Version >= 4) { // Read platform name. PlatformName = FStreamParser.ReadString(BinaryStream); PlatformName = FixFixedSizeString(PlatformName); } else { // Read platform type. Platform = (EPlatformType)BinaryStream.ReadUInt32(); } // Whether symbol information was serialized. bShouldSerializeSymbolInfo = BinaryStream.ReadUInt32() == 0 ? false : true; if (Version >= 5) { // Name table offset in file and number of entries. NameTableOffset = BinaryStream.ReadUInt64(); NameTableEntries = BinaryStream.ReadUInt64(); // CallStack address table offset and number of entries. CallStackAddressTableOffset = BinaryStream.ReadUInt64(); CallStackAddressTableEntries = BinaryStream.ReadUInt64(); // CallStack table offset and number of entries. CallStackTableOffset = BinaryStream.ReadUInt64(); CallStackTableEntries = BinaryStream.ReadUInt64(); ModulesOffset = BinaryStream.ReadUInt64(); ModuleEntries = BinaryStream.ReadUInt64(); NumDataFiles = 1; } else { // Name table offset in file and number of entries. NameTableOffset = BinaryStream.ReadUInt32(); NameTableEntries = BinaryStream.ReadUInt32(); // CallStack address table offset and number of entries. CallStackAddressTableOffset = BinaryStream.ReadUInt32(); CallStackAddressTableEntries = BinaryStream.ReadUInt32(); // CallStack table offset and number of entries. CallStackTableOffset = BinaryStream.ReadUInt32(); CallStackTableEntries = BinaryStream.ReadUInt32(); ModulesOffset = BinaryStream.ReadUInt32(); ModuleEntries = BinaryStream.ReadUInt32(); // Number of data files the stream spans. NumDataFiles = BinaryStream.ReadUInt32(); } FStreamToken.Version = Version; if (Version >= 4) { // Just ignore } else if (Version > 2) { ScriptCallstackTableOffset = BinaryStream.ReadUInt32(); ScriptNameTableOffset = BinaryStream.ReadUInt32(); bDecodeScriptCallstacks = ScriptCallstackTableOffset != UInt32.MaxValue; } // Name of executable. ExecutableName = FStreamParser.ReadString(BinaryStream); ExecutableName = FixFixedSizeString(ExecutableName); } }