ODBG_Pluginmenu

OllyDbg Plugin API

ODBG_Pluginmenu

Optional callback function. If present, OllyDbg calls it to give plugin the possibility to add menu items either to main OllyDbg menu (origin=PM_MAIN) or to popup menu in one of standard OllyDbg windows. To add menu items, plugin must prepare string that describes menu structure and return 1, otherwise it must return 0. As a general OllyDbg rule, do not add inactive items to menu.

int ODBG_Pluginmenu(int origin,char data[4096],void *item);

Parameters:

origin - code of window that calls ODBG_Pluginmenu. OllyDbg supports following codes:

Code Cast item to Who calls ODBG_Pluginmenu
PM_MAIN item is always NULL Main window
PM_DUMP (t_dump *) Any Dump window
PM_MODULES (t_module *) Modules window
PM_MEMORY (t_memory *) Memory window
PM_THREADS (t_thread *) Threads window
PM_BREAKPOINTS (t_bpoint *) Breakpoints window
PM_REFERENCES (t_ref *) References window
PM_RTRACE (int *) Run trace window
PM_WATCHES (1-based index) Watches window
PM_WINDOWS (t_window *) Windows window
PM_DISASM (t_dump *) CPU Disassembler
PM_CPUDUMP (t_dump *) CPU Dump
PM_CPUSTACK (t_dump *) CPU Stack
PM_CPUREGS (t_reg *) CPU Registers

data - pointer to buffer 4K bytes long that receives description of menu structure. Ordinary menu item consists of decimal identificator (0 to 63) followed by name. When user selects some menu item, Pluginaction receives identifier of this item. Duplicated identifiers are allowed. Use comma (,) to separate menu items. Vertical line (|) places horizontal dividing line in menu. To create submenu, add its name followed by contents of submenu enclosed into braces. OllyDbg automatically removes unnecessary or duplicated separators and empty submenus. To force horizontal dividing line, use # symbol. Some examples:

0 &Aaa,2 &Bbb|3 &Ccc|,, Linear menu with 3 items: Aaa, Bbb and Ccc, relative IDs 0, 2 and 3, menu shortcuts A, B and C. Separator between second and third item, last separator and commas are ignored
#A{0Aaa,B{1Bbb|2Ccc}} Unconditional separator, followed by popup menu A with two elements, second of them is popup B with two elements and separator inbetween

item - pointer either to selected element of sorted data displayed in window or, in case of dump windows, pointer to dump descriptor. Can be NULL. You may need this element to find out which menu items apply to selecetd item.

See also: ODBG_Pluginaction, Pluginaction, Plugingetvalue