Ejemplo n.º 1
0
    def createFields(self):
        yield UInt8(self, "id", "PCX identifier (10)")
        yield Enum(UInt8(self, "version", "PCX version"), self.version_name)
        yield Enum(UInt8(self, "compression", "Compression method"), self.compression_name)
        yield UInt8(self, "bpp", "Bits / pixel")
        yield UInt16(self, "xmin", "Minimum X")
        yield UInt16(self, "ymin", "Minimum Y")
        yield UInt16(self, "xmax", "Width minus one")  # value + 1
        yield UInt16(self, "ymax", "Height minus one")  # value + 1
        yield UInt16(self, "horiz_dpi", "Horizontal DPI")
        yield UInt16(self, "vert_dpi", "Vertical DPI")
        yield PaletteRGB(self, "palette_4bits", 16, "Palette (4 bits)")
        yield PaddingBytes(self, "reserved[]", 1)
        yield UInt8(self, "nb_color_plan", "Number of color plans")
        yield UInt16(self, "bytes_per_line", "Bytes per line")
        yield UInt16(self, "color_mode", "Color mode")
        yield PaddingBytes(self, "reserved[]", 58)

        if self._size is None:  # TODO: is it possible to handle piped input?
            raise NotImplementedError

        nb_colors = 256
        size = (self._size - self.current_size) // 8
        has_palette = self["bpp"].value == 8
        if has_palette:
            size -= nb_colors * 3
        yield RawBytes(self, "image_data", size, "Image data")

        if has_palette:
            yield PaletteRGB(self, "palette_8bits", nb_colors, "Palette (8 bit)")
Ejemplo n.º 2
0
 def createFields(self):
     yield String(self, "name", 20, strip='\0')
     yield GenericVector(self, "samples", 31, SampleInfo, "info")
     yield UInt8(self, "length")
     yield UInt8(self, "played_patterns_count")
     yield GenericVector(self, "patterns", 128, UInt8, "position")
     yield String(self, "type", 4)
Ejemplo n.º 3
0
def parseProductInfo(parent, size):
    yield Int32(parent, "product_id")
    yield Int32(parent, "edition")
    yield UInt8(parent, "major_version")
    yield UInt8(parent, "minor_version")
    yield Int64(parent, "build_number")
    yield Int64(parent, "compilation_date")
Ejemplo n.º 4
0
    def createFields(self):
        yield Bytes(self, "signature", 4, r'ELF signature ("\x7fELF")')
        yield Enum(UInt8(self, "class", "Class"), self.CLASS_NAME)
        if self["class"].value == 1:
            ElfLongWord = UInt32
        else:
            ElfLongWord = UInt64
        yield Enum(UInt8(self, "endian", "Endian"), self.ENDIAN_NAME)
        yield UInt8(self, "file_version", "File version")
        yield Enum(UInt8(self, "osabi_ident", "OS/syscall ABI identification"),
                   self.OSABI_NAME)
        yield UInt8(self, "abi_version", "syscall ABI version")
        yield String(self, "pad", 7, "Pad")

        yield Enum(UInt16(self, "type", "File type"), self.TYPE_NAME)
        yield Enum(UInt16(self, "machine", "Machine type"), self.MACHINE_NAME)
        yield UInt32(self, "version", "ELF format version")
        yield textHandler(ElfLongWord(self, "entry", "Entry point"),
                          hexadecimal)
        yield ElfLongWord(self, "phoff", "Program header file offset")
        yield ElfLongWord(self, "shoff", "Section header file offset")
        yield UInt32(self, "flags", "Architecture-specific flags")
        yield UInt16(self, "ehsize", "Elf header size (this header)")
        yield UInt16(self, "phentsize", "Program header entry size")
        yield UInt16(self, "phnum", "Program header entry count")
        yield UInt16(self, "shentsize", "Section header entry size")
        yield UInt16(self, "shnum", "Section header entry count")
        yield UInt16(self, "shstrndx", "Section header string table index")
