import contextlib import io import os import subprocess import struct import sys import tempfile import unittest from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import symbolize_samples TIMESTAMP = 0x6AD92AC4 SIZE_OF_IMAGE = 0x3000 def symbol(name, value, section, kind, storage, aux=0): return struct.pack("<8sIhHBB", name, value, section, kind, storage, aux) def build_pe(path, with_symbols=True, with_exports=False, second_code=False, timestamp=TIMESTAMP): image = bytearray(0xC00) image[0:2] = b"MZ" struct.pack_into("