Ollydbg Plugin 開発環境構築メモ

参考URL
http://www.ollydbg.de/pdk.htm


必要なもの
Ollydbg Plugin Development Kit(上記の参考URLからダウンロード)
Borland's C++ 5.5 (http://www.borland.com/からダウンロードできるFreeのCコンパイラ。日本語版はこちら

※本来ならば、VC6などを使いたいところだが、ライブラリのソースコードが公開されていないためできない。
開発者に公開してほしいものです。

前準備
Borland C++ Compilerをインストール
1)exeファイルをダウンロードしてきて実行
2)「C:\borland\bcc55」にコンパイラを含むバイナリ、ライブラリ、ヘッダファイル等がインストールされているはず。
3)もともとの環境としてVC6が入ったりしているので環境変数をいじるのはちょっとやりたくない。Borland Cコンパイラを使うときだけパスを通したいので、作業ディレクトリにバッチファイルを作成。
///SETBINPATH.BAT//////////////////////////////////////////////////
@echo "Set Borland C++ Compiler "PATH" "LIB" "INCLUDE" Path\n"
@set PATH=C:\Borland\bcc55\bin;%PATH%
////////////////////////////////////////////////////////////////////

4)C:\borland\bcc55\bin ディレクトリ以下にbcc32.cfg, link32.cfg ファイルを作成
///bcc32.cfg/////////////////////////////////////////////////////////
-I"C:\borland\bcc55\Include"
-L"C:\borland\bcc55\Lib;C:\borland\bcc55\Lib\PSDK"
////////////////////////////////////////////////////////////////////

///link32.cfg/////////////////////////////////////////////////////////
-L"C:\borland\bcc55\Lib;C:\borland\bcc55\Lib\PSDK"
////////////////////////////////////////////////////////////////////

5)サンプルコード HelloWorld.cを作成しコンパイル、リンク、実行ができることを確認

Ollydbg Plugin Development Kitの環境設定
1)参考URLよりPDKをダウンロードし展開
2)bookmark.c bc55\bookmark..mak pluing.hを同じディレクトリへ移動する
3)make -f bookmark.mak
4)Bookmark.dllが作成されたことを確認

自作のPluginを作成する場合は
//////////////////////////////////////////////////////
Suppose that you write your own plugin, myplug, consisting of source files a.c, b.c and resource c.rc. All you need is to rename bookmark.mak to myplug.mak and modify three lines near the top of the file in a following way:
PROJECT = myplug.dll
OBJFILES = a.obj b.obj
RESFILES = c.rc
and then command
c:\bc55\bin\make -f myplug.mak
//////////////////////////////////////////////////////

以上