-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplugin.cpp
116 lines (95 loc) · 3.76 KB
/
plugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "plugin.h"
#include "MagicPoints.h"
#include "icons.h"
/*====================================================================================
CBINITDEBUG - Called by debugger when a program is debugged - needs to be EXPORTED
Arguments: cbType
cbInfo - a pointer to a PLUG_CB_INITDEBUG structure.
The szFileName item contains name of file being debugged.
--------------------------------------------------------------------------------------*/
PLUG_EXPORT void __cdecl CBINITDEBUG(CBTYPE cbType, PLUG_CB_INITDEBUG* info)
{
OnInitDbg(info);
}
/*====================================================================================*/
PLUG_EXPORT void __cdecl CBSTOPDEBUG(CBTYPE cbType, PLUG_CB_STOPDEBUG* info)
{
}
/*====================================================================================*/
PLUG_EXPORT void __cdecl CBEXCEPTION(CBTYPE cbType, PLUG_CB_EXCEPTION* info)
{
}
/*====================================================================================*/
PLUG_EXPORT void __cdecl CBDEBUGEVENT(CBTYPE cbType, PLUG_CB_DEBUGEVENT* info)
{
}
/*====================================================================================
CBSYSTEMBREAKPOINT - Called by debugger at system breakpoint - needs to be EXPORTED
Arguments: cbType
cbInfo - a pointer to a PLUG_CB_SYSTEMBREAKPOINT structure
--------------------------------------------------------------------------------------*/
PLUG_EXPORT void __cdecl CBSYSTEMBREAKPOINT(CBTYPE cbType, PLUG_CB_SYSTEMBREAKPOINT* cbInfo)
{
}
/*====================================================================================*/
PLUG_EXPORT void __cdecl CBBREAKPOINT(CBTYPE cbType, PLUG_CB_BREAKPOINT* bpInfo)
{
}
/*====================================================================================*/
PLUG_EXPORT void __cdecl CBLOADDLL(CBTYPE cbType, PLUG_CB_LOADDLL *cbInfo)
{
}
/*====================================================================================
CBMENUENTRY - Called by debugger when a menu item is clicked - needs to be EXPORTED
Arguments: cbType
cbInfo - a pointer to a PLUG_CB_MENUENTRY structure. The hEntry contains
the resource id of menu item identifiers
Notes: hEntry can be used to determine if the user has clicked on your plugins
menu item(s) and to do something in response to it.
--------------------------------------------------------------------------------------*/
PLUG_EXPORT void __cdecl CBMENUENTRY(CBTYPE cbType, PLUG_CB_MENUENTRY* info)
{
switch(info->hEntry)
{
case MENU_GET_MC:
DbgCmdExec("GetMagicPoints");
break;
case MENU_ABOUT:
ShowAboutForm();
break;
default:
break;
}
}
/*====================================================================================*/
//Initialize your plugin data here.
bool pluginInit(PLUG_INITSTRUCT* initStruct)
{
_plugin_registercommand(pluginHandle, "GetMagicPoints", cbSetMagicPoints, true);
return true; //Return false to cancel loading the plugin.
}
/*====================================================================================*/
//Deinitialize your plugin data here (clearing menus optional).
bool pluginStop()
{
_plugin_unregistercommand(pluginHandle, "GetMagicPoints");
_plugin_menuclear(hMenu);
_plugin_menuclear(hMenuDisasm);
_plugin_menuclear(hMenuDump);
_plugin_menuclear(hMenuStack);
return true;
}
/*====================================================================================*/
//Do GUI/Menu related things here.
void pluginSetup()
{
ICONDATA menu_icon;
menu_icon.data = icon;
menu_icon.size = sizeof(icon);
// Plugin Menu
_plugin_menuseticon(hMenu, &menu_icon);
_plugin_menuaddentry(hMenu, MENU_GET_MC, "&Find Magic Points");
_plugin_menuaddseparator(hMenu);
_plugin_menuaddentry(hMenu, MENU_ABOUT, "&About...");
}
/*====================================================================================*/