Exemplo n.º 1
0
    def createFields(self):
        yield UInt8(self, "version", "Version (0 or 1)")
        yield NullBits(self, "flags", 20)
        yield Bit(self, "is_in_poster")
        yield Bit(self, "is_in_preview",
                  "Is this track used when previewing the presentation?")
        yield Bit(self, "is_in_movie",
                  "Is this track used in the presentation?")
        yield Bit(self, "is_enabled", "Is this track enabled?")

        if self['version'].value == 0:
            # 32-bit version
            yield TimestampMac32(self, "creation_date",
                                 "Creation time of this track")
            yield TimestampMac32(self, "lastmod_date",
                                 "Last modification time of this track")
            yield UInt32(
                self, "track_id",
                "Unique nonzero identifier of this track within the presentation"
            )
            yield NullBytes(self, "reserved[]", 4)
            yield UInt32(self, "duration",
                         "Length of track, in movie time-units")
        elif self['version'].value == 1:
            # 64-bit version
            yield TimestampMac64(self, "creation_date",
                                 "Creation time of this track")
            yield TimestampMac64(self, "lastmod_date",
                                 "Last modification time of this track")
            yield UInt32(
                self, "track_id",
                "Unique nonzero identifier of this track within the presentation"
            )
            yield NullBytes(self, "reserved[]", 4)
            yield UInt64(self, "duration",
                         "Length of track, in movie time-units")
        yield NullBytes(self, "reserved[]", 8)
        yield Int16(
            self, "video_layer",
            "Middle layer is 0; lower numbers are closer to the viewer")
        yield Int16(self, "alternate_group",
                    "Group ID that this track belongs to (0=no group)")
        yield QTFloat16(self, "volume",
                        "Track relative audio volume (1.0 = full)")
        yield NullBytes(self, "reserved[]", 2)
        yield QTFloat32(self, "geom_a", "Width scale")
        yield QTFloat32(self, "geom_b", "Width rotate")
        yield QTFloat2_30(self, "geom_u", "Width angle")
        yield QTFloat32(self, "geom_c", "Height rotate")
        yield QTFloat32(self, "geom_d", "Height scale")
        yield QTFloat2_30(self, "geom_v", "Height angle")
        yield QTFloat32(self, "geom_x", "Position X")
        yield QTFloat32(self, "geom_y", "Position Y")
        yield QTFloat2_30(self, "geom_w", "Divider scale")
        yield QTFloat32(self, "frame_size_width")
        yield QTFloat32(self, "frame_size_height")
Exemplo n.º 2
0
    def createFields(self):
        yield Unsigned(self, 'track')
        yield Int16(self, 'timecode')

        if self.parent._name == 'Block':
            yield NullBits(self, 'reserved[]', 4)
            yield Bit(self, 'invisible')
            yield self.lacing()
            yield NullBits(self, 'reserved[]', 1)
        elif self.parent._name == 'SimpleBlock[]':
            yield Bit(self, 'keyframe')
            yield NullBits(self, 'reserved', 3)
            yield Bit(self, 'invisible')
            yield self.lacing()
            yield Bit(self, 'discardable')
        else:
            yield NullBits(self, 'reserved', 8)
            return

        size = (self._size - self.current_size) / 8
        lacing = self['lacing'].value
        if lacing:
            yield GenericInteger(self, 'n_frames', False, 8, \
                text_handler = lambda chunk: str(chunk.value+1))
            yield Lace(self, lacing - 1, size - 1)
        else:
            yield RawBytes(self, 'frame', size)
Exemplo n.º 3
0
    def createFields(self):
        yield textHandler(UInt8(self, "version"), hexadecimal)

        # TODO: sum of :
        # TrackEnabled = 1;
        # TrackInMovie = 2;
        # TrackInPreview = 4;
        # TrackInPoster = 8
        yield RawBytes(self, "flags", 3)

        yield TimestampMac32(self, "creation_date")
        yield TimestampMac32(self, "lastmod_date")
        yield UInt32(self, "track_id")
        yield PaddingBytes(self, "reserved[]", 8)
        yield UInt32(self, "duration")
        yield PaddingBytes(self, "reserved[]", 8)
        yield Int16(self, "video_layer", "Middle is 0, negative in front")
        yield PaddingBytes(self, "other", 2)
        yield QTFloat32(self, "geom_a", "Width scale")
        yield QTFloat32(self, "geom_b", "Width rotate")
        yield QTFloat32(self, "geom_u", "Width angle")
        yield QTFloat32(self, "geom_c", "Height rotate")
        yield QTFloat32(self, "geom_d", "Height scale")
        yield QTFloat32(self, "geom_v", "Height angle")
        yield QTFloat32(self, "geom_x", "Position X")
        yield QTFloat32(self, "geom_y", "Position Y")
        yield QTFloat32(self, "geom_w", "Divider scale")
        yield QTFloat32(self, "frame_size_width")
        yield QTFloat32(self, "frame_size_height")
