📄 plugin.h
字号:
////////////////////////////////////////////////////////////////////////////////
// //
// OLLYDBG PLUGIN API //
// //
// Version 1.10 //
// //
// Written by Oleh Yuschuk (ollydbg@t-online.de) //
// //
// Internet: http://home.t-online.de/home/Ollydbg //
// //
// This code is distributed "as is", without warranty of any kind, expressed //
// or implied, including, but not limited to warranty of fitness for any //
// particular purpose. In no event will Oleh Yuschuk be liable to you for any //
// special, incidental, indirect, consequential or any other damages caused //
// by the use, misuse, or the inability to use of this code, including any //
// lost profits or lost savings, even if Oleh Yuschuk has been advised of the //
// possibility of such damages. //
// //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////// IMPORTANT INFORMATION /////////////////////////////
// 1. Export all callback functions by name, NOT by ordinal!
// 2. Force byte alignment of OllyDbg structures!
// 3. Set default char type to unsigned!
// 4. Read documentation!
// If you prefere Borland, this will force necessary settings (but, as a side
// effect, may cause plenty of warnings if other include files will be compiled
// with different options):
#ifdef __BORLANDC__
#pragma option -a1 // Byte alignment
#pragma option -K // Unsigned char
// And here I check that settings are correct. Unfortunately, Microsoft C (at
// least C++ 5.0) doesn't allow for sizeof and typecasts in conditionals:
typedef struct t_aligntest {
char a;
long b;
} t_aligntest;
#if (sizeof(t_aligntest)!=sizeof(char)+sizeof(long))
#error Please assure byte alignment of OllyDbg structures
#endif
#undef t_aligntest
#if ((char)0xFF!=255)
#error Please set default char type to unsigned
#endif
#endif
// If you like Microsoft compiler, this will force byte alignment and verify
// that character is set to unsigned.
#ifdef _MSC_VER
#pragma pack(1) // Force byte alignment of structures
#ifndef _CHAR_UNSIGNED // Verify that character is unsigned
#error Please set default char type to unsigned (option /J)
#endif
// Borland adds underscore to export automatically, whereas I don't know any
// such option for Microsoft compiler. This solution is not too elegant but
// works.
#define ODBG_Plugindata _ODBG_Plugindata
#define ODBG_Plugininit _ODBG_Plugininit
#define ODBG_Pluginmainloop _ODBG_Pluginmainloop
#define ODBG_Pluginsaveudd _ODBG_Pluginsaveudd
#define ODBG_Pluginuddrecord _ODBG_Pluginuddrecord
#define ODBG_Pluginmenu _ODBG_Pluginmenu
#define ODBG_Pluginaction _ODBG_Pluginaction
#define ODBG_Pluginshortcut _ODBG_Pluginshortcut
#define ODBG_Pluginreset _ODBG_Pluginreset
#define ODBG_Pluginclose _ODBG_Pluginclose
#define ODBG_Plugindestroy _ODBG_Plugindestroy
#define ODBG_Paused _ODBG_Paused
#define ODBG_Pausedex _ODBG_Pausedex
#define ODBG_Plugincmd _ODBG_Plugincmd
#endif
////////////////////////////////////////////////////////////////////////////////
///////////////////////////// GENERAL DECLARATIONS /////////////////////////////
#define PLUGIN_VERSION 110 // Version of plugin interface
#ifdef __cplusplus
#define extc extern "C" // Assure that names are not mangled
#else
#define extc extern
#endif
#define _export __declspec(dllexport)
typedef unsigned char uchar; // Unsigned character (byte)
typedef unsigned short ushort; // Unsigned short
typedef unsigned int uint; // Unsigned integer
typedef unsigned long ulong; // Unsigned long
#define TEXTLEN 256 // Maximal length of text string
#define ARGLEN 1024 // Maximal length of argument string
#define USERLEN 4096 // Maximal length of record in .udd file
#define SHORTLEN 8 // Maximal length of short name
#define BLACK 0 // Indices of colours used by OllyDbg. In
#define BLUE 1 // syntax highlighting, use only colours
#define GREEN 2 // 0 to 15 in the least significant bits
#define CYAN 3 // of the corresponding mask byte.
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define LIGHTGRAY 7
#define DARKGRAY 8
#define LIGHTBLUE 9
#define LIGHTGREEN 10
#define LIGHTCYAN 11
#define LIGHTRED 12
#define LIGHTMAGENTA 13
#define YELLOW 14
#define WHITE 15
#define MINT 16
#define SKYBLUE 17
#define IVORY 18
#define GRAY 19
#define NCOLORS 20 // Total number of defined colours
#define BKTRANSP 0x00 // Background colours in syntax hiliting
#define BKBLACK 0x10
#define BKGRAY 0x20
#define BKWHITE 0x30
#define BKCYAN 0x40
#define BKGREEN 0x50
#define BKRED 0x60
#define BKYELLOW 0x70
#define BLACKWHITE 0 // Colour schemes used by OllyDbg
#define BLUEGOLD 1
#define SKYWIND 2
#define NIGHTSTARS 3
#define SCHEME4 4
#define SCHEME5 5
#define SCHEME6 6
#define SCHEME7 7
#define FIXEDFONT 0 // Fonts used by OllyDbg. Variable-pitch
#define TERMINAL6 1 // fonts are placed at the end of this
#define FIXEDSYS 2 // table.
#define COURIERFONT 3
#define LUCIDACONS 4
#define FONT5 5
#define FONT6 6
#define FONT7 7
#define MAINFONT 8
#define SYSFONT 9
#define INFOFONT 10
////////////////////////////////////////////////////////////////////////////////
//////////////////////////// INFORMATION FUNCTIONS /////////////////////////////
extc void cdecl Addtolist(long addr,int highlight,char *format,...);
extc void cdecl Updatelist(void);
extc HWND cdecl Createlistwindow(void);
extc void cdecl Error(char *format,...);
extc void cdecl Message(ulong addr,char *format,...);
extc void cdecl Infoline(char *format,...);
extc void cdecl Progress(int promille,char *format,...);
extc void cdecl Flash(char *format,...);
////////////////////////////////////////////////////////////////////////////////
////////////////////////// DATA FORMATTING FUNCTIONS ///////////////////////////
// Bits used in Decodeaddress(), Decoderelativeoffset() and Decodethreadname()
// to specify decoding mode:
#define ADC_DEFAULT 0x0000 // Default decoding mode
#define ADC_DIFFMOD 0x0001 // Show module only if different
#define ADC_NOMODNAME 0x0002 // Never show module name
#define ADC_VALID 0x0004 // Only decode if allocated memory
#define ADC_INMODULE 0x0008 // Only decode if in some module
#define ADC_SAMEMOD 0x0010 // Decode only address in same module
#define ADC_SYMBOL 0x0020 // Only decode if symbolic name
#define ADC_JUMP 0x0040 // Check if points to JMP/CALL command
#define ADC_OFFSET 0x0080 // Check if symbol for data
#define ADC_STRING 0x0100 // Check if pointer to ASCII or UNICODE
#define ADC_ENTRY 0x0200 // Check if entry to subroutine
#define ADC_UPPERCASE 0x0400 // First letter in uppercase if possible
#define ADC_WIDEFORM 0x0800 // Extended form of decoded name
#define ADC_NONTRIVIAL 0x1000 // Name + non-zero offset
#define ADC_DYNAMIC 0x2000 // JMP/CALL to dynamically loaded name
#define PLAINASCII 0x01 // Plain ASCII character
#define DIACRITICAL 0x02 // Diacritical character
#define RAREASCII 0x10 // Rare ASCII character
extc int cdecl Decodeaddress(ulong addr,ulong base,int addrmode,
char *symb,int nsymb,char *comment);
extc int cdecl Decoderelativeoffset(ulong addr,int addrmode,
char *symb,int nsymb);
extc int cdecl Decodecharacter(char *s,uint c);
extc int cdecl Printfloat4(char *s,float f);
extc int cdecl Printfloat8(char *s,double d);
extc int cdecl Printfloat10(char *s,long double ext);
extc int cdecl Print3dnow(char *s,uchar *f);
extc int cdecl Printsse(char *s,char *f);
extc ulong cdecl Followcall(ulong addr);
extc int cdecl IstextA(char c);
extc int cdecl IstextW(wchar_t w);
extc int cdecl Stringtotext(char *data,int ndata,char *text,int ntext);
////////////////////////////////////////////////////////////////////////////////
///////////////////////////// DATA INPUT FUNCTIONS /////////////////////////////
#define MAXCMDSIZE 16 // Maximal length of 80x86 command
#define NSEQ 8 // Max length of command sequence
#define NMODELS 8 // Number of assembler search models
// Note that each of dialog functions decodes only subset of listed flags.
#define DIA_ASKGLOBAL 0x0001 // Display checkbox "Global search"
#define DIA_HEXONLY 0x0002 // Hexadecimal format only
#define DIA_ALIGNED 0x0004 // Display checkbox "Aligned search"
#define DIA_DEFHEX 0x0000 // On startup, cursor in hex control
#define DIA_DEFASCII 0x0010 // On startup, cursor in ASCII control
#define DIA_DEFUNICODE 0x0020 // On startup, cursor in UNICODE control
#define DIA_SEARCH 0x0040 // Is a search dialog
#define DIA_HISTORY 0x0100 // Allows previous hex strings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -