Exemplo n.º 1
0
        public OptionalHeaderWindowsSpecificFields(PeInfoReader reader, OptionalHeaderMagic magic)
        {
            if (magic == OptionalHeaderMagic.PE32)
            {
                ImageBase = Info <ulong> .ConvertFrom(reader.ReadDWord());
            }
            else
            {
                ImageBase = reader.ReadQWord();
            }

            SectionAlignment            = reader.ReadDWord();
            FileAlignment               = reader.ReadDWord();
            MajorOperatingSystemVersion = reader.ReadWord();
            MinorOperatingSystemVersion = reader.ReadWord();
            MajorImageVersion           = reader.ReadWord();
            MinorImageVersion           = reader.ReadWord();
            MajorSubsystemVersion       = reader.ReadWord();
            MinorSubsystemVersion       = reader.ReadWord();
            Win32VersionValue           = reader.ReadDWord();
            SizeOfImage        = reader.ReadDWord();
            SizeOfHeaders      = reader.ReadDWord();
            CheckSum           = reader.ReadDWord();
            Subsystem          = reader.ReadWordAsEnum <WindowsSubsystems>();
            DllCharacteristics = reader.ReadWordAsEnum <DllCharacteristics>();

            if (magic == OptionalHeaderMagic.PE32)
            {
                SizeOfStackReserve = Info <ulong> .ConvertFrom(reader.ReadDWord());

                SizeOfStackCommit = Info <ulong> .ConvertFrom(reader.ReadDWord());

                SizeOfHeapReserve = Info <ulong> .ConvertFrom(reader.ReadDWord());

                SizeOfHeapCommit = Info <ulong> .ConvertFrom(reader.ReadDWord());
            }
            else
            {
                SizeOfStackReserve = reader.ReadQWord();
                SizeOfStackCommit  = reader.ReadQWord();
                SizeOfHeapReserve  = reader.ReadQWord();
                SizeOfHeapCommit   = reader.ReadQWord();
            }

            LoaderFlags         = reader.ReadDWord();
            NumberOfRvaAndSizes = reader.ReadDWord();
        }
Exemplo n.º 2
0
        public OptionalHeaderStandardFields(PeInfoReader reader)
        {
            Magic = reader.ReadWordAsEnum <OptionalHeaderMagic>();
            MajorLinkerVersion      = reader.ReadByte();
            MinorLinkerVersion      = reader.ReadByte();
            SizeOfCode              = reader.ReadDWord();
            SizeOfInitializedData   = reader.ReadDWord();
            SizeOfUninitializedData = reader.ReadDWord();
            AddressOfEntryPoint     = reader.ReadDWord();
            BaseOfCode              = reader.ReadDWord();

            if (Magic.Value == OptionalHeaderMagic.PE32)
            {
                BaseOfData = reader.ReadDWord();
            }
            else
            {
                BaseOfData = new Info <uint>(0, new byte[0], 0);
            }
        }