Sometimes there's some inconsistency between local types and structs view.
Typically, you can see the type in the "Structures" view are zero-lengthed, which should normally be the same size as local type's one.
When this happens, you'll not be able to rename the structure fields in HexRay Decompiler's view, and both hotkey N and right-clicking the item won't show the rename popup.
After reverse engineering the hexx64.dll, I found that IDA tries to do the following things:
if (vd->item->get_memptr()) { /* Add the rename handler */ }
and in get_memptr()
, it's doing:
const char *name = expr->x->type.get_type_name()
struc_t *struc = get_struc(get_struc_id(name))
member_t *member = get_member(struc, expr->m)
After debugging, it seems that name and struc can be retrieved, but member are not. Replaying the operations in IDAPython also fails.
I thought it's because that IDA didn't import the type correctly last time, so I wrote the script above to fix it.