Callback structures
These structures are used inside event
callbacks (registered using _plugin_registercallback). Notice that the pointer
'void* callbackInfo' is never NULL, but the members of the various structures
can be NULL. Also remember that you cannot use any of the provided pointers
out of the callback function scope. In general
AVOID time-consuming operations inside
callbacks , do these in
separate
threads.
//Called on debug initialization, useful to initialize
some variables.
struct PLUG_CB_INITDEBUG
{
const char*
szFileName;
};
//Called when the debugging has been stopped, useful to
reset some variables.
struct PLUG_CB_STOPDEBUG
{
void*
reserved;
};
//Called after process creation (in the debug loop),
after the initialization of the symbol handler, the database file and setting
breakpoints on TLS callbacks / the entry breakpoint.
struct PLUG_CB_CREATEPROCESS
{
CREATE_PROCESS_DEBUG_INFO*
CreateProcessInfo;
IMAGEHLP_MODULE64*
modInfo;
const char*
DebugFileName;
PROCESS_INFORMATION*
fdProcessInfo;
};
//Called after the process exits (in the debug loop),
before the symbol handler is cleaned up.
struct PLUG_CB_EXITPROCESS
{
EXIT_PROCESS_DEBUG_INFO*
ExitProcess;
};
//Called after thread creation (in the debug loop),
after adding the thread to the internal thread list, before breaking the
debugger on thread creation and after setting breakpoints on the thread
entry.
struct PLUG_CB_CREATETHREAD
{
CREATE_THREAD_DEBUG_INFO*
CreateThread;
DWORD
dwThreadId;
};
//Called after thread termination (in the debug loop),
before the thread is removed from the internal thread list, before breaking on
thread termination.
struct PLUG_CB_EXITTHREAD
{
EXIT_THREAD_DEBUG_INFO*
ExitThread;
DWORD
dwThreadId;
};
//Called at the system breakpoint (in the debug loop),
after setting the initial dump location, before breaking the debugger on the
system breakpoint.
struct PLUG_CB_SYSTEMBREAKPOINT
{
void* reserved;
};
//Called on DLL loading (in the debug loop), after the
DLL has been added to the internal library list, after setting the DLL entry
breakpoint.
struct PLUG_CB_LOADDLL
{
LOAD_DLL_DEBUG_INFO*
LoadDll;
IMAGEHLP_MODULE64*
modInfo;
const char* modname;
};
//Called on DLL unloading (in the debug loop), before
removing the DLL from the internal library list, before breaking on DLL
unloading.
struct PLUG_CB_UNLOADDLL
{
UNLOAD_DLL_DEBUG_INFO*
UnloadDll;
};
//Called on a DebugString event (in the debug loop),
before dumping the string to the log, before breaking on a debug
string.
struct PLUG_CB_OUTPUTDEBUGSTRING
{
OUTPUT_DEBUG_STRING_INFO*
DebugString;
};
//Called on an unhandled (by the debugger) exception (in
the debug loop), after setting the continue status, after locking the debugger
to pause.
struct PLUG_CB_EXCEPTION
{
EXCEPTION_DEBUG_INFO*
Exception;
};
//Called on a normal/memory/hardware breakpoint (in the
debug loop), after locking the debugger to pause.
struct PLUG_CB_BREAKPOINT
{
BRIDGEBP*
breakpoint;
};
//Called after the debugger has been locked to pause (in
the debug loop), before any other callback that's before pausing the
debugger.
struct PLUG_CB_PAUSEDEBUG
{
void*
reserved;
};
//Called after the debugger has been unlocked to resume
(outside of the debug loop).
struct PLUG_CB_RESUMEDEBUG
{
void*
reserved;
};
//Called after the debugger stepped (in the debug loop),
after locking the debugger to pause.
struct PLUG_CB_STEPPED
{
void*
reserved;
};
//Called before attaching to a process.
struct PLUG_CB_ATTACH
{
DWORD dwProcessId;
};
//Called before detaching from the process.
struct PLUG_CB_DETACH
{
PROCESS_INFORMATION* fdProcessInfo;
};
//Called on any debug event, even the ones that are
handled internally, AVOID doing stuff that takes time
here, this will slow the debugger down a lot!
struct PLUG_CB_DEBUGEVENT
{
DEBUG_EVENT* DebugEvent;
};
//Called when a menu entry created by the plugin has
been clicked, the GUI will resume when this callback returns.
struct PLUG_CB_MENUENTRY
{
int hEntry;
};
//Called before TranslateMessage and DispatchMessage
Windows functions (PreTranslateMessage). Avoid calling user32 functions without
precautions here, there will be a recursive call if you fail
to take countermeasures.
struct
PLUG_CB_WINEVENT
{
MSG*
message;
long*
result;
bool retval; //only set this to true, never to
false
};
//Called before TranslateMessage and DispatchMessage
Windows functions (PreTranslateMessage). Avoid calling user32 functions without
precautions here, there will be a
recursive call if you fail to take countermeasures. This function is global, so it also captures hotkeys
(see Qt documentation).
struct
PLUG_CB_WINEVENTGLOBAL
{
MSG*
message;
bool retval; //only set this to true, never to
false
};