diff --git a/include/interfaces/STARSIDATypes.h b/include/interfaces/STARSIDATypes.h index 94ba7aacf1e8ee3da05bc21843f5d56f590025d3..92be98444fc209506e4da7a32831f98dcd660e55 100644 --- a/include/interfaces/STARSIDATypes.h +++ b/include/interfaces/STARSIDATypes.h @@ -49,6 +49,7 @@ // #include <fpro.h> // for qf... functions #include <bytes.hpp> // for getFlags(), isCode(), IsHead(), get_item_end(), next_head(), get_flags_novalue() #include <frame.hpp> // for get_frame() +#include <ida.hpp> // for ::inf.is_dll() // #include <kernwin.hpp> // for msg() // #include <lines.hpp> // for tag_remove() #include <name.hpp> // for get_true_name() @@ -108,6 +109,14 @@ typedef range_t STARS_area_t; // #define SMP_get_true_name(from, ea, buf, bufsize) get_true_name(from, ea, buf, bufsize) #define SMP_next_head(ea, maxea) next_head(ea, maxea) +#if (IDA_SDK_VERSION < 750) +#define SMP_is_dll() ::inf.is_dll() +#define SMP_is_64bit() ::inf.is_64bit() +#else +#define SMP_is_dll() ::inf_is_dll() +#define SMP_is_64bit() ::inf_is_64bit() +#endif + #define SMP_add_cref(from, to, type) add_cref(from, to, type) struct SMP_xref_t { diff --git a/include/interfaces/idapro/all.h b/include/interfaces/idapro/all.h index 51199ad6af006c67191f3f1316fad09e9b6e912a..c1e0e87dfbad9d0f3377b3a4ef8e278fd70c2aa4 100644 --- a/include/interfaces/idapro/all.h +++ b/include/interfaces/idapro/all.h @@ -8,6 +8,7 @@ #pragma GCC diagnostic ignored "-Wparentheses" #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wclass-memaccess" +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #include <fpro.h> #include <pro.h> diff --git a/src/drivers/idapro/SMPStaticAnalyzer.cpp b/src/drivers/idapro/SMPStaticAnalyzer.cpp index e1796040c9d3559431d301e73357ed9f49523f82..ae6e80af5e6e323806cf224161f7a19e28ad20ff 100644 --- a/src/drivers/idapro/SMPStaticAnalyzer.cpp +++ b/src/drivers/idapro/SMPStaticAnalyzer.cpp @@ -49,7 +49,7 @@ #include <bytes.hpp> #include <nalt.hpp> #endif -#include <loader.hpp> +#include <loader.hpp> // for plugin_t #include "interfaces/STARSTypes.h" #include "interfaces/STARSIDATypes.h" @@ -175,7 +175,7 @@ set<string> ZST_SystemCallNumericWhitelist; #if (IDA_SDK_VERSION < 700) void IDAP_run(int); #else -bool IDAP_run(size_t); +bool IDAP_run(std::size_t); #endif // Functions for diagnosing and/or fixing problems in the IDA database. @@ -196,7 +196,7 @@ static unsigned long DebugCounter = 0; // Turn LOCK prefix into no-op when detected. Each is one byte in length. bool STARS_custom_ana(STARS_ea_t CurrentAddr) { // static_assert(sizeof(STARS_ea_t) == sizeof(uintptr_t), "Sizeof mismatch between STARS_ea_t and uintptr_t"); - int code = get_byte(CurrentAddr); + int code = ::get_byte(CurrentAddr); ++CustomAnaCallCount; if (X86_LOCK_PREFIX != code) { return false; @@ -295,7 +295,19 @@ static ssize_t idaapi idp_callback(void *, int event_id, va_list va) { return 0; // did not process any event } // end of idp_callback() +#if (IDA_SDK_VERSION < 750) int IDAP_init(void) { +#else +struct STARS_plugmod_t : public plugmod_t { + bool run(std::size_t arg) { + return IDAP_run(arg); + } +}; +static STARS_plugmod_t PluginModuleStruct; + +plugmod_t *IDAP_init(void) { +#endif + /* init the interface */ global_stars_interface = new STARS_IDA_Interface_t; @@ -314,7 +326,11 @@ int IDAP_init(void) { if (ph.id != PLFM_386 && ph.id != PLFM_ARM && ph.id != PLFM_MIPS) { error("Processor must be x86, ARM or MIPS."); +#if (IDA_SDK_VERSION < 750) return PLUGIN_SKIP; +#else + return nullptr; +#endif } #if (IDA_SDK_VERSION < 700) @@ -326,7 +342,11 @@ int IDAP_init(void) { #ifdef STARS_IRDB_INTERFACE SMPLogFile = nullptr; #endif +#if (IDA_SDK_VERSION < 750) return PLUGIN_KEEP; +#else + return &PluginModuleStruct; +#endif } // end of IDAP_init void IDAP_term(void) { @@ -342,7 +362,7 @@ void IDAP_term(void) { #if (IDA_SDK_VERSION < 700) void IDAP_run(int arg) { #else -bool IDAP_run(size_t arg) { +bool IDAP_run(std::size_t arg) { #endif FILE *AnnotFile = nullptr; FILE *InfoAnnotFile = nullptr; @@ -384,7 +404,7 @@ bool IDAP_run(size_t arg) { SMP_msg("INFO: Size of STARS_ea_t: %zu Size of uintptr_t: %zu \n", sizeof(STARS_ea_t), sizeof(uintptr_t)); SMP_msg("INFO: Size of SMPInstr: %zu Size of SMPBasicBlock: %zu \n", sizeof(SMPInstr), sizeof(SMPBasicBlock)); - if (inf.is_64bit()) { + if (SMP_is_64bit()) { global_STARS_program->Set64BitBinary(); const auto pt = (ph.id == PLFM_386) ? ptX86_64 : (ph.id == PLFM_ARM) ? ptARM64 : diff --git a/src/interfaces/idapro/STARSIDAProgram.cpp b/src/interfaces/idapro/STARSIDAProgram.cpp index db2e55cd98bf7d9fafa053378950428bc92cb9df..32778bbdefff31185be1e42c5276120b5b01219d 100644 --- a/src/interfaces/idapro/STARSIDAProgram.cpp +++ b/src/interfaces/idapro/STARSIDAProgram.cpp @@ -158,7 +158,7 @@ void STARS_IDA_Program_t::DetermineRootFileName(void) { string TempRootString(TempRootName); this->SetRootFileName(TempRootString); - if (::inf.is_dll()) { + if (SMP_is_dll()) { this->SetSharedObjectFlag(true); SMP_msg("INFO: Determined shard object from is_dll() in IDA Pro.\n"); }