"""tools/d3d12_guid_sites.py and tools/d3d12_iid_scan.py report a bad header or an unreadable import table. Hand-made inputs only: a few bytes stand in for a PE image, and the header is written by the test (no SDK, no game files). """ import os import struct import subprocess import sys import tempfile import unittest ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TOOLS = os.path.join(ROOT, "tools") GOOD_HEADER = b'MIDL_INTERFACE("6102dee4-af59-4c3d-9c5b-7a1e4cb0d5b6")\nID3D12Fence\n' BAD_HEADER = b'MIDL_INTERFACE("000000000000000000000000000000000000")\nID3D12Fence\n' def pe_stub(bad): """A 0x300-byte PE32+ image with one d3d12_xs.dll import (ordinal 50), or, when bad, a second descriptor whose name is an unterminated string at the end of the file.""" b = bytearray(0x300) b[0:2] = b"MZ" struct.pack_into("