Ejemplo n.º 5
0
    def createFields(self):
        # Header
        yield NullBytes(self, "zero_vector", 16)
        yield GUID(self, "fs_guid")
        yield UInt64(self, "volume_len")
        yield String(self, "signature", 4)
        yield UInt32(self, "attributes")
        yield UInt16(self, "header_len")
        yield UInt16(self, "checksum")
        yield UInt16(self, "ext_header_offset")
        yield UInt8(self, "reserved")
        yield UInt8(self, "revision")
        while True:
            bm = BlockMap(self, "block_map[]")
            yield bm
            if bm['num_blocks'].value == 0 and bm['len'].value == 0:
                break
        # TODO must handle extended header

        # Content
        while not self.eof:
            padding = paddingSize(self.current_size // 8, 8)
            if padding:
                yield PaddingBytes(self, "padding[]", padding)
            yield File(self, "file[]")
Ejemplo n.º 6
0
    def createFields(self):
        yield UInt16(self, "left", "Left")
        yield UInt16(self, "top", "Top")
        yield UInt16(self, "width", "Width")
        yield UInt16(self, "height", "Height")

        yield Bits(self, "size_local_map", 3,
                   "log2(size of local map) minus one")
        yield NullBits(self, "reserved", 2)
        yield Bit(self, "sort_flag",
                  "Is the local map sorted by decreasing importance?")
        yield Bit(self, "interlaced", "Interlaced?")
        yield Bit(self, "has_local_map", "Use local color map?")

        if self["has_local_map"].value:
            nb_color = 1 << (1 + self["size_local_map"].value)
            yield PaletteRGB(self, "local_map", nb_color, "Local color map")

        yield UInt8(self, "lzw_min_code_size", "LZW Minimum Code Size")
        group = None
        while True:
            size = UInt8(self, "image_block_size[]")
            if size.value == 0:
                break
            yield size
            block = CustomFragment(self, "image_block[]", size.value * 8,
                                   GifImageBlock, "GIF Image Block", group)
            if group is None:
                block.group.args["startbits"] = self["lzw_min_code_size"].value
            group = block.group
            yield block
        yield NullBytes(self, "terminator", 1, "Terminator (0)")
Ejemplo n.º 7
0
    def createFields(self):
        yield Bits(self, "version", 4, "Version")
        yield Bits(self, "hdr_size", 4, "Header size divided by 5")

        # Type of service
        yield Enum(Bits(self, "precedence", 3, "Precedence"),
                   self.precedence_name)
        yield Bit(self, "low_delay", "If set, low delay, else normal delay")
        yield Bit(self, "high_throu",
                  "If set, high throughput, else normal throughput")
        yield Bit(self, "high_rel", "If set, high relibility, else normal")
        yield NullBits(self, "reserved[]", 2, "(reserved for future use)")

        yield UInt16(self, "length")
        yield UInt16(self, "id")

        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "df", "Don't fragment")
        yield Bit(self, "more_frag",
                  "There are more fragments? if not set, it's the last one")
        yield Bits(self, "frag_ofst_lo", 5)
        yield UInt8(self, "frag_ofst_hi")
        yield UInt8(self, "ttl", "Type to live")
        yield Enum(UInt8(self, "protocol"), self.PROTOCOL_NAME)
        yield textHandler(UInt16(self, "checksum"), hexadecimal)
        yield IPv4_Address(self, "src")
        yield IPv4_Address(self, "dst")

        size = (self.size - self.current_size) // 8
        if size:
            yield RawBytes(self, "options", size)
Ejemplo n.º 8
0
    def createFields(self):
        # Signature + version
        yield String(self, "header", 3, "Header (ID3)", charset="ASCII")
        yield UInt8(self, "ver_major", "Version (major)")
        yield UInt8(self, "ver_minor", "Version (minor)")

        # Check format
        if self["header"].value != "ID3":
            raise MatchError("Signature error, should be \"ID3\".")
        if self["ver_major"].value not in self.VALID_MAJOR_VERSIONS \
                or self["ver_minor"].value != 0:
            raise MatchError(
                "Unknown ID3 metadata version (2.%u.%u)" %
                (self["ver_major"].value, self["ver_minor"].value))

        # Flags
        yield Bit(self, "unsync", "Unsynchronisation is used?")
        yield Bit(self, "ext", "Extended header is used?")
        yield Bit(self, "exp", "Experimental indicator")
        yield NullBits(self, "padding[]", 5)

        # Size
        yield ID3_Size(self, "size")

        # All tags
        while self.current_size < self._size:
            field = ID3_Chunk(self, "field[]")
            yield field
            if field["size"].value == 0:
                break

        # Search first byte of the MPEG file
        padding = self.seekBit(self._size)
        if padding:
            yield padding
