Fix broken RWEverything helper.

This commit is contained in:
Assaf Carlsbad
2020-07-29 23:38:24 +03:00
committed by BrentHoltsclaw
parent 732146efd8
commit 44c4cbbf8b
+7 -7
View File
@@ -47,7 +47,7 @@ from chipsec.helper.basehelper import Helper
from chipsec.logger import logger, print_buffer
import chipsec.file
from chipsec.defines import bytestostring
from chipsec.hal.uefi_common import EFI_GUID
from chipsec.hal.uefi_common import EFI_GUID_STR
class PCI_BDF(Structure):
_fields_ = [("BUS", c_ushort, 16), # Bus
@@ -178,24 +178,24 @@ FirmwareTableID_XSDT = 0x54445358
def guid_str(guid0, guid1, guid2, guid3):
return ( "{:08X}-{:04X}-{:04X}-{:4}-{:6}".format(guid0, guid1, guid2, guid3[:2].encode('hex').upper(), guid3[-6::].encode('hex').upper()) )
class EFI_HDR_WIN( namedtuple('EFI_HDR_WIN', 'Size DataOffset DataSize Attributes guid0 guid1 guid2 guid3') ):
class EFI_HDR_WIN( namedtuple('EFI_HDR_WIN', 'Size DataOffset DataSize Attributes guid') ):
__slots__ = ()
def __str__(self):
return """
Header (Windows)
----------------
VendorGuid= {{{:08X}-{:04X}-{:04X}-{:4}-{:6}}}
VendorGuid= {{{}}}
Size = 0x{:08X}
DataOffset= 0x{:08X}
DataSize = 0x{:08X}
Attributes= 0x{:08X}
""".format( self.guid0, self.guid1, self.guid2, self.guid3[:2].encode('hex').upper(), self.guid3[-6::].encode('hex').upper(), self.Size, self.DataOffset, self.DataSize, self.Attributes )
""".format( EFI_GUID_STR(self.guid), self.Size, self.DataOffset, self.DataSize, self.Attributes )
def getEFIvariables_NtEnumerateSystemEnvironmentValuesEx2( nvram_buf ):
start = 0
buffer = nvram_buf
bsize = len(buffer)
header_fmt = "<IIIIIHH8s"
header_fmt = "<IIII16s"
header_size = struct.calcsize( header_fmt )
variables = dict()
off = 0
@@ -217,7 +217,7 @@ def getEFIvariables_NtEnumerateSystemEnvironmentValuesEx2( nvram_buf ):
if efi_var_name not in variables.keys():
variables[efi_var_name] = []
# off, buf, hdr, data, guid, attrs
variables[efi_var_name].append( (off, efi_var_buf, efi_var_hdr, efi_var_data, EFI_GUID(efi_var_hdr.guid0, efi_var_hdr.guid1, efi_var_hdr.guid2, efi_var_hdr.guid3), efi_var_hdr.Attributes) )
variables[efi_var_name].append( (off, efi_var_buf, efi_var_hdr, efi_var_data, EFI_GUID_STR(efi_var_hdr.guid), efi_var_hdr.Attributes) )
if 0 == efi_var_hdr.Size: break
off = next_var_offset
@@ -373,7 +373,7 @@ class RweHelper(Helper):
os.path.abspath(self.driver_path),
None, 0, u"", None, None )
if hs:
if logger().DEBUG: logger().log( "[helper] service '{}' created (handle = 0x{:08X})".format(SERVICE_NAME,hs) )
if logger().DEBUG: logger().log( "[helper] service '{}' created (handle = 0x{:08X})".format(SERVICE_NAME,int(hs)) )
except win32service.error as err:
if (winerror.ERROR_SERVICE_EXISTS == err.args[0]):
if logger().DEBUG: logger().log( "[helper] service '{}' already exists: {} ({:d})".format(SERVICE_NAME, err.args[2], err.args[0]) )