Optional plugin callback function, called each time when user opens menu in the main OllyDbg window or in one of the standard OllyDbg windows, like CPU or Memory. Allows plugins to insert their own menu items.

t_menu *ODBG2_Pluginmenu(wchar_t *type);


(in) Pointer to the UNICODE string describing the window that opens menu. Available strings are defined as constants PWM_xxx in the file plugin.h:
PWM_ATTACH - list of processes in the Attach window
PWM_BPHARD - hardware breakpoints
PWM_BPMEM - memory breakpoints
PWM_BPOINT - INT3 breakpoints
PWM_DISASM - CPU Disassembler pane
PWM_DUMP - all dump windows except CPU disassembler and CPU stack
PWM_INFO - CPU Info pane
PWM_LOG - Log window
PWM_MAIN - main OllyDbg menu
PWM_MEMORY - Memory window
PWM_MODULES - Modules window
PWM_NAMELIST - list of names (labels)
PWM_PATCHES - list of patches
PWM_PROFILE - Profile window
PWM_REGISTERS - registers, including CPU window
PWM_SEARCH - search tabs
PWM_SOURCE - Source code
PWM_SRCLIST - list of source files
PWM_STACK - CPU Stack pane
PWM_THREADS - Threads window
PWM_TRACE - Run trace window
PWM_WATCH - Watches window
PWM_WINDOWS - list of windows owned by the debugged application

Return values:

If there are no items that plugin would like to insert into menu, it must return NULL. Otherwise, it must return pointer to the array of structures of type t_menu.Last element in the array must have t_menu.name set to NULL. Forwarders to standard OllyDbg menus are not allowed. OllyDbg menus are described here.

Menu arrays are usually static. They list all possible menu items, even those that apply only under certain conditions. When OllyDbg builds the menu, it calls menu function associated with each item, asking whether this item should be included or not (mode=MENU_VERIFY).

If user selects menu item belonging to the plugin, OllyDbg will call menu function again, this time passing mode=MENU_EXECUTE. Note that all threads of the debugged application at this moment are suspended. If processing is lengthy and application should continue execution,
call Resumeallthreads() at the entry to the MENU_EXECUTE block and Suspendallthreads() on exit.

If array consists of the single item, it will appear directly. Otherwise, OllyDbg will create a submenu with the name of plugin.
Therefore if there is only one menu item, make its name as descriptive as possible.


See annotated copy of bookmark.c

See also:
Analysis, menus, plugins