Exemplo n.º 4
0
 def createFields(self):
     if self.stream.readBytes(self.absolute_address, 2) == "\xff\xff":
         yield Int16(
             self, "utf16_marker",
             "If this field is present, the Sttbf contains UTF-16 data."
         )
         self.is_utf16 = True
     else:
         self.is_utf16 = False
     yield UInt16(self, "count", "Number of strings in this Sttbf")
     extra_data_field = UInt16(
         self, "extra_data_len",
         "Size of optional extra data after each string")
     yield extra_data_field
     extra_data_len = extra_data_field.value
     for i in xrange(self["count"].value):
         if self.name == "SttbfAssoc":
             desc = self.SttbfAssocDESC.get(i, None)
         else:
             desc = None
         if self.name == "Sttbfffn":
             yield TableParsers.Ffn(self, "string[]", desc)
         elif self.is_utf16:
             yield WidePascalString16(self, "string[]", desc)
         else:
             yield PascalString8(self, "string[]", desc)
         if extra_data_len:
             yield RawBytes(self, "extra[]", extra_data_len)
Exemplo n.º 5
0
 def createFields(self):
     yield textHandler(UInt8(self, "version"), hexadecimal)
     yield RawBytes(self, "flags", 3)
     yield TimestampMac32(self, "creation_date")
     yield TimestampMac32(self, "lastmod_date")
     yield UInt32(self, "time_scale")
     yield UInt32(self, "duration")
     yield UInt16(self, "mac_lang")
     yield Int16(self, "quality")
Exemplo n.º 6
0
    def createFields(self):
        yield UInt16(self, "wIdent", "Magic Number")
        yield UInt16(self, "nFib", "File Information Block (FIB) Version")
        yield UInt16(self, "nProduct", "Product Version")
        yield Enum(UInt16(self, "lid", "Language ID"), LANGUAGE_ID)
        yield Int16(self, "pnNext")

        yield Bit(self, "fDot", "Is the document a document template?")
        yield Bit(self, "fGlsy", "Is the document a glossary?")
        yield Bit(self, "fComplex", "Is the document in Complex format?")
        yield Bit(self, "fHasPic", "Does the document have embedded images?")
        yield Bits(self, "cQuickSaves", 4,
                   "Number of times the document was quick-saved")
        yield Bit(self, "fEncrypted", "Is the document encrypted?")
        yield Bits(self, "fWhichTblStm", 1,
                   "Which table stream (0Table or 1Table) to use")
        yield Bit(self, "fReadOnlyRecommended",
                  "Should the file be opened read-only?")
        yield Bit(self, "fWriteReservation", "Is the file write-reserved?")
        yield Bit(self, "fExtChar",
                  "Does the file use an extended character set?")
        yield Bit(self, "fLoadOverride")
        yield Bit(self, "fFarEast")
        yield Bit(self, "fCrypto")

        yield UInt16(
            self, "nFibBack",
            "Document is backwards compatible down to this FIB version")
        yield UInt32(self, "lKey", "File encryption key (only if fEncrypted)")
        yield Enum(UInt8(self, "envr", "Document creation environment"), {
            0: 'Word for Windows',
            1: 'Macintosh Word'
        })

        yield Bit(self, "fMac", "Was this file last saved on a Mac?")
        yield Bit(self, "fEmptySpecial")
        yield Bit(self, "fLoadOverridePage")
        yield Bit(self, "fFutureSavedUndo")
        yield Bit(self, "fWord97Save")
        yield Bits(self, "fSpare0", 3)
        CHARSET = {0: 'Windows ANSI', 256: 'Macintosh'}
        yield Enum(UInt16(self, "chse", "Character set for document text"),
                   CHARSET)
        yield Enum(
            UInt16(self, "chsTables", "Character set for internal table text"),
            CHARSET)
        yield UInt32(self, "fcMin",
                     "File offset for the first character of text")
        yield UInt32(self, "fcMax",
                     "File offset for the last character of text + 1")

        yield ShortArray(self, "array1", "Array of shorts")
        yield LongArray(self, "array2", "Array of longs")
        yield FCLCBArray(self, "array3",
                         "Array of File Offset/Byte Count (FC/LCB) pairs")
