mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
[TOOLS] Make gen_baseaddress.py python 3 compatible
This commit is contained in:
parent
5aab1831f7
commit
599843ac8e
1 changed files with 4 additions and 4 deletions
|
@ -203,13 +203,13 @@ def is_x64():
|
||||||
|
|
||||||
def size_of_image_fallback(filename):
|
def size_of_image_fallback(filename):
|
||||||
with open(filename, 'rb') as fin:
|
with open(filename, 'rb') as fin:
|
||||||
if fin.read(2) != 'MZ':
|
if fin.read(2) != b'MZ':
|
||||||
print(filename, 'No dos header found!')
|
print(filename, 'No dos header found!')
|
||||||
return 0
|
return 0
|
||||||
fin.seek(0x3C)
|
fin.seek(0x3C)
|
||||||
e_lfanew = struct.unpack('i', fin.read(4))[0]
|
e_lfanew = struct.unpack('i', fin.read(4))[0]
|
||||||
fin.seek(e_lfanew)
|
fin.seek(e_lfanew)
|
||||||
if fin.read(4) != 'PE\0\0':
|
if fin.read(4) != b'PE\0\0':
|
||||||
print(filename, 'No PE header found!')
|
print(filename, 'No PE header found!')
|
||||||
return 0
|
return 0
|
||||||
fin.seek(e_lfanew + 0x18)
|
fin.seek(e_lfanew + 0x18)
|
||||||
|
@ -332,8 +332,8 @@ class MemoryLayout(object):
|
||||||
def guess_version(ntdll_path):
|
def guess_version(ntdll_path):
|
||||||
if 'pefile' in globals():
|
if 'pefile' in globals():
|
||||||
ntdll_pe = pefile.PE(ntdll_path, fast_load=True)
|
ntdll_pe = pefile.PE(ntdll_path, fast_load=True)
|
||||||
names = [sect.Name.strip('\0') for sect in ntdll_pe.sections]
|
names = [sect.Name.strip(b'\0') for sect in ntdll_pe.sections]
|
||||||
count = '|'.join(names).count('/')
|
count = b'|'.join(names).count(b'/')
|
||||||
if '.rossym' in names:
|
if '.rossym' in names:
|
||||||
print('# This should probably go in baseaddress.cmake')
|
print('# This should probably go in baseaddress.cmake')
|
||||||
elif is_x64():
|
elif is_x64():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue