Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ida/main_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "third_party/zynamics/binexport/ida/begin_idasdk.inc" // NOLINT
#include <bytes.hpp> // NOLINT
#include <diskio.hpp> // NOLINT
#include <enum.hpp> // NOLINT
#include <expr.hpp> // NOLINT
#include <frame.hpp> // NOLINT
#include <funcs.hpp> // NOLINT
Expand All @@ -41,9 +40,12 @@
#include <loader.hpp> // NOLINT
#include <nalt.hpp> // NOLINT
#include <name.hpp> // NOLINT
#include <struct.hpp> // NOLINT
#include <ua.hpp> // NOLINT
#include <xref.hpp> // NOLINT
#if IDP_INTERFACE_VERSION < 900
#include <enum.hpp> // NOLINT
#include <struct.hpp> // NOLINT
#endif
#include "third_party/zynamics/binexport/ida/end_idasdk.inc" // NOLINT
// clang-format on

Expand Down
37 changes: 35 additions & 2 deletions ida/results.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@

// clang-format off
#include "third_party/zynamics/binexport/ida/begin_idasdk.inc" // NOLINT
#include <idp.hpp> // NOLINT
#include <bytes.hpp> // NOLINT
#include <funcs.hpp> // NOLINT
#include <frame.hpp> // NOLINT
#include <enum.hpp> // NOLINT
#include <ida.hpp> // NOLINT
#include <kernwin.hpp> // NOLINT
#include <lines.hpp> // NOLINT
#include <netnode.hpp> // NOLINT
#include <name.hpp> // NOLINT
#include <struct.hpp> // NOLINT
#include <ua.hpp> // NOLINT
#include <xref.hpp> // NOLINT
#if IDP_INTERFACE_VERSION >= 900
#include <typeinf.hpp> // NOLINT
#else
#include <enum.hpp> // NOLINT
#include <struct.hpp> // NOLINT
#endif
#include "third_party/zynamics/binexport/ida/end_idasdk.inc" // NOLINT
// clang-format on

Expand Down Expand Up @@ -209,6 +214,14 @@ size_t SetComments(Address source, Address target,
comment.repeatable);
break;
case Comment::ENUM: {
#if IDP_INTERFACE_VERSION >= 900
if (is_enum0(get_full_flags(static_cast<ea_t>(address))) || is_enum1(get_full_flags(static_cast<ea_t>(address)))) {
tinfo_t tif;
if (get_tinfo(&tif, address) && tif.is_enum()) {
tif.rename_type(comment.comment.c_str());
}
}
#else
uint8_t serial;
if (is_enum0(get_full_flags(static_cast<ea_t>(address))) &&
operand_id == 0) {
Expand All @@ -226,6 +239,7 @@ size_t SetComments(Address source, Address target,
set_enum_name(id, comment.comment.c_str());
}
}
#endif
break;
}
case Comment::FUNCTION:
Expand Down Expand Up @@ -275,10 +289,21 @@ size_t SetComments(Address source, Address target,
if (!function) {
break;
}
#if IDP_INTERFACE_VERSION >= 900
tinfo_t frame_tif;
if (!get_func_frame(&frame_tif, function)) {
break;
}
udt_type_data_t udt_data;
if (!frame_tif.get_udt_details(&udt_data)) {
break;
}
#else
struc_t* frame = get_frame(function);
if (!frame) {
break;
}
#endif
insn_t instruction;
if (decode_insn(&instruction, address) <= 0) {
break;
Expand All @@ -291,7 +316,15 @@ size_t SetComments(Address source, Address target,
}

if (operand_num == operand_id - UA_MAXOP - 2048) {
#if IDP_INTERFACE_VERSION >= 900
udm_t udm;
udm.offset = offset;
if (auto idx = frame_tif.find_udm(&udm, STRMEM_AUTO); idx != -1) {
frame_tif.rename_udm(idx, comment.comment.c_str());
}
#else
set_member_name(frame, offset, comment.comment.c_str());
#endif
}
}
break;
Expand Down