Exemplo n.º 7
0
    def createFields(self):
        yield UInt32(self, "size")
        yield RawBytes(self, "format", 4, "Data Format (codec)")
        yield NullBytes(self, "reserved[]", 6, "Reserved")
        yield UInt16(self, "data_reference_index")
        handler = findHandler(self)
        if not handler:
            raise ParserError("stsd couldn't find track handler")
        if handler['subtype'].value == 'soun':
            # Audio sample entry
            yield NullBytes(self, "reserved[]", 8)
            yield UInt16(self, "channels", "Number of audio channels")
            yield UInt16(self, "samplesize", "Sample size in bits")
            yield UInt16(self, "unknown")
            yield NullBytes(self, "reserved[]", 2)
            yield QTFloat32(self, "samplerate", "Sample rate in Hz")
        elif handler['subtype'].value == 'vide':
            # Video sample entry
            yield UInt16(self, "version")
            yield UInt16(self, "revision_level")
            yield RawBytes(self, "vendor_id", 4)
            yield UInt32(self, "temporal_quality")
            yield UInt32(self, "spatial_quality")
            yield UInt16(self, "width", "Width (pixels)")
            yield UInt16(self, "height", "Height (pixels)")
            yield QTFloat32(self, "horizontal_resolution",
                            "Horizontal resolution in DPI")
            yield QTFloat32(self, "vertical resolution",
                            "Vertical resolution in DPI")
            yield UInt32(self, "data_size")
            yield UInt16(self, "frame_count")
            yield UInt8(self, "compressor_name_length")
            yield String(self, "compressor_name", 31, strip='\0')
            yield UInt16(self, "depth", "Bit depth of image")
            yield Int16(self, "unknown")
        elif handler['subtype'].value == 'hint':
            # Hint sample entry
            pass

        size = self['size'].value - self.current_size // 8
        if size > 0:
            yield RawBytes(self, "extra_data", size)
Exemplo n.º 8
0
 def createFields(self):
     yield UInt8(self, "version", "Version (0 or 1)")
     yield NullBits(self, "flags", 24)
     if self['version'].value == 0:
         # 32-bit version
         yield TimestampMac32(self, "creation_date",
                              "Creation time of this media")
         yield TimestampMac32(self, "lastmod_date",
                              "Last modification time of this media")
         yield UInt32(self, "time_scale", "Number of time-units per second")
         yield UInt32(self, "duration", "Length of media, in time-units")
     elif self['version'].value == 1:
         # 64-bit version
         yield TimestampMac64(self, "creation_date",
                              "Creation time of this media")
         yield TimestampMac64(self, "lastmod_date",
                              "Last modification time of this media")
         yield UInt32(self, "time_scale", "Number of time-units per second")
         yield UInt64(self, "duration", "Length of media, in time-units")
     yield LanguageCode(self, "language")
     yield Int16(self, "quality")
Exemplo n.º 9
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     yield PascalString16(self, "className", charset="UTF-8")
     yield Int64(self, "serialVersionUID")
     self.root.newHandle(self)
     yield NullBits(self, "classDescFlags_reserved", 3)
     yield Bit(self, "classDescFlags_enum", "Is the class an Enum?")
     yield Bit(
         self, "classDescFlags_block_data",
         "Was the externalizable's block data written using stream version 2?"
     )
     yield Bit(self, "classDescFlags_externalizable",
               "Does the class implement java.io.Externalizable?")
     yield Bit(self, "classDescFlags_serializable",
               "Does the class implement java.io.Serializable?")
     yield Bit(self, "classDescFlags_write_method",
               "Does the class have a writeObject method?")
     yield Int16(self, "fieldDesc_count")
     for i in xrange(self['fieldDesc_count'].value):
         yield FieldDesc(self, "fieldDesc[]")
     yield ClassAnnotation(self, "classAnnotation")
     yield SerializedContent(self, "superClassDesc")
Exemplo n.º 10
0
 def createFields(self):
     yield UInt16(self, "csw", "Count of fields in the array of shorts")
     self._size = self['csw'].value * 16 + 16
     yield Enum(UInt16(self, "wMagicCreated", "File creator ID"),
                CREATOR_ID)
     yield Enum(UInt16(self, "wMagicRevised", "File last modifier ID"),
                CREATOR_ID)
     yield UInt16(self, "wMagicCreatePrivate")
     yield UInt16(self, "wMagicCreatedPrivate")
     yield UInt16(self, "pnFbpChpFirst_W6")
     yield UInt16(self, "pnChpFirst_W6")
     yield UInt16(self, "cpnBteChp_W6")
     yield UInt16(self, "pnFbpPapFirst_W6")
     yield UInt16(self, "pnPapFirst_W6")
     yield UInt16(self, "cpnBtePap_W6")
     yield UInt16(self, "pnFbpLvcFirst_W6")
     yield UInt16(self, "pnLvcFirst_W6")
     yield UInt16(self, "cpnBteLvc_W6")
     yield Enum(
         UInt16(self, "lidFE",
                "Language ID if a Far East version of Word was used"),
         LANGUAGE_ID)
     while self.current_size < self.size:
         yield Int16(self, "unknown[]")
Exemplo n.º 11
0
def parseBranch(parent, size):
    yield Int16(parent, "offset")
