1
0
Fork 0

Merge pull request #3147 from torusrxxx/patch000000f1

add isdebuggerfocused() to determine if x64dbg is focused
This commit is contained in:
Duncan Ogilvie 2023-07-28 09:20:38 +02:00 committed by GitHub
commit de494c1fc7
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 0 deletions

View File

@ -1997,6 +1997,11 @@ BRIDGE_IMPEXP DWORD GuiGetMainThreadId()
return (DWORD)(duint)_gui_sendmessage(GUI_GET_MAIN_THREAD_ID, nullptr, nullptr);
}
BRIDGE_IMPEXP bool GuiIsDebuggerFocused()
{
return (bool)(duint)_gui_sendmessage(GUI_IS_DEBUGGER_FOCUSED, nullptr, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;

View File

@ -1126,6 +1126,7 @@ BRIDGE_IMPEXP void DbgGetSymbolInfo(const SYMBOLPTR* symbolptr, SYMBOLINFO* info
BRIDGE_IMPEXP DEBUG_ENGINE DbgGetDebugEngine();
BRIDGE_IMPEXP bool DbgGetSymbolInfoAt(duint addr, SYMBOLINFO* info);
BRIDGE_IMPEXP duint DbgXrefAddMulti(const XREF_EDGE* edges, duint count);
BRIDGE_IMPEXP bool GuiIsDebuggerFocused();
//Gui defines
typedef enum
@ -1274,6 +1275,7 @@ typedef enum
GUI_GET_MAIN_THREAD_ID, // param1=unused, param2=unused
GUI_ADD_MSG_TO_LOG_HTML, // param1=(const char*)msg, param2=unused
GUI_IS_LOG_ENABLED, // param1=unused, param2=unused
GUI_IS_DEBUGGER_FOCUSED, // param1=unused, param2=unused
} GUIMSG;
//GUI Typedefs

View File

@ -152,6 +152,9 @@ void ExpressionFunctions::Init()
//Undocumented
RegisterEasy("bpgoto", bpgoto);
//Other
RegisterEasy("isdebuggerfocused", isdebuggerfocused);
// Strings
ExpressionFunctions::Register("utf8", ValueTypeString, { ValueTypeNumber }, Exprfunc::utf8, nullptr);
ExpressionFunctions::Register("utf16", ValueTypeString, { ValueTypeNumber }, Exprfunc::utf16, nullptr);

View File

@ -600,6 +600,11 @@ namespace Exprfunc
return getLastExceptionInfo().ExceptionRecord.ExceptionInformation[index];
}
duint isdebuggerfocused()
{
return GuiIsDebuggerFocused();
}
bool streq(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata)
{
assert(argc == 2);

View File

@ -86,6 +86,8 @@ namespace Exprfunc
duint exinfocount();
duint exinfo(duint index);
duint isdebuggerfocused();
bool streq(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
bool strieq(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);
bool strstr(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata);

View File

@ -905,6 +905,9 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_GET_MAIN_THREAD_ID:
return (void*)dwMainThreadId;
case GUI_IS_DEBUGGER_FOCUSED:
return (void*)!!QApplication::activeWindow();
}
return nullptr;