]> granicus.if.org Git - python/commitdiff
Open dll file in binary.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 5 Mar 2006 13:52:20 +0000 (13:52 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 5 Mar 2006 13:52:20 +0000 (13:52 +0000)
Tools/msi/msilib.py

index 7ff8e9b78a2350e445abfe04422026b8d9c6c68b..d7b86ccb0dc3ed2d8e5e753f36a47265557803fd 100644 (file)
@@ -644,9 +644,9 @@ class Dialog:
         return self.control(name, "CheckBox", x, y, w, h, attr, prop, text, next, None)
 
 def pe_type(path):
-    header = open(path).read(1000)
-    # offset of PE header is at offset 0x3c; 1-based
-    pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]-1
+    header = open(path, "rb").read(1000)
+    # offset of PE header is at offset 0x3c
+    pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]
     assert header[pe_offset:pe_offset+4] == "PE\0\0"
     machine = struct.unpack("<H", header[pe_offset+4:pe_offset+6])[0]
     return machine