Exemplo n.º 12
0
 def createFields(self):
     yield Bit(self, "final", "Is this the final block?")  # BFINAL
     yield Enum(
         Bits(self, "compression_type", 2),  # BTYPE
         {
             0: "None",
             1: "Fixed Huffman",
             2: "Dynamic Huffman",
             3: "Reserved"
         })
     if self["compression_type"].value == 0:  # no compression
         padding = paddingSize(self.current_size + self.absolute_address,
                               8)  # align on byte boundary
         if padding:
             yield PaddingBits(self, "padding[]", padding)
         yield Int16(self, "len")
         yield Int16(self, "nlen", "One's complement of len")
         if self["len"].value != ~self["nlen"].value:
             raise ParserError(
                 "len must be equal to the one's complement of nlen!")
         if self["len"].value:  # null stored blocks produced by some encoders (e.g. PIL)
             yield RawBytes(self, "data", self["len"].value,
                            "Uncompressed data")
         return
     elif self["compression_type"].value == 1:  # Fixed Huffman
         length_tree = {}  # (size, huffman code): value
         distance_tree = {}
         for i in xrange(144):
             length_tree[(8, i + 48)] = i
         for i in xrange(144, 256):
             length_tree[(9, i + 256)] = i
         for i in xrange(256, 280):
             length_tree[(7, i - 256)] = i
         for i in xrange(280, 288):
             length_tree[(8, i - 88)] = i
         for i in xrange(32):
             distance_tree[(5, i)] = i
     elif self["compression_type"].value == 2:  # Dynamic Huffman
         yield Bits(self, "huff_num_length_codes", 5,
                    "Number of Literal/Length Codes, minus 257")
         yield Bits(self, "huff_num_distance_codes", 5,
                    "Number of Distance Codes, minus 1")
         yield Bits(self, "huff_num_code_length_codes", 4,
                    "Number of Code Length Codes, minus 4")
         code_length_code_lengths = [0] * 19  # confusing variable name...
         for i in self.CODE_LENGTH_ORDER[:self["huff_num_code_length_codes"]
                                         .value + 4]:
             field = Bits(self, "huff_code_length_code[%i]" % i, 3,
                          "Code lengths for the code length alphabet")
             yield field
             code_length_code_lengths[i] = field.value
         code_length_tree = build_tree(code_length_code_lengths)
         length_code_lengths = []
         distance_code_lengths = []
         for numcodes, name, lengths in (
             (self["huff_num_length_codes"].value + 257, "length",
              length_code_lengths),
             (self["huff_num_distance_codes"].value + 1, "distance",
              distance_code_lengths)):
             while len(lengths) < numcodes:
                 field = HuffmanCode(self, "huff_%s_code[]" % name,
                                     code_length_tree)
                 value = field.realvalue
                 if value < 16:
                     prev_value = value
                     field._description = "Literal Code Length %i (Huffman Code %i)" % (
                         value, field.value)
                     yield field
                     lengths.append(value)
                 else:
                     info = {
                         16: (3, 6, 2),
                         17: (3, 10, 3),
                         18: (11, 138, 7)
                     }[value]
                     if value == 16:
                         repvalue = prev_value
                     else:
                         repvalue = 0
                     field._description = "Repeat Code %i, Repeating value (%i) %i to %i times (Huffman Code %i)" % (
                         value, repvalue, info[0], info[1], field.value)
                     yield field
                     extrafield = Bits(
                         self, "huff_%s_code_extra[%s" %
                         (name, field.name.split('[')[1]), info[2])
                     num_repeats = extrafield.value + info[0]
                     extrafield._description = "Repeat Extra Bits (%i), total repeats %i" % (
                         extrafield.value, num_repeats)
                     yield extrafield
                     lengths += [repvalue] * num_repeats
         length_tree = build_tree(length_code_lengths)
         distance_tree = build_tree(distance_code_lengths)
     else:
         raise ParserError("Unsupported compression type 3!")
     while True:
         field = HuffmanCode(self, "length_code[]", length_tree)
         value = field.realvalue
         if value < 256:
             field._description = "Literal Code %r (Huffman Code %i)" % (
                 chr(value), field.value)
             yield field
             self.uncomp_data += chr(value)
         if value == 256:
             field._description = "Block Terminator Code (256) (Huffman Code %i)" % field.value
             yield field
             break
         elif value > 256:
             info = self.LENGTH_SYMBOLS[value]
             if info[2] == 0:
                 field._description = "Length Code %i, Value %i (Huffman Code %i)" % (
                     value, info[0], field.value)
                 length = info[0]
                 yield field
             else:
                 field._description = "Length Code %i, Values %i to %i (Huffman Code %i)" % (
                     value, info[0], info[1], field.value)
                 yield field
                 extrafield = Bits(
                     self, "length_extra[%s" % field.name.split('[')[1],
                     info[2])
                 length = extrafield.value + info[0]
                 extrafield._description = "Length Extra Bits (%i), total length %i" % (
                     extrafield.value, length)
                 yield extrafield
             field = HuffmanCode(self, "distance_code[]", distance_tree)
             value = field.realvalue
             info = self.DISTANCE_SYMBOLS[value]
             if info[2] == 0:
                 field._description = "Distance Code %i, Value %i (Huffman Code %i)" % (
                     value, info[0], field.value)
                 distance = info[0]
                 yield field
             else:
                 field._description = "Distance Code %i, Values %i to %i (Huffman Code %i)" % (
                     value, info[0], info[1], field.value)
                 yield field
                 extrafield = Bits(
                     self, "distance_extra[%s" % field.name.split('[')[1],
                     info[2])
                 distance = extrafield.value + info[0]
                 extrafield._description = "Distance Extra Bits (%i), total length %i" % (
                     extrafield.value, distance)
                 yield extrafield
             self.uncomp_data = extend_data(self.uncomp_data, length,
                                            distance)