Ejemplo n.º 9
0
def parseTimeSignature(parser, size):
    yield UInt8(parser, "numerator", "Numerator of time signature")
    yield UInt8(parser, "denominator",
                "denominator of time signature 2=quarter 3=eighth, etc.")
    yield UInt8(parser, "nb_tick", "Number of ticks in metronome click")
    yield UInt8(parser, "nb_32nd_note",
                "Number of 32nd notes to the quarter note")
Ejemplo n.º 10
0
    def createFields(self):
        yield UInt8(self, "id_length", "Length of the image ID field")
        yield UInt8(self, "palette_type", "Colormap present?")
        yield Enum(UInt8(self, "codec", "Pixels encoding"), self.CODEC_NAME)
        yield UInt16(self, "palette_ofs", "Palette absolute file offset")
        yield UInt16(self, "nb_color", "Number of colors in the palette")
        yield UInt8(self, "color_map_size", "Size of each palette entry")
        yield UInt16(self, "x_min")
        yield UInt16(self, "y_min")
        yield UInt16(self, "width")
        yield UInt16(self, "height")
        yield UInt8(self, "bpp", "Bits per pixel")
        yield Bits(self, "alpha_depth", 4, "Alpha channel depth")
        yield Bit(
            self, "x_flip",
            "Flip across the X-axis? (If set, columns run right-to-left)")
        yield Bit(self, "y_flip",
                  "Flip across the Y-axis? (If set, rows run top-to-bottom)")
        yield RawBits(self, "reserved_flags", 2)

        if self["id_length"].value:
            yield RawBytes(self, "image_id", self["id_length"].value)

        if self["palette_type"].value == 1:
            yield PaletteRGB(self, "palette", 1 << self["bpp"].value)

        if self["codec"] in (1, 2, 3):
            yield Pixels(self, "pixels")
        else:
            size = (self.size - self.current_size) // 8
            if size:
                yield RawBytes(self, "raw_pixels", size)
Ejemplo n.º 11
0
def timestampParse(parent):
    yield UInt16(parent, "year", "Year")
    yield UInt8(parent, "month", "Month")
    yield UInt8(parent, "day", "Day")
    yield UInt8(parent, "hour", "Hour")
    yield UInt8(parent, "minute", "Minute")
    yield UInt8(parent, "second", "Second")
Ejemplo n.º 12
0
def fileHeader(self):
    yield filesizeHandler(
        UInt32(self, "compressed_size", "Size of the compressed file"))
    yield filesizeHandler(
        UInt32(self, "uncompressed_size", "Uncompressed file size"))
    yield TimeDateMSDOS32(self, "ftime", "Date and time (MS DOS format)")
    if self["/header/host_os"].value in (OS_MSDOS, OS_WIN32):
        yield MSDOSFileAttr32(self, "file_attr", "File attributes")
    else:
        yield textHandler(UInt32(self, "file_attr", "File attributes"),
                          hexadecimal)
    yield textHandler(
        UInt32(self, "file_crc32", "CRC32 checksum over the compressed file)"),
        hexadecimal)
    yield Enum(UInt8(self, "compression_type", "Type of compression"),
               COMPRESSION_TYPE)
    yield Enum(UInt8(self, "compression_mode", "Quality of compression"),
               COMPRESSION_MODE)
    yield textHandler(UInt16(self, "parameters", "Compression parameters"),
                      hexadecimal)
    yield textHandler(UInt16(self, "reserved", "Reserved data"), hexadecimal)
    # Filename
    yield PascalString16(self, "filename", "Filename")
    # Comment
    if self["flags/has_comment"].value:
        yield filesizeHandler(
            UInt16(self, "comment_size", "Size of the compressed comment"))
        if self["comment_size"].value > 0:
            yield RawBytes(self, "comment_data", self["comment_size"].value,
                           "Comment data")
Ejemplo n.º 13
0
 def createFields(self):
     yield Bytes(self, "signature", 6, "Signature Header")
     yield UInt8(self, "major_ver", "Archive major version")
     yield UInt8(self, "minor_ver", "Archive minor version")
     yield textHandler(UInt32(self, "start_hdr_crc", "Start header CRC"),
                       hexadecimal)
     yield StartHeader(self, "start_hdr", "Start header")
