2020-07-25 03:32:04 -07:00
|
|
|
/**
|
|
|
|
|
* @file pause.cpp
|
2022-01-18 22:38:56 +03:30
|
|
|
* @author Sina Karvandi (sina@hyperdbg.org)
|
2020-07-25 03:32:04 -07:00
|
|
|
* @brief pause command
|
|
|
|
|
* @details
|
|
|
|
|
* @version 0.1
|
|
|
|
|
* @date 2020-07-25
|
|
|
|
|
*
|
|
|
|
|
* @copyright This project is released under the GNU Public License v3.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-05-04 16:38:21 -07:00
|
|
|
#include "pch.h"
|
2020-07-25 03:32:04 -07:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Global Variables
|
|
|
|
|
//
|
2022-01-17 14:54:41 +03:30
|
|
|
extern BOOLEAN g_BreakPrintingOutput;
|
|
|
|
|
extern BOOLEAN g_IsConnectedToRemoteDebuggee;
|
|
|
|
|
extern ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState;
|
2020-07-25 03:32:04 -07:00
|
|
|
|
2020-08-28 04:03:12 -07:00
|
|
|
/**
|
2023-07-13 16:05:42 +09:00
|
|
|
* @brief help of the pause command
|
2021-02-10 15:19:01 -08:00
|
|
|
*
|
|
|
|
|
* @return VOID
|
2020-08-28 04:03:12 -07:00
|
|
|
*/
|
2021-03-22 18:19:39 +04:30
|
|
|
VOID
|
|
|
|
|
CommandPauseHelp()
|
|
|
|
|
{
|
|
|
|
|
ShowMessages("pause : pauses the kernel events.\n\n");
|
2022-04-17 23:05:24 +04:30
|
|
|
|
2022-02-08 16:06:26 +03:30
|
|
|
ShowMessages("syntax : \tpause \n");
|
2020-07-25 03:32:04 -07:00
|
|
|
}
|
|
|
|
|
|
2020-08-28 04:03:12 -07:00
|
|
|
/**
|
2023-01-18 20:23:40 +09:00
|
|
|
* @brief request to pause
|
2021-02-10 15:19:01 -08:00
|
|
|
*
|
|
|
|
|
* @return VOID
|
2020-08-28 04:03:12 -07:00
|
|
|
*/
|
2021-03-22 18:19:39 +04:30
|
|
|
VOID
|
2021-04-28 02:16:33 +04:30
|
|
|
CommandPauseRequest()
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Set the g_BreakPrintingOutput to TRUE
|
|
|
|
|
//
|
|
|
|
|
g_BreakPrintingOutput = TRUE;
|
2022-01-17 14:54:41 +03:30
|
|
|
ShowMessages("pausing...\n");
|
2020-07-25 03:32:04 -07:00
|
|
|
|
2021-04-22 03:17:46 +04:30
|
|
|
//
|
|
|
|
|
// If it's a remote debugger then we send the remote debuggee a 'g'
|
|
|
|
|
//
|
|
|
|
|
if (g_IsConnectedToRemoteDebuggee)
|
|
|
|
|
{
|
2024-03-14 14:02:18 +09:00
|
|
|
RemoteConnectionSendCommand("pause", (UINT32)strlen("pause") + 1);
|
2021-04-22 03:17:46 +04:30
|
|
|
}
|
2022-01-17 14:54:41 +03:30
|
|
|
else if (g_ActiveProcessDebuggingState.IsActive && UdPauseProcess(g_ActiveProcessDebuggingState.ProcessDebuggingToken))
|
|
|
|
|
{
|
2025-09-02 00:52:27 +02:00
|
|
|
ShowMessages("please keep interacting with the process until all the threads are intercepted "
|
|
|
|
|
"and halted; you can run the 'g' command to continue the debuggee\n");
|
2022-01-17 14:54:41 +03:30
|
|
|
}
|
2020-07-25 03:32:04 -07:00
|
|
|
}
|
2021-04-28 02:16:33 +04:30
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief pause command handler
|
|
|
|
|
*
|
2024-07-30 13:17:50 +09:00
|
|
|
* @param CommandTokens
|
2024-07-31 14:08:14 +09:00
|
|
|
* @param Command
|
2024-07-30 13:17:50 +09:00
|
|
|
*
|
2021-04-28 02:16:33 +04:30
|
|
|
* @return VOID
|
|
|
|
|
*/
|
|
|
|
|
VOID
|
2024-07-31 14:08:14 +09:00
|
|
|
CommandPause(vector<CommandToken> CommandTokens, string Command)
|
2021-04-28 02:16:33 +04:30
|
|
|
{
|
2024-07-30 13:17:50 +09:00
|
|
|
if (CommandTokens.size() != 1)
|
2021-04-28 02:16:33 +04:30
|
|
|
{
|
2024-07-31 18:21:23 +09:00
|
|
|
ShowMessages("incorrect use of the '%s'\n\n",
|
|
|
|
|
GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
|
2021-04-28 02:16:33 +04:30
|
|
|
CommandPauseHelp();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-30 13:17:50 +09:00
|
|
|
//
|
|
|
|
|
// request to pause
|
|
|
|
|
//
|
2021-04-28 02:16:33 +04:30
|
|
|
CommandPauseRequest();
|
|
|
|
|
}
|