Пример #1
0
        internal static IMAGE_FILE_HEADER FromBinaryReader(BinaryReader reader)
        {
            IMAGE_FILE_HEADER ret = new IMAGE_FILE_HEADER();

            try
            {
                ret.Machine              = reader.ReadUInt16();
                ret.NumberOfSections     = reader.ReadUInt16();
                ret.TimeDateStamp        = reader.ReadUInt32();
                ret.PointerToSymbolTable = reader.ReadUInt32();
                ret.NumberOfSymbols      = reader.ReadUInt32();
                ret.SizeOfOptionalHeader = reader.ReadUInt16();
                ret.Characteristics      = reader.ReadUInt16();
            }
            catch
            {
                return(null);
            }
            return(ret);
        }
Пример #2
0
        internal static IMAGE_NT_HEADERS FromBinaryReader(BinaryReader reader)
        {
            IMAGE_NT_HEADERS ret = new IMAGE_NT_HEADERS();

            ret.Signature = reader.ReadUInt32();
            if (ret.Signature != IMAGE_NT_SIGNATURE)
            {
                return(null);
            }
            ret.FileHeader = IMAGE_FILE_HEADER.FromBinaryReader(reader);
            if (ret.FileHeader == null)
            {
                return(null);
            }
            ret.OptionalHeader = IMAGE_OPTIONAL_HEADER.FromBinaryReader(reader);
            if (ret.OptionalHeader == null)
            {
                return(null);
            }
            return(ret);
        }