Ejemplo n.º 14
0
 def createFields(self):
     yield String(self, "name", 22, strip='\0')
     yield UInt16(self, "sample_count")
     yield textHandler(UInt8(self, "fine_tune"), getFineTune)
     yield textHandler(UInt8(self, "volume"), getVolume)
     yield UInt16(self, "loop_start", "Loop start offset in samples")
     yield UInt16(self, "loop_len", "Loop length in samples")
Ejemplo n.º 15
0
def commentHeader(s):
    yield filesizeHandler(
        UInt16(s, "total_size", "Comment header size + comment size"))
    yield filesizeHandler(
        UInt16(s, "uncompressed_size", "Uncompressed comment size"))
    yield UInt8(s, "required_version", "RAR version needed to extract comment")
    yield UInt8(s, "packing_method", "Comment packing method")
    yield UInt16(s, "comment_crc16", "Comment CRC")
Ejemplo n.º 16
0
    def createFields(self):
        yield Enum(UInt8(self, "type"), self.TYPE_DESC)
        yield UInt8(self, "code")
        yield textHandler(UInt16(self, "checksum"), hexadecimal)

        if self['type'].value in (self.ECHO_REQUEST, self.ECHO_REPLY):
            yield UInt16(self, "id")
            yield UInt16(self, "sequence")
Ejemplo n.º 17
0
 def createFields(self):
     yield UInt8(self, "width", "Width")
     yield UInt8(self, "height", "Height")
     yield UInt8(self, "nb_color", "Number of colors")
     yield UInt8(self, "reserved", "(reserved)")
     yield UInt16(self, "planes", "Color planes (=1)")
     yield UInt16(self, "bpp", "Bits per pixel")
     yield UInt32(self, "size", "Content size in bytes")
     yield UInt32(self, "offset", "Data offset")
Ejemplo n.º 18
0
    def createFields(self):
        # Gzip header
        yield Bytes(self, "signature", 2, r"GZip file signature (\x1F\x8B)")
        yield Enum(UInt8(self, "compression", "Compression method"),
                   self.COMPRESSION_NAME)

        # Flags
        yield Bit(self, "is_text", "File content is probably ASCII text")
        yield Bit(self, "has_crc16", "Header CRC16")
        yield Bit(self, "has_extra", "Extra informations (variable size)")
        yield Bit(self, "has_filename", "Contains filename?")
        yield Bit(self, "has_comment", "Contains comment?")
        yield NullBits(self, "reserved[]", 3)
        yield TimestampUnix32(self, "mtime", "Modification time")

        # Extra flags
        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "slowest",
                  "Compressor used maximum compression (slowest)")
        yield Bit(self, "fastest", "Compressor used the fastest compression")
        yield NullBits(self, "reserved[]", 5)
        yield Enum(UInt8(self, "os", "Operating system"), self.os_name)

        # Optional fields
        if self["has_extra"].value:
            yield UInt16(self, "extra_length", "Extra length")
            yield RawBytes(self, "extra", self["extra_length"].value, "Extra")
        if self["has_filename"].value:
            yield CString(self, "filename", "Filename", charset="ISO-8859-1")
        if self["has_comment"].value:
            yield CString(self, "comment", "Comment")
        if self["has_crc16"].value:
            yield textHandler(UInt16(self, "hdr_crc16", "CRC16 of the header"),
                              hexadecimal)

        if self._size is None:  # TODO: is it possible to handle piped input?
            raise NotImplementedError()

        # Read file
        size = (self._size - self.current_size) // 8 - 8  # -8: crc32+size
        if 0 < size:
            if self["has_filename"].value:
                filename = self["filename"].value
            else:
                for tag, filename in self.stream.tags:
                    if tag == "filename" and filename.endswith(".gz"):
                        filename = filename[:-3]
                        break
                else:
                    filename = None
            yield Deflate(SubFile(self, "file", size, filename=filename))

        # Footer
        yield textHandler(
            UInt32(self, "crc32", "Uncompressed data content CRC32"),
            hexadecimal)
        yield filesizeHandler(UInt32(self, "size", "Uncompressed size"))
