HyperDbg/hyperdbg/libhyperdbg/code/debugger/commands/debugging-commands/sleep.cpp

59 lines
1.3 KiB
C++
Raw Permalink Normal View History

2020-07-25 03:32:04 -07:00
/**
* @file sleep.cpp
2022-01-18 22:38:56 +03:30
* @author Sina Karvandi (sina@hyperdbg.org)
2020-07-25 03:32:04 -07:00
* @brief sleep command
* @details
* @version 0.1
* @date 2020-07-25
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#include "pch.h"
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 sleep 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
CommandSleepHelp()
{
2022-04-10 22:24:56 +04:30
ShowMessages("sleep : sleeps the debugger; this command is used in scripts, it doesn't breaks "
2021-03-22 18:19:39 +04:30
"the debugger but the debugger still shows the buffers received "
"from kernel.\n\n");
ShowMessages("syntax : \tsleep [MillisecondsTime (hex)]\n");
2020-07-25 03:32:04 -07:00
}
2020-08-28 04:03:12 -07:00
/**
* @brief sleep command help
2021-02-10 15:19:01 -08:00
*
2024-07-30 14:17:06 +09:00
* @param CommandTokens
* @param Command
2024-07-30 14:17:06 +09:00
*
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
CommandSleep(vector<CommandToken> CommandTokens, string Command)
2021-03-22 18:19:39 +04:30
{
UINT32 MillisecondsTime = 0;
2020-07-25 03:32:04 -07:00
2024-07-30 14:17:06 +09:00
if (CommandTokens.size() != 2)
2021-03-22 18:19:39 +04:30
{
2024-07-30 14:17:06 +09:00
ShowMessages("incorrect use of the '%s'\n\n",
GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
2021-03-22 18:19:39 +04:30
CommandSleepHelp();
return;
}
2020-07-25 03:32:04 -07:00
2024-07-30 14:17:06 +09:00
if (!ConvertTokenToUInt32(CommandTokens.at(1), &MillisecondsTime))
2021-03-22 18:19:39 +04:30
{
ShowMessages(
"please specify a correct hex value for time (milliseconds)\n\n");
CommandSleepHelp();
return;
}
PlatformSleep(MillisecondsTime);
2020-07-25 03:32:04 -07:00
}