bes
August 5, 2026, 9:57am
1
Does anyone know how correctly implement replacement of import_type IDA-SDK-API was removed since IDA9?
There are a few approaches below, and no one works as intended.
if(til && til != get_idati()) { // nullptr til is the local til
Log(llInfo, "import enum '%s' from til '%s'\n", typeName, til->name);
#if IDA_SDK_VERSION < 850
import_type(til, -1, typeName);
#else //IDA_SDK_VERSION >= 850
//enum doesnt work when type doesnt exist in local til
#if 0
//I've not found a way to import original type, two below
//gets correctly named `nt`, but fails on `nt.force_tid();` and emums are not shown
tinfo_t nt; nt.get_named_type(til, typeName); nt.force_tid();
tinfo_t nt; nt.get_numbered_type(til, ordinal); nt.force_tid();
#elif 0
// bad named but working: desirialized `t` is imported with autogenerated name;
if(t.force_tid() != BADADDR) {
//this `set_named_type` is not required actually - enums may refer to autogenerated name
tinfo_code_t code = t.set_named_type(nullptr, typeName, NTF_TYPE | NTF_REPLACE);
Log(llDebug, "set_named_type('%s') returns %d\n", typeName, code);
}
#elif0
//INTERR 140 on some enums inside some tils (ex: MACRO_INVALID_HANDLE_VALUE in vc10_64)
This file has been truncated. show original