Ejemplo n.º 19
0
 def createFields(self):
     yield Enum(UInt8(self, "charset"), ID3_StringCharset.charset_desc)
     charset = getCharset(self["charset"])
     yield CString(self, "mime", "MIME type", charset=charset)
     yield Enum(UInt8(self, "pict_type"), ID3_Picture23.pict_type_name)
     yield CString(self, "description", charset=charset)
     size = (self._size - self._current_size) // 8
     if size:
         yield RawBytes(self, "img_data", size)
Ejemplo n.º 20
0
def avInfoHeader(s):
    yield filesizeHandler(UInt16(s, "total_size", "Total block size"))
    yield UInt8(s,
                "version",
                "Version needed to decompress",
                handler=hexadecimal)
    yield UInt8(s, "method", "Compression method", handler=hexadecimal)
    yield UInt8(s, "av_version", "Version for AV", handler=hexadecimal)
    yield UInt32(s, "av_crc", "AV info CRC32", handler=hexadecimal)
Ejemplo n.º 21
0
 def createFields(self):
     yield Enum(UInt8(self, "charset"), ID3_StringCharset.charset_desc)
     charset = getCharset(self["charset"])
     yield String(self, "img_fmt", 3, charset="ASCII")
     yield Enum(UInt8(self, "pict_type"), self.pict_type_name)
     yield CString(self, "text", "Text", charset=charset, strip=" \0")
     size = (self._size - self._current_size) // 8
     if size:
         yield RawBytes(self, "img_data", size)
Ejemplo n.º 22
0
 def createFields(self):
     yield Enum(Bits(self, "ext_type", 4), self.EXT_TYPE)
     ext_type = self['ext_type'].value
     if ext_type == 1:
         # Sequence extension
         yield Bits(self, 'profile_and_level', 8)
         yield Bit(self, 'progressive_sequence')
         yield Bits(self, 'chroma_format', 2)
         yield Bits(self, 'horiz_size_ext', 2)
         yield Bits(self, 'vert_size_ext', 2)
         yield Bits(self, 'bit_rate_ext', 12)
         yield Bits(self, 'pad[]', 1)
         yield Bits(self, 'vbv_buffer_size_ext', 8)
         yield Bit(self, 'low_delay')
         yield Bits(self, 'frame_rate_ext_n', 2)
         yield Bits(self, 'frame_rate_ext_d', 5)
     elif ext_type == 2:
         # Sequence Display extension
         yield Bits(self, 'video_format', 3)
         yield Bit(self, 'color_desc_present')
         if self['color_desc_present'].value:
             yield UInt8(self, 'color_primaries')
             yield UInt8(self, 'transfer_characteristics')
             yield UInt8(self, 'matrix_coeffs')
         yield Bits(self, 'display_horiz_size', 14)
         yield Bits(self, 'pad[]', 1)
         yield Bits(self, 'display_vert_size', 14)
         yield NullBits(self, 'pad[]', 3)
     elif ext_type == 8:
         yield Bits(self, 'f_code[0][0]', 4, description="forward horizontal")
         yield Bits(self, 'f_code[0][1]', 4, description="forward vertical")
         yield Bits(self, 'f_code[1][0]', 4, description="backward horizontal")
         yield Bits(self, 'f_code[1][1]', 4, description="backward vertical")
         yield Bits(self, 'intra_dc_precision', 2)
         yield Bits(self, 'picture_structure', 2)
         yield Bit(self, 'top_field_first')
         yield Bit(self, 'frame_pred_frame_dct')
         yield Bit(self, 'concealment_motion_vectors')
         yield Bit(self, 'q_scale_type')
         yield Bit(self, 'intra_vlc_format')
         yield Bit(self, 'alternate_scan')
         yield Bit(self, 'repeat_first_field')
         yield Bit(self, 'chroma_420_type')
         yield Bit(self, 'progressive_frame')
         yield Bit(self, 'composite_display')
         if self['composite_display'].value:
             yield Bit(self, 'v_axis')
             yield Bits(self, 'field_sequence', 3)
             yield Bit(self, 'sub_carrier')
             yield Bits(self, 'burst_amplitude', 7)
             yield Bits(self, 'sub_carrier_phase', 8)
             yield NullBits(self, 'pad[]', 2)
         else:
             yield NullBits(self, 'pad[]', 6)
     else:
         yield RawBits(self, "raw[]", 4)