Exemplo n.º 13
0
    def createFields(self):
        yield UInt16(self, "wIdent", 2)
        yield UInt16(self, "nFib")
        yield UInt16(self, "nProduct")
        yield UInt16(self, "lid")
        yield Int16(self, "pnNext")

        yield Bit(self, "fDot")
        yield Bit(self, "fGlsy")
        yield Bit(self, "fComplex")
        yield Bit(self, "fHasPic")
        yield Bits(self, "cQuickSaves", 4)
        yield Bit(self, "fEncrypted")
        yield Bit(self, "fWhichTblStm")
        yield Bit(self, "fReadOnlyRecommanded")
        yield Bit(self, "fWriteReservation")
        yield Bit(self, "fExtChar")
        yield Bit(self, "fLoadOverride")
        yield Bit(self, "fFarEeast")
        yield Bit(self, "fCrypto")

        yield UInt16(self, "nFibBack")
        yield UInt32(self, "lKey")
        yield UInt8(self, "envr")

        yield Bit(self, "fMac")
        yield Bit(self, "fEmptySpecial")
        yield Bit(self, "fLoadOverridePage")
        yield Bit(self, "fFutureSavedUndo")
        yield Bit(self, "fWord97Save")
        yield Bits(self, "fSpare0", 3)

        yield UInt16(self, "chse")
        yield UInt16(self, "chsTables")
        yield UInt32(self, "fcMin")
        yield UInt32(self, "fcMac")

        yield PascalString16(self, "file_creator", strip="\0")

        yield NullBytes(self, "reserved[]", 12)

        yield Int16(self, "lidFE")
        yield UInt16(self, "clw")
        yield Int32(self, "cbMac")
        yield UInt32(self, "lProductCreated")
        yield TIMESTAMP(self, "lProductRevised")

        yield UInt32(self, "ccpText")
        yield Int32(self, "ccpFtn")
        yield Int32(self, "ccpHdr")
        yield Int32(self, "ccpMcr")
        yield Int32(self, "ccpAtn")
        yield Int32(self, "ccpEdn")
        yield Int32(self, "ccpTxbx")
        yield Int32(self, "ccpHdrTxbx")
        yield Int32(self, "pnFbpChpFirst")
        yield Int32(self, "pnChpFirst")
        yield Int32(self, "cpnBteChp")
        yield Int32(self, "pnFbpPapFirst")
        yield Int32(self, "pnPapFirst")
        yield Int32(self, "cpnBtePap")
        yield Int32(self, "pnFbpLvcFirst")
        yield Int32(self, "pnLvcFirst")
        yield Int32(self, "cpnBteLvc")
        yield Int32(self, "fcIslandFirst")
        yield Int32(self, "fcIslandLim")
        yield UInt16(self, "cfclcb")
        yield Int32(self, "fcStshfOrig")
        yield UInt32(self, "lcbStshfOrig")
        yield Int32(self, "fcStshf")
        yield UInt32(self, "lcbStshf")

        yield Int32(self, "fcPlcffndRef")
        yield UInt32(self, "lcbPlcffndRef")
        yield Int32(self, "fcPlcffndTxt")
        yield UInt32(self, "lcbPlcffndTxt")
        yield Int32(self, "fcPlcfandRef")
        yield UInt32(self, "lcbPlcfandRef")
        yield Int32(self, "fcPlcfandTxt")
        yield UInt32(self, "lcbPlcfandTxt")
        yield Int32(self, "fcPlcfsed")
        yield UInt32(self, "lcbPlcfsed")
        yield Int32(self, "fcPlcpad")
        yield UInt32(self, "lcbPlcpad")
        yield Int32(self, "fcPlcfphe")
        yield UInt32(self, "lcbPlcfphe")
        yield Int32(self, "fcSttbfglsy")
        yield UInt32(self, "lcbSttbfglsy")
        yield Int32(self, "fcPlcfglsy")
        yield UInt32(self, "lcbPlcfglsy")
        yield Int32(self, "fcPlcfhdd")
        yield UInt32(self, "lcbPlcfhdd")
        yield Int32(self, "fcPlcfbteChpx")
        yield UInt32(self, "lcbPlcfbteChpx")
        yield Int32(self, "fcPlcfbtePapx")
        yield UInt32(self, "lcbPlcfbtePapx")
        yield Int32(self, "fcPlcfsea")
        yield UInt32(self, "lcbPlcfsea")
        yield Int32(self, "fcSttbfffn")
        yield UInt32(self, "lcbSttbfffn")
        yield Int32(self, "fcPlcffldMom")
        yield UInt32(self, "lcbPlcffldMom")
        yield Int32(self, "fcPlcffldHdr")
        yield UInt32(self, "lcbPlcffldHdr")
        yield Int32(self, "fcPlcffldFtn")
        yield UInt32(self, "lcbPlcffldFtn")
        yield Int32(self, "fcPlcffldAtn")
        yield UInt32(self, "lcbPlcffldAtn")
        yield Int32(self, "fcPlcffldMcr")
        yield UInt32(self, "lcbPlcffldMcr")
        yield Int32(self, "fcSttbfbkmk")
        yield UInt32(self, "lcbSttbfbkmk")
        yield Int32(self, "fcPlcfbkf")
        yield UInt32(self, "lcbPlcfbkf")
        yield Int32(self, "fcPlcfbkl")
        yield UInt32(self, "lcbPlcfbkl")
        yield Int32(self, "fcCmds")
        yield UInt32(self, "lcbCmds")
        yield Int32(self, "fcPlcmcr")
        yield UInt32(self, "lcbPlcmcr")
        yield Int32(self, "fcSttbfmcr")
        yield UInt32(self, "lcbSttbfmcr")
        yield Int32(self, "fcPrDrvr")
        yield UInt32(self, "lcbPrDrvr")
        yield Int32(self, "fcPrEnvPort")
        yield UInt32(self, "lcbPrEnvPort")
        yield Int32(self, "fcPrEnvLand")
        yield UInt32(self, "lcbPrEnvLand")
        yield Int32(self, "fcWss")
        yield UInt32(self, "lcbWss")
        yield Int32(self, "fcDop")
        yield UInt32(self, "lcbDop")
        yield Int32(self, "fcSttbfAssoc")
        yield UInt32(self, "lcbSttbfAssoc")
        yield Int32(self, "fcClx")
        yield UInt32(self, "lcbClx")
        yield Int32(self, "fcPlcfpgdFtn")
        yield UInt32(self, "lcbPlcfpgdFtn")
        yield Int32(self, "fcAutosaveSource")
        yield UInt32(self, "lcbAutosaveSource")
        yield Int32(self, "fcGrpXstAtnOwners")
        yield UInt32(self, "lcbGrpXstAtnOwners")
        yield Int32(self, "fcSttbfAtnbkmk")
        yield UInt32(self, "lcbSttbfAtnbkmk")
        yield Int32(self, "fcPlcdoaMom")
        yield UInt32(self, "lcbPlcdoaMom")
        yield Int32(self, "fcPlcdoaHdr")
        yield UInt32(self, "lcbPlcdoaHdr")
        yield Int32(self, "fcPlcspaMom")
        yield UInt32(self, "lcbPlcspaMom")
        yield Int32(self, "fcPlcspaHdr")
        yield UInt32(self, "lcbPlcspaHdr")
        yield Int32(self, "fcPlcfAtnbkf")
        yield UInt32(self, "lcbPlcfAtnbkf")
        yield Int32(self, "fcPlcfAtnbkl")
        yield UInt32(self, "lcbPlcfAtnbkl")
        yield Int32(self, "fcPms")
        yield UInt32(self, "lcbPms")
        yield Int32(self, "fcFormFldSttbs")
        yield UInt32(self, "lcbFormFldSttbs")
        yield Int32(self, "fcPlcfendRef")
        yield UInt32(self, "lcbPlcfendRef")
        yield Int32(self, "fcPlcfendTxt")
        yield UInt32(self, "lcbPlcfendTxt")
        yield Int32(self, "fcPlcffldEdn")
        yield UInt32(self, "lcbPlcffldEdn")
        yield Int32(self, "fcPlcfpgdEdn")
        yield UInt32(self, "lcbPlcfpgdEdn")
        yield Int32(self, "fcDggInfo")
        yield UInt32(self, "lcbDggInfo")
        yield Int32(self, "fcSttbfRMark")
        yield UInt32(self, "lcbSttbfRMark")
        yield Int32(self, "fcSttbCaption")
        yield UInt32(self, "lcbSttbCaption")
        yield Int32(self, "fcSttbAutoCaption")
        yield UInt32(self, "lcbSttbAutoCaption")
        yield Int32(self, "fcPlcfwkb")
        yield UInt32(self, "lcbPlcfwkb")
        yield Int32(self, "fcPlcfspl")
        yield UInt32(self, "lcbPlcfspl")
        yield Int32(self, "fcPlcftxbxTxt")
        yield UInt32(self, "lcbPlcftxbxTxt")
        yield Int32(self, "fcPlcffldTxbx")
        yield UInt32(self, "lcbPlcffldTxbx")
        yield Int32(self, "fcPlcfhdrtxbxTxt")
        yield UInt32(self, "lcbPlcfhdrtxbxTxt")
        yield Int32(self, "fcPlcffldHdrTxbx")
        yield UInt32(self, "lcbPlcffldHdrTxbx")
        yield Int32(self, "fcStwUser")
        yield UInt32(self, "lcbStwUser")
        yield Int32(self, "fcSttbttmbd")
        yield UInt32(self, "cbSttbttmbd")
        yield Int32(self, "fcUnused")
        yield UInt32(self, "lcbUnused")
        yield Int32(self, "fcPgdMother")
        yield UInt32(self, "lcbPgdMother")
        yield Int32(self, "fcBkdMother")
        yield UInt32(self, "lcbBkdMother")
        yield Int32(self, "fcPgdFtn")
        yield UInt32(self, "lcbPgdFtn")
        yield Int32(self, "fcBkdFtn")
        yield UInt32(self, "lcbBkdFtn")
        yield Int32(self, "fcPgdEdn")
        yield UInt32(self, "lcbPgdEdn")
        yield Int32(self, "fcBkdEdn")
        yield UInt32(self, "lcbBkdEdn")
        yield Int32(self, "fcSttbfIntlFld")
        yield UInt32(self, "lcbSttbfIntlFld")
        yield Int32(self, "fcRouteSlip")
        yield UInt32(self, "lcbRouteSlip")
        yield Int32(self, "fcSttbSavedBy")
        yield UInt32(self, "lcbSttbSavedBy")
        yield Int32(self, "fcSttbFnm")
        yield UInt32(self, "lcbSttbFnm")
        yield Int32(self, "fcPlcfLst")
        yield UInt32(self, "lcbPlcfLst")
        yield Int32(self, "fcPlfLfo")
        yield UInt32(self, "lcbPlfLfo")
        yield Int32(self, "fcPlcftxbxBkd")
        yield UInt32(self, "lcbPlcftxbxBkd")
        yield Int32(self, "fcPlcftxbxHdrBkd")
        yield UInt32(self, "lcbPlcftxbxHdrBkd")
        yield Int32(self, "fcDocUndo")
        yield UInt32(self, "lcbDocUndo")
        yield Int32(self, "fcRgbuse")
        yield UInt32(self, "lcbRgbuse")
        yield Int32(self, "fcUsp")
        yield UInt32(self, "lcbUsp")
        yield Int32(self, "fcUskf")
        yield UInt32(self, "lcbUskf")
        yield Int32(self, "fcPlcupcRgbuse")
        yield UInt32(self, "lcbPlcupcRgbuse")
        yield Int32(self, "fcPlcupcUsp")
        yield UInt32(self, "lcbPlcupcUsp")
        yield Int32(self, "fcSttbGlsyStyle")
        yield UInt32(self, "lcbSttbGlsyStyle")
        yield Int32(self, "fcPlgosl")
        yield UInt32(self, "lcbPlgosl")
        yield Int32(self, "fcPlcocx")
        yield UInt32(self, "lcbPlcocx")
        yield Int32(self, "fcPlcfbteLvc")
        yield UInt32(self, "lcbPlcfbteLvc")
        yield TIMESTAMP(self, "ftModified")
        yield Int32(self, "fcPlcflvc")
        yield UInt32(self, "lcbPlcflvc")
        yield Int32(self, "fcPlcasumy")
        yield UInt32(self, "lcbPlcasumy")
        yield Int32(self, "fcPlcfgram")
        yield UInt32(self, "lcbPlcfgram")
        yield Int32(self, "fcSttbListNames")
        yield UInt32(self, "lcbSttbListNames")
        yield Int32(self, "fcSttbfUssr")
        yield UInt32(self, "lcbSttbfUssr")

        tail = (self.size - self.current_size) // 8
        if tail:
            yield RawBytes(self, "tail", tail)
