Plugin Development Kit 1.10

Download PDK 1.10

Compilation

To compile your own plugin, you need some C or C++ compiler (together with linker and run-time libraries). Plugin interface (file plugin.h) is compatible at least with following compilers:

I haven't tried any other compilers. Please let me know if you find any incompatibilities and, if possible, send me corrected version of file plugin.h.

Plugin Development Kit includes source code for two fully functional sample plugins: bookmark, that allows to set up to 10 bookmarks in debugged application, and command line, that implements command line interface. Plugins are well documented. You can use them as a template for your own plugins. They are freeware, i.e. your rights to modify and re-use their source code are not limited in any way.

Following compiler settings are required for correct communication between plugin and OllyDbg. For compilers listed above, plugin.h forces or checks some of these rules:

Keep in mind that all pointers you get from OllyDbg may be NULL. This is a very common error to assume opposite.

Use static run-time libraries linked directly into your plugin, otherwise differences between versions of run-time DLLs will make OllyDbg unstable. Do not split your plugin unnecessarily into several DLLs. If you need data files that are not modifiable by user, try to place this data directly into your plugin as a resource.

To link your plugin to OllyDbg, you also need import library ollydbg.lib. Some compilers (Borland) include utility called implib that scans executable file (in our case, ollydbg.exe) and produces a special kind of library with a list of all exported functions. Some other products, like MSVC, can generate import library from the definition file (ollydbg.def). Similar products from other vendors are also available. For details, please consult documentation.

And, last but not least, don't waste resources! Don't export unused callback functions and make your program fast! OllyDbg in current version supports up to 32 plugins. If each of them will take only 50 ms to reject a global shortcut, then 50 ms for window-specific shortcut... you DO understand what I mean, don't you?
 

Contents of plug110.zip

Plugin kit archive contains following files:

Root directory:

bookmark.c - source of bookmark plugin
cmdexec.c - source of command line plugin
command.c - source of command line plugin
cmdline.rtf - RTF source of help (.hlp) file for command line plugin
ollydbg.def - OllyDbg definition file, some compilers need it to produce import library ollydbg.lib
plugin.h - header with definitions of plugin interface
plugins.hlp - this help file
Directory BC55: sample.bpr - project file for BCB 5, produces sample.dll (same as bookmark.dll)
sample.cpp - main file for sample.bpr
bookmark.mak - make file for BC 5.5, produces bookmark.dll
cmdline.bpr - project file for BCB 5, produces cmdline.dll
cmdline.cpp - main file for cmdline.bpr
cmdline.mak - make file for BC 5.5, produces cmdline.dll
ollydbg.lib - OllyDbg import library in OMF format
Directory VC50: bookmark.dsp - project file for Visual Studio 97, produces bookmark.dll
bookmark.dsw - project file for Visual Studio 97, produces bookmark.dll
bookmark.mak - make file for VC 5.0, produces bookmark.dll
cmdline.dsp - project file for Visual Studio 97, produces cmdline.dll
cmdline.dsw - project file for Visual Studio 97, produces cmdline.dll
cmdline.mak - make file for VC 5.0, produces cmdline.dll
ollydbg.lib - OllyDbg import library in COFF format
Making sample plugins with BC5.5

To build sample DLLs with BC 5.5, please do the following:

1. Copy files bookmark.c, cmdexec.c, command.c, plugin.h, bc55\bookmark.mak, bc55\cmdline.mak, bc55\ollydbg.lib to same directory;

2. Assuming that your BC 5.5 compiler is installed to c:\bc55, issue following commands:

c:\bc55\bin\make -f bookmark.mak
c:\bc55\bin\make -f cmdline.mak
3. 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 Making sample plugins with BCB 5

BCB projects must contain main C++ program with the same name as project and extention .cpp. For this reason, bookmark plugin created with Builder is called sample.dll. Of course, this has no influence on its functionality.

To build sample.dll, please do the following:

1. Copy files bookmark.c, plugin.h, bc55\sample.bpr, bc55\sample.cpp and bc55\ollydbg.lib to the same directory;

2. Open sample.bpr in Builder and make project.

To build cmdline.dll, please do the following:

1. Copy files cmdexec.c, command.c, plugin.h, bc55\cmdline.bpr, bc55\cmdline.cpp and bc55\ollydbg.lib to the same directory;

2. Open cmdline.bpr in Builder and make project.
 

Making sample plugins with VC 5.0 from the command line

To build sample DLLs with VC 5.0, please do the following:

1. Copy files bookmark.c, cmdexec.c, command.c, plugin.h, vc50\bookmark.mak, vc50\cmdline.mak and vc50\ollydbg.lib to the same directory;

2. In .mak files, edit lines

INCLUDE=c:\vc\include
LIBPATH=c:\vc\lib
so that they point to your include and library directories;

3. Assuming that your VC compiler, cl.exe, and make utility, nmake.exe, reside in c:\vc\bin, execute following commands:

c:\vc\bin\nmake -f bookmark.mak
c:\vc\bin\nmake -f cmdline.mak
Making sample plugins from the Visual Studio

To build bookmark.dll:

1. Copy files bookmark.c, plugin.h, vc50\bookmark.dsp, vc50\bookmark.dsw and vc50\ollydbg.lib to the same directory;

2. Open project bookmark in Visual Studio and make it.

To build cmdline.dll:

1. Copy files cmdexec.c, command.c, plugin.h, vc50\cmdline.dsp, vc50\cmdline.dsw and vc50\ollydbg.lib to the same directory;

2. Open project cmdline in Visual Studio and make it.