Ejemplo n.º 23
0
 def createFields(self):
     yield NullBytes(self, "unused", 6)
     yield UInt8(self, "offsetIntSize",
                 "Size (in bytes) of offsets in the offset table")
     yield UInt8(self, "objectRefSize",
                 "Size (in bytes) of object numbers in object references")
     yield UInt64(self, "numObjects", "Number of objects in this file")
     yield UInt64(self, "topObject", "Top-level object reference")
     yield UInt64(self, "offsetTableOffset",
                  "File offset to the offset table")
Ejemplo n.º 24
0
 def createFields(self):
     yield UInt16(self, "hw_type")
     yield UInt16(self, "proto_type")
     yield UInt8(self, "hw_size")
     yield UInt8(self, "proto_size")
     yield Enum(UInt16(self, "opcode"), ARP.opcode_name)
     yield MAC48_Address(self, "src_mac")
     yield IPv4_Address(self, "src_ip")
     yield MAC48_Address(self, "dst_mac")
     yield IPv4_Address(self, "dst_ip")
Ejemplo n.º 25
0
def parseVorbisHeader(parent):
    yield UInt32(parent, "vorbis_version")
    yield UInt8(parent, "audio_channels")
    yield UInt32(parent, "audio_sample_rate")
    yield UInt32(parent, "bitrate_maximum")
    yield UInt32(parent, "bitrate_nominal")
    yield UInt32(parent, "bitrate_minimum")
    yield Bits(parent, "blocksize_0", 4)
    yield Bits(parent, "blocksize_1", 4)
    yield UInt8(parent, "framing_flag")
Ejemplo n.º 26
0
 def createFields(self):
     yield Enum(UInt8(self, "labels"), BOOL)
     yield Enum(UInt8(self, "crop_marks"), BOOL)
     yield Enum(UInt8(self, "color_bars"), BOOL)
     yield Enum(UInt8(self, "reg_marks"), BOOL)
     yield Enum(UInt8(self, "negative"), BOOL)
     yield Enum(UInt8(self, "flip"), BOOL)
     yield Enum(UInt8(self, "interpolate"), BOOL)
     yield Enum(UInt8(self, "caption"), BOOL)
     yield Enum(UInt8(self, "print_flags"), BOOL)
     yield Enum(UInt8(self, "unknown"), BOOL)
Ejemplo n.º 27
0
 def getLastProperties(self):
     yield UInt8(self, "glob_vol", "Global volume")
     yield UInt8(self, "init_speed", "Initial speed (command A)")
     yield UInt8(self, "init_tempo", "Initial tempo (command T)")
     yield Bits(self, "volume", 7)
     yield Bit(self, "stereo")
     yield UInt8(self, "click_removal", "Number of GUS channels to run to prevent clicks")
     yield UInt8(self, "panning_info")
     yield RawBytes(self, "reserved[]", 8)
     yield UInt16(self, "custom_data_parapointer",
                  "Parapointer to special custom data (not used by ST3.01)")
Ejemplo n.º 28
0
 def createFields(self):
     yield UInt32(self, "length")
     yield UInt32(self, "loop_start")
     yield UInt32(self, "loop_end")
     yield UInt8(self, "volume")
     yield Int8(self, "fine_tune")
     yield SampleType(self, "type")
     yield UInt8(self, "panning")
     yield Int8(self, "relative_note")
     yield UInt8(self, "reserved")
     yield String(self, "name", 22, charset="ASCII", strip=' \0')
Ejemplo n.º 29
0
 def createFields(self):
     yield textHandler(Int32(self, "ns"), stringIndex)
     yield textHandler(Int32(self, "name"), stringIndex)
     yield textHandler(Int32(self, "value_string"), stringIndex)
     yield UInt16(self, "unk[]")
     yield UInt8(self, "unk[]")
     yield Enum(UInt8(self, "value_type"), self.TYPE_NAME)
     func = self.TYPE_FUNC.get(self['value_type'].value, None)
     if not func:
         func = UInt32
     yield func(self, "value_data")
Ejemplo n.º 30
0
    def createFields(self):
        # Header
        yield GUID(self, "name")
        yield UInt16(self, "integrity_check")
        yield Enum(UInt8(self, "type"), EFI_FV_FILETYPE)
        yield UInt8(self, "attributes")
        yield UInt24(self, "size")
        yield UInt8(self, "state")

        # Content
        while not self.eof:
            yield FileSection(self, "section[]")