Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d149c21

Browse files
committed
Open dll file in binary.
1 parent dd860ca commit d149c21

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Tools/msi/msilib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,9 @@ def checkbox(self, name, x, y, w, h, attr, prop, text, next):
644644
return self.control(name, "CheckBox", x, y, w, h, attr, prop, text, next, None)
645645

646646
def pe_type(path):
647-
header = open(path).read(1000)
648-
# offset of PE header is at offset 0x3c; 1-based
649-
pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]-1
647+
header = open(path, "rb").read(1000)
648+
# offset of PE header is at offset 0x3c
649+
pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]
650650
assert header[pe_offset:pe_offset+4] == "PE\0\0"
651651
machine = struct.unpack("<H", header[pe_offset+4:pe_offset+6])[0]
652652
return machine

0 commit comments

Comments
 (0)