mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Open dll file in binary.
This commit is contained in:
parent
dd860caa8f
commit
d149c21d54
1 changed files with 3 additions and 3 deletions
|
@ -644,9 +644,9 @@ class Dialog:
|
||||||
return self.control(name, "CheckBox", x, y, w, h, attr, prop, text, next, None)
|
return self.control(name, "CheckBox", x, y, w, h, attr, prop, text, next, None)
|
||||||
|
|
||||||
def pe_type(path):
|
def pe_type(path):
|
||||||
header = open(path).read(1000)
|
header = open(path, "rb").read(1000)
|
||||||
# offset of PE header is at offset 0x3c; 1-based
|
# offset of PE header is at offset 0x3c
|
||||||
pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]-1
|
pe_offset = struct.unpack("<i", header[0x3c:0x40])[0]
|
||||||
assert header[pe_offset:pe_offset+4] == "PE\0\0"
|
assert header[pe_offset:pe_offset+4] == "PE\0\0"
|
||||||
machine = struct.unpack("<H", header[pe_offset+4:pe_offset+6])[0]
|
machine = struct.unpack("<H", header[pe_offset+4:pe_offset+6])[0]
|
||||||
return machine
|
return machine
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue