public TPIReader(IServiceContainer ctx, SpanStream stream) : base(stream) { this.ctx = ctx; Header = Read <TPIHeader>(); if (Header.HeaderSize != Marshal.SizeOf <TPIHeader>()) { throw new InvalidDataException(); } if (!Enum.IsDefined(typeof(TPIVersion), Header.Version)) { throw new InvalidDataException(); } #if false if (Header.Version != TPIVersion.V80) { throw new NotImplementedException($"TPI Version {Header.Version} not supported yet"); } #endif lazyLeafContainers = LazyFactory.CreateLazy(ReadTypes); }
public LazyLeafProvider(IServiceContainer ctx, uint typeIndex) { this.resolver = ctx.GetService <TypeResolver>(); this.typeIndex = typeIndex; lazy = LazyFactory.CreateLazy(ReadLeaf); }
public LazyModuleProvider(IServiceContainer ctx, ModuleInfo mod) { this.ctx = ctx; this.StreamTable = ctx.GetService <StreamTableReader>(); this.Info = mod; this.lazyModule = LazyFactory.CreateLazy(ReadModule); }
public ModuleListReader(IServiceContainer ctx, SpanStream __stream, uint moduleListSize) : base(__stream) { this.ctx = ctx; listStartOffset = Position; listSize = moduleListSize; listEndOffset = listStartOffset + listSize; lazyModules = LazyFactory.CreateLazy(ReadModules); }
public ILeafContainer ReadTypeLazy(bool hasSize = true) { long typePos = Position; ILazy <ILeafContainer> delayedLeaf = LazyFactory.CreateLazy <ILeafContainer>(() => { Position = typePos; return(ReadTypeDirect(hasSize)); }); return(new LazyLeafProvider(ctx, delayedLeaf)); }
public DebugReader(IServiceContainer ctx, SpanStream stream) : base(stream) { this.StreamTable = ctx.GetService <StreamTableReader>(); for (int i = 0; i < (int)DebugType.DebugTypeMax; i++) { DebugStreams[i] = ReadInt16(); } lazyFPO = LazyFactory.CreateLazy(CreateFPOReader); }
public CodeViewModuleReader(IServiceContainer ctx, ModuleInfo mod, SpanStream stream) : base(stream) { this.ctx = ctx; this.mod = mod; CodeViewSignature signature = ReadEnum <CodeViewSignature>(); if (signature != CodeViewSignature.C13) { throw new NotImplementedException($"CodeView {signature} not supported yet"); } lazySymbols = LazyFactory.CreateLazy(ReadSymbols); }
public SectionContrib40(IServiceContainer ctx, SpanStream stream) : base(stream) { SectionIndex = ReadUInt16(); ReadUInt16(); Offset = ReadUInt32(); Size = ReadUInt32(); Characteristics = ReadUInt32(); ModuleIndex = ReadInt16(); ReadUInt16(); //////// DBIReader dbi = ctx.GetService <DBIReader>(); moduleLazy = LazyFactory.CreateLazy(() => ModuleIndex == -1 ? null : dbi.Modules[this.ModuleIndex]); }
public SectionContribsReader(uint sectionContribsSize, SpanStream stream) : base(stream) { this.SectionContribsSize = sectionContribsSize; Version = ReadEnum <SCVersion>(); switch (Version) { case SCVersion.V60: sectionContribsLazy = LazyFactory.CreateLazy(ReadSectionContribsV1); break; case SCVersion.New: sectionContribsLazy = LazyFactory.CreateLazy(ReadSectionContribsV2); break; default: sectionContribsLazy = LazyFactory.CreateLazy(ReadSectionContribsOld); break; } // after version StreamOffset = Position; }
public TPIReader(IServiceContainer ctx, SpanStream stream) : base(stream) { this.ctx = ctx; PDBFile pdb = ctx.GetService <PDBFile>(); if (pdb.Type == PDBType.Old) { this.TypeReader = new ReadTypeDelegate(ReadTypeOld); JGHeaderOld oldHdr = ctx.GetService <JGHeaderOld>(); Header = ImportJGOld(oldHdr); } else { Header = Read <TPIHeader>(); if (Header.HeaderSize != Marshal.SizeOf <TPIHeader>()) { throw new InvalidDataException(); } if (!Enum.IsDefined(typeof(TPIVersion), Header.Version)) { throw new InvalidDataException(); } this.TypeReader = new ReadTypeDelegate(ReadType); } #if false if (Header.Version != TPIVersion.V80) { throw new NotImplementedException($"TPI Version {Header.Version} not supported yet"); } #endif lazyLeafContainers = LazyFactory.CreateLazy(ReadTypes); }
public FPOReader(byte[] data) : base(data) { lazyFrames = LazyFactory.CreateLazy(ReadFrames); }
/** * Layout of the DBI stream * -> Header * -> ModuleList * -> SectionContributions * -> SectionMap * -> FileInfo * -> TypeServerMap * -> EcSubstream * -> DebugHeader **/ public DBIReader(IServiceContainer ctx, byte[] data) : base(data) { this.ctx = ctx; if (Length == 0) { return; } if (Length < Marshal.SizeOf <DBIHeader>()) { throw new InvalidDataException(); } Header = Read <DBIHeader>(); if (Header.Signature != unchecked ((uint)-1) || !Enum.IsDefined(typeof(DBIVersion), (uint)Header.Version)) { throw new InvalidDataException(); } this.StreamTable = ctx.GetService <StreamTableReader>(); uint nStreams = StreamTable.NumStreams; if ( Header.GsSymbolsStreamNumber >= nStreams || Header.PsSymbolsStreamNumber >= nStreams || Header.SymbolRecordsStreamNumber >= nStreams ) { throw new InvalidDataException(); } lazyModuleContainers = LazyFactory.CreateLazy(ReadModules); Position += Header.ModuleListSize; if (Header.SectionContributionSize > 0) { SectionContribs = new SectionContribsReader(Header.SectionContributionSize, this); } Position += Header.SectionContributionSize; Position += Header.SectionMapSize; Position += Header.FileInfoSize; if (Header.TypeServerMapSize > 0) { TypeServerMap = new TypeServerMapReader(this); } Position += Header.TypeServerMapSize; if (Header.EcSubstreamSize > 0) { EC = new ECReader(this); } Position += Header.EcSubstreamSize; if (Header.DebugHeaderSize > 0) { DebugInfo = new DebugReader(ctx, this); } }