Newer
Older
AMI-Aptio-BIOS-Reversed / Build / GuidArtifacts / 794E15D9-BF1B-4568-99AC-DCE207C022E4 / apply_renames.py
@Ajax Dong Ajax Dong 2 days ago 3 KB Full restructure
#!/usr/bin/env python3
"""
Apply function renames to IDA for module 794E15D9-BF1B-4568-99AC-DCE207C022E4.
Run this via: curl -X POST http://127.0.0.1:PORT/mcp -d '{"method":"tools/call","params":{"name":"py_exec_file","arguments":{"file_path":"..."}}}'
"""

import idc

RENAMES = {
    0x280: "_ModuleEntryPoint",
    0x334: "AspGraphicsDriverEntry",
    0x474: "AspGraphicsDriverBindingStop",
    0x53C: "AspGraphicsDriverBindingStart",
    0x838: "AspGraphicsDriverBindingSupported",
    0x9A4: "AspComponentNameGetDriverName",
    0x9D8: "AspComponentNameGetControllerName",
    0xAB0: "AspFillModeInfo",
    0xB30: "AspGraphicsQueryMode",
    0xC30: "AspGraphicsSetMode",
    0xDBC: "AspGraphicsBlt",
    0x1618: "AspInstallGopProtocol",
    0x16C8: "AspSetModeAllocateFramebuffer",
    0x1784: "AspGopModeInit",
    0x1840: "AspGopSetPixelFormat",
    0x18A8: "AspGopProgramModeRegs",
    0x1954: "AspGopGetFramebufferAddr",
    0x1ADC: "AspGopConfigureFbAddress",
    0x1BDC: "AspGopValidateAndApplyMode",
    0x1D64: "AspDetectDisplayType",
    0x1DDC: "AspDetectDisplayTypeWithEdid",
    0x1EDC: "AspDetectDisplayTypeFromRegs",
    0x1FC0: "AspEdidParseSimple",
    0x2314: "AspEdidParseDetailed",
    0x298C: "AspEdidOverride",
    0x2B84: "AspDpmsSet",
    0x2C68: "AspDpmsRestore",
    0x2E1C: "AspInitDisplayHardware",
    0x3414: "AspInitModeTable",
    0x3674: "AspCrtcProgramTiming",
    0x3868: "AspCrtcConfigurePll",
    0x3C4C: "AspCrtcSetDotClock",
    0x3CB0: "AspProgramCrtcRegisters",
    0x4310: "AspVgaRead8",
    0x4344: "AspVgaWrite8",
    0x4378: "AspCrtcRead",
    0x43C0: "AspCrtcWrite16",
    0x4408: "AspMmioWrite32",
    0x4440: "AspMmioRead32",
    0x4478: "AspMmioWriteMask",
    0x44DC: "AspMmioRead32WithDelay",
    0x4530: "AspPollVgaStatus",
    0x45D8: "AspEdidGetEdid",
    0x4730: "AspEdidParse",
    0x4978: "AspEdidGetPreferredMode",
    0x4A04: "AspEdidGetStandardMode",
    0x4A90: "AspEdidCheckVesaTiming",
    0x4B54: "AspEdidCheckDetailedTiming",
    0x4C18: "AspFreePool",
    0x4C48: "AspEdidParseMonitorName",
    0x4CB8: "AspEdidParseTiming",
    0x4D68: "AspEdidMatchTimingDesc",
    0x4DD0: "AspEdidIsTimingSupported",
    0x4E20: "AspEdidGetDetailedTiming",
    0x4FEC: "AspAllocateZeroPool",
    0x50C4: "AspDebugPrint",
    0x514C: "AspAssertFail",
    0x51C0: "AspAllocatePool",
    0x51F0: "AspAllocateCopyPool",
    0x526C: "AspSafeFreePool",
    0x52B0: "AspDevicePathNodeGetLength",
    0x5338: "AspDevicePathNodeIsEnd",
    0x5364: "AspDevicePathIsMultiInstance",
    0x5394: "AspDevicePathNodeGetEndSubst",
    0x53E0: "AspDevicePathIsEnd",
    0x5418: "AspDevicePathGetSize",
    0x5454: "AspDevicePathIsValid",
    0x54A8: "AspDevicePathFromText",
    0x54F8: "AspDevicePathIsRemovable",
    0x5538: "AspDevicePathNodeIsType",
    0x5598: "AspDevicePathNodeGetInfo",
    0x567C: "AspDevicePathFromHandle",
    0x5744: "AspStringCopyUnicode",
    0x57AC: "AspComponentNameGetString",
    0x58F0: "AspStringCopyAnsiToUnicode",
    0x5960: "AspStringLenUnicode",
    0x5980: "AspStringCopyAscii",
    0x59B4: "AspStringCatUnicode",
    0x5A2C: "AspComponentNameGetStringCommon",
    0x67A4: "AspStringIsCharDigit",
    0x67C8: "AspStringIsCharHexDigit",
    0x6808: "AspStringIsCharAlpha",
    0x68B0: "AspStringIsCharAlphanum",
    0x6950: "AspBasePrintLibWorker",
}

for ea, name in sorted(RENAMES.items()):
    success = idc.set_name(ea, name, idc.SN_CHECK)
    if success:
        print(f"OK: 0x{ea:04x} -> {name}")
    else:
        print(f"FAIL: 0x{ea:04x} -> {name}")

print(f"Applied {len(RENAMES)} renames.")