Example #1
0
        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);
        }
Example #2
0
        public LazyLeafProvider(IServiceContainer ctx, uint typeIndex)
        {
            this.resolver = ctx.GetService <TypeResolver>();

            this.typeIndex = typeIndex;
            lazy           = LazyFactory.CreateLazy(ReadLeaf);
        }
		public ModuleListReader(IServiceContainer ctx, SpanStream __stream, uint moduleListSize) : base(__stream) {
			this.ctx = ctx;

			listStartOffset = Position;
			listSize = moduleListSize;
			listEndOffset = listStartOffset + listSize;

			lazyModules = LazyFactory.CreateLazy(ReadModules);
		}
Example #4
0
        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));
        }
Example #5
0
        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 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;
        }
Example #8
0
        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);
        }