Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Commit

Permalink
added support for IDA6.7
Browse files Browse the repository at this point in the history
fixed hotkey collision with IDASkins
increased version number to 1.0.2
  • Loading branch information
Ende! committed Jan 3, 2015
1 parent 4baeca7 commit 1d97fc2
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ set(project_headers
Utils.hpp
Ui.hpp
SubstitutionManager.hpp
ImportExport.hpp)
ImportExport.hpp
REtypedef.hpp)
set(project_sources
Core.cpp
InlineDetour.cpp
Expand Down
4 changes: 2 additions & 2 deletions Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#define CONFIG_HPP

#define MAKE_PLUGIN_VERSION(maj, min, rev) ((maj << 16) | (min << 8) | rev)
#define PLUGIN_TEXTUAL_VERSION "v1.0.1"
#define PLUGIN_VERSION MAKE_PLUGIN_VERSION(1, 0, 1)
#define PLUGIN_TEXTUAL_VERSION "v1.0.2"
#define PLUGIN_VERSION MAKE_PLUGIN_VERSION(1, 0, 2)

#define PLUGIN_NAME "REtypedef"

Expand Down
36 changes: 34 additions & 2 deletions Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
#include "Settings.hpp"
#include "Ui.hpp"
#include "ImportExport.hpp"
#include "RETypedef.hpp"

#include <QDir>
#include <QApplication>
#include <QMessageBox>
#include <idp.hpp>
#include <diskio.hpp>
#include <kernwin.hpp>
#include <loader.hpp>

// =============================================================================================== //
Expand All @@ -44,8 +44,22 @@
Core::Core()
: m_originalMangler(nullptr)
{
add_menu_item("Options", "Edit name substitutions...", nullptr, 0,
#if IDA_SDK_VERSION >= 670
action_desc_t action =
{
sizeof(action),
"retypedef_open_name_subst_editor",
"Edit name substitutions...",
&m_optionsMenuItemClickedAction,
&PLUGIN
};

register_action(action);
attach_action_to_menu("Options/", "retypedef_open_name_subst_editor", 0);
#else
add_menu_item("Options/", "Edit name substitutions...", nullptr, 0,
&Core::onOptionsMenuItemClicked, this);
#endif

// First start? Initialize with default rules.
Settings settings;
Expand Down Expand Up @@ -98,8 +112,26 @@ Core::~Core()
std::terminate();
}

#if IDA_SDK_VERSION >= 670
detach_action_from_menu("Options/", "retypedef_open_name_subst_editor");
unregister_action("retypedef_open_name_subst_editor");
#else
del_menu_item("Options/Edit name substitutions...");
#endif
}

#if IDA_SDK_VERSION >= 670
int Core::OptionsMenuItemClickedAction::activate(action_activation_ctx_t * /*ctx*/)
{
onOptionsMenuItemClicked(&Core::instance());
return 1;
}

action_state_t Core::OptionsMenuItemClickedAction::update(action_update_ctx_t * /*ctx*/)
{
return AST_ENABLE_ALWAYS;
}
#endif

void Core::runPlugin()
{
Expand Down
8 changes: 8 additions & 0 deletions Core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <ida.hpp>
#include <demangle.hpp>
#include <memory>
#include <kernwin.hpp>

// ============================================================================================== //
// [Core] //
Expand Down Expand Up @@ -73,6 +74,13 @@ class Core : public QObject, public Utils::Singleton<Core>
static int32 idaapi demanglerHookCallback(char* answer, uint answerLength,
const char* str, uint32 disableMask);
private:
#if IDA_SDK_VERSION >= 670
struct OptionsMenuItemClickedAction : public action_handler_t
{
int idaapi activate(action_activation_ctx_t *ctx);
action_state_t idaapi update(action_update_ctx_t *ctx);
} m_optionsMenuItemClickedAction;
#endif
/**
* @brief Handles clicks on the "Edit name substitutions" menu entry in IDA.
* @param userData @c this.
Expand Down
32 changes: 32 additions & 0 deletions RETypedef.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2014 athre0z
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef RETYPEDEF_HPP
#define RETYPEDEF_HPP

#include <loader.hpp>

extern plugin_t PLUGIN;

#endif // RETYPEDEF_HPP
5 changes: 2 additions & 3 deletions REtypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

#include "Config.hpp"
#include "Core.hpp"
#include "RETypedef.hpp"

#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>


// ============================================================================================== //
Expand Down Expand Up @@ -80,8 +80,7 @@ plugin_t PLUGIN =
&run,
"Reverse typedef resolution",
"Reverse typedef resolution plugin.",
PLUGIN_NAME ": About",
"Ctrl-Shift-S"
PLUGIN_NAME ": About"
};

// ============================================================================================== //

0 comments on commit 1d97fc2

Please sign in to comment.