refactor: fix some things shown by newer VS syntax checker, mostly type related

This commit is contained in:
Dobin Rutishauser
2025-01-25 18:07:24 +01:00
parent 1d3324686f
commit 919aca0d70
11 changed files with 73 additions and 66 deletions
+2 -2
View File
@@ -43,13 +43,13 @@ def extract_code_from_exe_file_ep(exe_file: FilePath, len: int) -> bytes:
return data
def get_physical_address_tmp(pe, virtual_address):
def get_physical_address_tmp(pe, virtual_address) -> int:
for section in pe.sections:
if section.VirtualAddress <= virtual_address < section.VirtualAddress + section.Misc_VirtualSize:
virtual_offset = virtual_address - section.VirtualAddress
physical_address = section.PointerToRawData + virtual_offset
return physical_address
return None
raise Exception("pehelper::get_physical_address(): Address not found")
def extract_code_from_exe_file(exe_file: FilePath) -> bytes: