コード例 #1
0
ファイル: main.py プロジェクト: thekeyman/insyde-tools
 def showinfo(self, depth=0):
     print " " * depth, "Reserved boot zone:", hexbytes(self.rsvd)
     print " " * depth, "GUID:", hexbytes(self.guid)
     print " " * depth, "Size: 0x%x (data 0x%x)" % (self.size, len(
         self.data))
     print " " * depth, "Attributes: 0x%08x" % self.attributes
     print " " * depth, "Revision: %d" % self.revision
コード例 #2
0
ファイル: main.py プロジェクト: coreboot/bios_extract
 def showinfo(self, depth=0):
     print " " * depth, "Reserved boot zone:", hexbytes(self.rsvd)
     print " " * depth, "GUID:", hexbytes(self.guid)
     print " " * depth, "Size: 0x%x (data 0x%x)" % (self.size,
                                                    len(self.data))
     print " " * depth, "Attributes: 0x%08x" % self.attributes
     print " " * depth, "Revision: %d" % self.revision
コード例 #3
0
ファイル: main.py プロジェクト: thekeyman/insyde-tools
    def __init__(self, complete_data):
        header_size = VariableHeader.struct_size

        header = complete_data[:header_size]
        self.vh = vh = VariableHeader(header)

        print "Blah:", hexbytes(vh.guid)

        assert vh.magic == self.HEADER_MAGIC, "bad magic 0x%x" % vh.magic

        total_length = vh.dsize + vh.nsize
        assert len(complete_data) >= total_length, "input not long enough"

        data = complete_data[header_size:]
        data = data[:total_length]

        nullterm = data.index("\x00\x00") + 1
        strend = nullterm if nullterm < vh.nsize else vh.nsize

        self.name = data[:strend].decode("utf-16le")
        self.value = data[vh.nsize:total_length]

        # Set the checksum to 0, and the status to 0x7F
        fdata = substitute(header + data, header_size - 2, "\x00\x00")
        fdata = substitute(fdata, 2, "\x7F\x00")

        self.ccsum = self.checksum(fdata)
コード例 #4
0
ファイル: main.py プロジェクト: coreboot/bios_extract
    def __init__(self, complete_data):
        header_size = VariableHeader.struct_size

        header = complete_data[:header_size]
        self.vh = vh = VariableHeader(header)
        print "Blah:", hexbytes(vh.guid)

        assert vh.magic == self.HEADER_MAGIC, "bad magic 0x%x" % vh.magic

        total_length = vh.dsize + vh.nsize
        assert len(complete_data) >= total_length, "input not long enough"

        data = complete_data[header_size:]
        data = data[:total_length]

        nullterm = data.index("\x00\x00") + 1
        strend = nullterm if nullterm < vh.nsize else vh.nsize

        self.name = data[:strend].decode("utf-16le")
        self.value = data[vh.nsize:total_length]

        # Set the checksum to 0, and the status to 0x7F
        fdata = substitute(header + data, header_size - 2, "\x00\x00")
        fdata = substitute(fdata, 2, "\x7F\x00")

        self.ccsum = self.checksum(fdata)