VSS 2010+IDA SDKはIDA Plugin開発環境を構築する。

7507 ワード

http://www.h4ck.org.cn/2011/11/vs2010-idasdk6-2-ida-plugin-development/
 
1. メニューを実行するFile->New->Project… (Ctrl-Shift-N)新規プロジェクトウィンドウを開きます。 
2. 左側のビジュアルを展開します。 C++プロジェクトテンプレートのブランチを選択し、右側のWin 32を選択します。 プロジェクト項目を入力し、プロジェクト名を入力して確定をクリックします。
3. Win 32アプリで Wizardが現れたら、左のアプリをクリックしてください。 Settings接続、
設定画面でDLLオプションをチェックし、Emptyを選択します。 プロジェクトは、完了ボタンをクリックしてウィザードを終了します。
4. 左のソリューションブラウザでソースファイルをクリックし、追加を実行し、新規項目に新しいソースファイルを追加します。
5. 選択 C++ ファイルテンプレートにファイル名を入力し、追加ボタンをクリックしてこのファイルを追加します。
6.項目の属性を変更します。 左上の配置プルダウンでReleaseを選択します。 属性の変更
 
一般的にターゲットファイルの拡張子を.plwに変更します。 
 
C/C++->通常はディレクトリ追加idaを含みます。 sdk includeディレクトリ、例えばC:\IDA 64\IDASDK 64\Include 
C/C+->プリプロセッサに、__u uを追加します。NTうIDP__フィールドはプリプロセッサ定義にあります。 
C/C+->コード生成、バッファセキュリティチェックをオフにし、基本運転時のチェックをデフォルトにし、ライブラリをマルチスレッド(MT)に設定します。
C/C++->高級で、呼び出しの約束を__u_uに変更します。stdcal (/Gz) 
コネクタ->一般的には、出力ファイルをIDaプラグインディレクトリに変更します。例えばC:\IDA 64\plugins\$
コネクタ->入力は、 ida.lib 追加の依存項に追加します。C:\IDA 64\idasdk 64\lib\x 86_ウインvc_32\ida.lib
コネクタ->デバッグし、デバッグ情報を生成します。 コネクタ->コマンドライン追加/EXPORT:PLUGIN 
 
イベント->後期にイベントを生成し、IDaをコマンドラインに追加しながら、生成後にロードプラグインを起動して実行します。設定しなくてもいいです。 
すべての設定が完了したら保存をクリックして設定ウィンドウを閉じ、上部の配置欄でreleaseを選択すればいいです。
 
以下はコードを書き始めてテストを行うことができます。ここには簡単なプラグインテンプレートがあります。再構築して新しいプラグインを作成できます。
#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>

int __stdcall IDAP_init ( void )
{
  // Do checks here to ensure your plug-in is being used within
  // an environment it was written for. Return PLUGIN_SKIP if the
  // checks fail, otherwise return PLUGIN_KEEP.

  return ( PLUGIN.flags & PLUGIN_UNL ) ? PLUGIN_OK : PLUGIN_KEEP;
}

void __stdcall IDAP_term ( void )
{
  // Stuff to do when exiting, generally you'd put any sort
  // of clean-up jobs here.
  return;
}

// The plugin can be passed an integer argument from the plugins.cfg
// file. This can be useful when you want the one plug-in to do
// something different depending on the hot-key pressed or menu
// item selected.
void __stdcall IDAP_run ( int arg )
{
  // The "meat" of your plug-in
  msg ( "Hello world By obaby!
" ); msg ( "This is My first IDA Plugin!
" ); msg ( "Plugin templete Created by Steve Micallef!
" ); msg ( "Thx for his Great Works!
" ); return; } // There isn't much use for these yet, but I set them anyway. char IDAP_comment[] = "This is my test plug-in"; char IDAP_help[] = "My plugin"; // The name of the plug-in displayed in the Edit->Plugins menu. It can // be overridden in the user's plugins.cfg file. char IDAP_name[] = "My plugin"; // The hot-key the user can use to run your plug-in. char IDAP_hotkey[] = "Ctrl-Alt-X"; // The all-important exported PLUGIN object plugin_t PLUGIN = { IDP_INTERFACE_VERSION, // IDA version plug-in is written for PLUGIN_UNL, // Flags (see below) IDAP_init, // Initialisation function IDAP_term, // Clean-up function IDAP_run, // Main plug-in body IDAP_comment, // Comment unused IDAP_help, // As above unused IDAP_name, // Plug-in name shown in IDAP_hotkey // Hot key to run the plug-in };