[Python-checkins] r42849 - python/trunk/Tools/msi/msilib.py

martin.v.loewis python-checkins at python.org
Sun Mar 5 14:52:21 CET 2006


Author: martin.v.loewis
Date: Sun Mar  5 14:52:20 2006
New Revision: 42849

Modified:
   python/trunk/Tools/msi/msilib.py
Log:
Open dll file in binary.

Modified: python/trunk/Tools/msi/msilib.py
==============================================================================
--- python/trunk/Tools/msi/msilib.py	(original)
+++ python/trunk/Tools/msi/msilib.py	Sun Mar  5 14:52:20 2006
@@ -644,9 +644,9 @@
         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


More information about the Python-checkins mailing list