Exemplo n.º 14
0
 def createFields(self):
     yield Int16(self, "int_part")
     yield UInt16(self, "float_part")
Exemplo n.º 15
0
def parseXY(parser):
    yield Int16(parser, "x")
    yield Int16(parser, "y")
Exemplo n.º 16
0
 def createFields(self):
     yield Int16(self, "x")
     yield Int16(self, "y")
Exemplo n.º 17
0
    def createFields(self):
        yield UInt16(self, "wIdent", "Magic Number")
        yield UInt16(self, "nFib", "File Information Block (FIB) Version")
        yield UInt16(self, "nProduct", "Product Version")
        yield Enum(UInt16(self, "lid", "Language ID"), LANGUAGE_ID)
        yield Int16(self, "pnNext")

        yield Bit(self, "fDot", "Is the document a document template?")
        yield Bit(self, "fGlsy", "Is the document a glossary?")
        yield Bit(self, "fComplex", "Is the document in Complex format?")
        yield Bit(self, "fHasPic", "Does the document have embedded images?")
        yield Bits(self, "cQuickSaves", 4,
                   "Number of times the document was quick-saved")
        yield Bit(self, "fEncrypted", "Is the document encrypted?")
        yield Bits(self, "reserved[]", 7)

        yield UInt16(self, "nFibBack")
        yield UInt32(self, "reserved[]")
        yield NullBytes(self, "rgwSpare", 6)

        yield UInt32(self, "fcMin", "File offset of first text character")
        yield UInt32(self, "fcMax", "File offset of last text character + 1")
        yield Int32(self, "cbMax", "File offset of last byte + 1")
        yield NullBytes(self, "fcSpare", 16)

        yield UInt32(self, "ccpText", "Length of main document text stream")
        yield Int32(self, "ccpFtn",
                    "Length of footnote subdocument text stream")
        yield Int32(self, "ccpHdr", "Length of header subdocument text stream")
        yield Int32(self, "ccpMcr", "Length of macro subdocument text stream")
        yield Int32(self, "ccpAtn",
                    "Length of annotation subdocument text stream")
        yield NullBytes(self, "ccpSpare", 16)

        yield FC_CB(self, "StshfOrig", "Original STSH allocation")
        yield FC_CB(self, "Stshf", "Current STSH allocation")
        yield FC_CB(self, "PlcffndRef", "Footnote reference PLC")
        yield FC_CB(self, "PlcffndTxt", "Footnote text PLC")
        yield FC_CB(self, "PlcfandRef", "Annotation reference PLC")
        yield FC_CB(self, "PlcfandTxt", "Annotation text PLC")
        yield FC_CB(self, "Plcfsed", "Section descriptor PLC")
        yield FC_CB(self, "Plcfpgd", "Page descriptor PLC")
        yield FC_CB(self, "Plcfphe", "Paragraph heights PLC")
        yield FC_CB(self, "Sttbfglsy", "Glossary string table")
        yield FC_CB(self, "Plcfglsy", "Glossary PLC")
        yield FC_CB(self, "Plcfhdd", "Header PLC")
        yield FC_CB(self, "PlcfbteChpx", "Character property bin table PLC")
        yield FC_CB(self, "PlcfbtePapx", "Paragraph property bin table PLC")
        yield FC_CB(self, "Plcfsea", "Private Use PLC")
        yield FC_CB(self, "Sttbfffn")
        yield FC_CB(self, "PlcffldMom")
        yield FC_CB(self, "PlcffldHdr")
        yield FC_CB(self, "PlcffldFtn")
        yield FC_CB(self, "PlcffldAtn")
        yield FC_CB(self, "PlcffldMcr")
        yield FC_CB(self, "Sttbfbkmk")
        yield FC_CB(self, "Plcfbkf")
        yield FC_CB(self, "Plcfbkl")
        yield FC_CB(self, "Cmds")
        yield FC_CB(self, "Plcmcr")
        yield FC_CB(self, "Sttbfmcr")
        yield FC_CB(self, "PrDrvr", "Printer Driver information")
        yield FC_CB(self, "PrEnvPort", "Printer environment for Portrait mode")
        yield FC_CB(self, "PrEnvLand",
                    "Printer environment for Landscape mode")
        yield FC_CB(self, "Wss", "Window Save State")
        yield FC_CB(self, "Dop", "Document Property data")
        yield FC_CB(self, "SttbfAssoc")
        yield FC_CB(self, "Clx", "'Complex' file format data")
        yield FC_CB(self, "PlcfpgdFtn", "Footnote page descriptor PLC")
        yield FC_CB(self, "AutosaveSource",
                    "Original filename for Autosave purposes")
        yield FC_CB(self, "Spare5")
        yield FC_CB(self, "Spare6")

        yield Int16(self, "wSpare4")
        yield UInt16(self, "pnChpFirst")
        yield UInt16(self, "pnPapFirst")
        yield UInt16(self, "cpnBteChp", "Count of CHPX FKPs recorded in file")
        yield UInt16(self, "cpnBtePap", "Count of PAPX FKPs recorded in file")