HyperDbg Debugger
Loading...
Searching...
No Matches
restart.cpp File Reference

.restart command More...

#include "pch.h"

Functions

VOID CommandRestartHelp ()
 help of the .restart command
 
VOID CommandRestart (vector< string > SplitCommand, string Command)
 .restart command handler
 

Variables

UINT32 g_ProcessIdOfLatestStartingProcess
 The process id of the latest starting process.
 
std::wstring g_StartCommandPath
 the start path used in .start command
 
std::wstring g_StartCommandPathAndArguments
 the start arguments used in .start command
 
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
 State of active debugging thread.
 

Detailed Description

.restart command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2022-01-06

Function Documentation

◆ CommandRestart()

VOID CommandRestart ( vector< string > SplitCommand,
string Command )

.restart command handler

Parameters
SplitCommand
Command
Returns
VOID
47{
48 if (SplitCommand.size() != 1)
49 {
50 ShowMessages("incorrect use of the '.restart'\n\n");
52 return;
53 }
54
55 //
56 // Check if the .start command is previously called or not
57 //
58 if (g_StartCommandPath.empty())
59 {
60 ShowMessages("nothing to restart, did you use the '.start' command before?\n");
61 return;
62 }
63
64 //
65 // Check to kill the current active process (if exists)
66 //
68 {
69 //
70 // kill the process, we will restart the process even if we didn't
71 // successfully killed the active process
72 //
74 }
76 {
78
79 //
80 // No longer the last process exists
81 //
83 }
84
85 //
86 // Perform run of the target file
87 //
89 {
91 g_StartCommandPath.c_str(),
92 NULL,
93 FALSE);
94 }
95 else
96 {
98 g_StartCommandPath.c_str(),
100 FALSE);
101 }
102}
#define FALSE
Definition BasicTypes.h:54
wchar_t WCHAR
Definition BasicTypes.h:32
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
NULL()
Definition test-case-generator.py:530
std::wstring g_StartCommandPathAndArguments
the start arguments used in .start command
Definition globals.h:653
UINT32 g_ProcessIdOfLatestStartingProcess
The process id of the latest starting process.
Definition globals.h:368
VOID CommandRestartHelp()
help of the .restart command
Definition restart.cpp:29
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
State of active debugging thread.
Definition globals.h:362
std::wstring g_StartCommandPath
the start path used in .start command
Definition globals.h:647
UINT32 ProcessId
Definition ud.h:51
BOOLEAN IsActive
Definition ud.h:49
BOOLEAN UdKillProcess(UINT32 TargetPid)
Kill the target process from kernel.
Definition ud.cpp:666
BOOLEAN UdAttachToProcess(UINT32 TargetPid, const WCHAR *TargetFileAddress, const WCHAR *CommandLine, BOOLEAN RunCallbackAtTheFirstInstruction)
Attach to target process.
Definition ud.cpp:349

◆ CommandRestartHelp()

VOID CommandRestartHelp ( )

help of the .restart command

Returns
VOID
30{
31 ShowMessages(".restart : restarts the previously started process "
32 "(using '.start' command).\n\n");
33
35 "syntax : \t.restart \n");
36}

Variable Documentation

◆ g_ActiveProcessDebuggingState

ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
extern

State of active debugging thread.

362{0};

◆ g_ProcessIdOfLatestStartingProcess

UINT32 g_ProcessIdOfLatestStartingProcess
extern

The process id of the latest starting process.

◆ g_StartCommandPath

std::wstring g_StartCommandPath
extern

the start path used in .start command

◆ g_StartCommandPathAndArguments

std::wstring g_StartCommandPathAndArguments
extern

the start arguments used in .start command