Skip to content

Commit 7cf9e88

Browse files
committed
minor tweak for PE loader
1 parent 3efd4ea commit 7cf9e88

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

qiling/loader/pe.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,19 @@ def run(self):
461461
self.sys_dlls.append(b"ntoskrnl.exe")
462462

463463
if self.ql.archtype == QL_ARCH.X86:
464-
self.stack_address = int(self.ql.os.profile.get("OS32", "stack_address"), 16)
465-
self.stack_size = int(self.ql.os.profile.get("OS32", "stack_size"), 16)
466-
self.image_address = int(self.ql.os.profile.get("OS32", "image_address"), 16)
467-
self.dll_address = int(self.ql.os.profile.get("OS32", "dll_address"), 16)
468-
self.entry_point = int(self.ql.os.profile.get("OS32", "entry_point"), 16)
469-
self.ql.os.heap_base_address = int(self.ql.os.profile.get("OS32", "heap_address"), 16)
470-
self.ql.os.heap_base_size = int(self.ql.os.profile.get("OS32", "heap_size"), 16)
464+
WINOSARCH = "OS32"
471465
self.structure_last_addr = FS_SEGMENT_ADDR
472466
elif self.ql.archtype == QL_ARCH.X8664:
473-
self.stack_address = int(self.ql.os.profile.get("OS64", "stack_address"), 16)
474-
self.stack_size = int(self.ql.os.profile.get("OS64", "stack_size"), 16)
475-
self.image_address = int(self.ql.os.profile.get("OS64", "image_address"), 16)
476-
self.dll_address = int(self.ql.os.profile.get("OS64", "dll_address"), 16)
477-
self.entry_point = int(self.ql.os.profile.get("OS64", "entry_point"), 16)
478-
self.ql.os.heap_base_address = int(self.ql.os.profile.get("OS64", "heap_address"), 16)
479-
self.ql.os.heap_base_size = int(self.ql.os.profile.get("OS64", "heap_size"), 16)
467+
WINOSARCH = "OS64"
480468
self.structure_last_addr = GS_SEGMENT_ADDR
481469

470+
self.stack_address = int(self.ql.os.profile.get(WINOSARCH, "stack_address"), 16)
471+
self.stack_size = int(self.ql.os.profile.get(WINOSARCH, "stack_size"), 16)
472+
self.image_address = int(self.ql.os.profile.get(WINOSARCH, "image_address"), 16)
473+
self.dll_address = int(self.ql.os.profile.get(WINOSARCH, "dll_address"), 16)
474+
self.entry_point = int(self.ql.os.profile.get(WINOSARCH, "entry_point"), 16)
475+
self.ql.os.heap_base_address = int(self.ql.os.profile.get(WINOSARCH, "heap_address"), 16)
476+
self.ql.os.heap_base_size = int(self.ql.os.profile.get(WINOSARCH, "heap_size"), 16)
482477
self.dlls = {}
483478
self.import_symbols = {}
484479
self.export_symbols = {}

0 commit comments

Comments
 (0)