REhints / HexRaysCodeXplorer

Hex-Rays Decompiler plugin for better code navigation
2.41k stars 389 forks source link

Support non-interactive type reconstruction (e.g. from script). #100

Closed assafcarlsbad closed 3 years ago

assafcarlsbad commented 3 years ago

This addresses issue #98. Once merged in, clients written in Python could reconstruct structures non-interactively using the following snippet:

from ctypes import *
import ida_loader

class ReconstructionParams(Structure):
    _fields_ = [
        ('func_ea', c_uint64),
        ('var_name', c_char * 100),
        ('var_type', c_char * 100),
    ]
#                             address   var_name      var_type       
params = ReconstructionParams(0x2754, b'CommBuffer', 'CommBuffer_2754')
ida_loader.load_and_run_plugin('HexRaysCodeXplorer64', addressof(params))

As a result, the following type would appear in the 'Structures' sub-menu: image