Ejemplo n.º 1
0
        private void AddExportedEntryPoints(Address addrLoad, SegmentMap imageMap, List <ImageSymbol> entryPoints)
        {
            ImageReader rdr = imgLoaded.CreateLeReader(rvaExportTable);

            rdr.ReadLeUInt32();             // Characteristics
            rdr.ReadLeUInt32();             // timestamp
            rdr.ReadLeUInt32();             // version.
            rdr.ReadLeUInt32();             // binary name.
            rdr.ReadLeUInt32();             // base ordinal
            int nExports = rdr.ReadLeInt32();
            int nNames   = rdr.ReadLeInt32();

            if (nExports != nNames)
            {
                throw new BadImageFormatException("Unexpected discrepancy in PE image.");
            }
            uint rvaApfn  = rdr.ReadLeUInt32();
            uint rvaNames = rdr.ReadLeUInt32();

            ImageReader rdrAddrs = imgLoaded.CreateLeReader(rvaApfn);
            ImageReader rdrNames = imgLoaded.CreateLeReader(rvaNames);

            for (int i = 0; i < nNames; ++i)
            {
                ImageSymbol ep = LoadEntryPoint(addrLoad, rdrAddrs, rdrNames);
                if (imageMap.IsExecutableAddress(ep.Address))
                {
                    ImageSymbols[ep.Address] = ep;
                    entryPoints.Add(ep);
                }
            }
        }
Ejemplo n.º 2
0
        private void AddExportedEntryPoints(Address addrLoad, SegmentMap imageMap, List <ImageSymbol> entryPoints)
        {
            EndianImageReader rdr = imgLoaded.CreateLeReader(rvaExportTable);
            uint characteristics  = rdr.ReadLeUInt32();
            uint timestamp        = rdr.ReadLeUInt32();
            uint version          = rdr.ReadLeUInt32();
            uint binaryNameAddr   = rdr.ReadLeUInt32();
            uint baseOrdinal      = rdr.ReadLeUInt32();

            int  nExports = rdr.ReadLeInt32();
            int  nNames   = rdr.ReadLeInt32();
            uint rvaApfn  = rdr.ReadLeUInt32();
            uint rvaNames = rdr.ReadLeUInt32();

            EndianImageReader rdrAddrs = imgLoaded.CreateLeReader(rvaApfn);
            EndianImageReader rdrNames = nNames != 0
                ? imgLoaded.CreateLeReader(rvaNames)
                : null;

            for (int i = 0; i < nExports; ++i)
            {
                ImageSymbol ep = LoadEntryPoint(addrLoad, rdrAddrs, rdrNames);
                if (imageMap.IsExecutableAddress(ep.Address))
                {
                    ImageSymbols[ep.Address] = ep;
                    entryPoints.Add(ep);
                }
            }
        }