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

flush command More...

#include "pch.h"

Functions

VOID CommandFlushHelp ()
 help of the flush command
VOID CommandFlushRequestFlush ()
 flush command handler
VOID CommandFlush (vector< CommandToken > CommandTokens, string Command)
 flush command handler

Variables

BOOLEAN g_IsKdModuleLoaded
 shows whether the kernel debugger (KD) module is loaded or not
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
 Shows if the debugger was connected to remote debuggee over (A remote guest).

Detailed Description

flush command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-08-19

Function Documentation

◆ CommandFlush()

VOID CommandFlush ( vector< CommandToken > CommandTokens,
string Command )

flush command handler

Parameters
CommandTokens
Command
Returns
VOID
112{
113 if (CommandTokens.size() != 1)
114 {
115 ShowMessages("incorrect use of the '%s'\n\n",
116 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
118 return;
119 }
120
121 //
122 // Flush the buffer
123 //
125}
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
VOID CommandFlushHelp()
help of the flush command
Definition flush.cpp:26
VOID CommandFlushRequestFlush()
flush command handler
Definition flush.cpp:40

◆ CommandFlushHelp()

VOID CommandFlushHelp ( )

help of the flush command

Returns
VOID
27{
28 ShowMessages("flush : removes all the buffer and messages from kernel-mode "
29 "buffers.\n\n");
30
31 ShowMessages("syntax : \tflush \n");
32}

◆ CommandFlushRequestFlush()

VOID CommandFlushRequestFlush ( )

flush command handler

Returns
VOID
41{
42 BOOL Status;
43 ULONG ReturnedLength;
44 DEBUGGER_FLUSH_LOGGING_BUFFERS FlushRequest = {0};
45
47 {
48 //
49 // It's on a debugger mode
50 //
52 }
53 else
54 {
55 //
56 // It's on a local debugging mode
57 //
59
60 //
61 // By the way, we don't need to send an input buffer
62 // to the kernel, but let's keep it like this, if we
63 // want to pass some other arguments to the kernel in
64 // the future
65 //
66 Status = DeviceIoControl(
67 g_DeviceHandle, // Handle to device
68 IOCTL_DEBUGGER_FLUSH_LOGGING_BUFFERS, // IO Control Code (IOCTL)
69 &FlushRequest, // Input Buffer to driver.
70 SIZEOF_DEBUGGER_FLUSH_LOGGING_BUFFERS, // Input buffer length
71 &FlushRequest, // Output Buffer from driver.
72 SIZEOF_DEBUGGER_FLUSH_LOGGING_BUFFERS, // Length of output buffer in
73 // bytes.
74 &ReturnedLength, // Bytes placed in buffer.
75 NULL // synchronous call
76 );
77
78 if (!Status)
79 {
80 ShowMessages("ioctl failed with code 0x%x\n", GetLastError());
81 return;
82 }
83
85 {
86 //
87 // The amount of message that are deleted are the amount of
88 // vmx-root messages and vmx non-root messages
89 //
90 ShowMessages(
91 "flushing buffers was successful, total %d messages were cleared.\n",
94 }
95 else
96 {
97 ShowMessages("flushing buffers was not successful :(\n");
98 }
99 }
100}
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest).
Definition globals.h:253
int BOOL
Definition BasicTypes.h:25
unsigned long ULONG
Definition BasicTypes.h:31
#define DEBUGGER_OPERATION_WAS_SUCCESSFUL
General value to indicate that the operation or request was successful.
Definition ErrorCodes.h:23
#define IOCTL_DEBUGGER_FLUSH_LOGGING_BUFFERS
ioctl, flush the kernel buffers
Definition Ioctls.h:213
#define SIZEOF_DEBUGGER_FLUSH_LOGGING_BUFFERS
Definition RequestStructures.h:311
struct _DEBUGGER_FLUSH_LOGGING_BUFFERS DEBUGGER_FLUSH_LOGGING_BUFFERS
request for flushing buffers
BOOLEAN KdSendFlushPacketToDebuggee()
Send a flush request to the debuggee.
Definition kd.cpp:314
#define ASSERT_MESSAGE_KD_NOT_LOADED
Definition common.h:29
#define AssertShowMessageReturnStmt(expr1, expr2, message1, message2, rc)
Definition common.h:59
#define AssertReturn
Definition common.h:19
#define ASSERT_MESSAGE_DRIVER_NOT_LOADED
Definition common.h:27
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:481
BOOLEAN g_IsKdModuleLoaded
shows whether the kernel debugger (KD) module is loaded or not
Definition globals.h:22
UINT32 CountOfMessagesThatSetAsReadFromVmxRoot
Definition RequestStructures.h:321
UINT32 CountOfMessagesThatSetAsReadFromVmxNonRoot
Definition RequestStructures.h:322
UINT32 KernelStatus
Definition RequestStructures.h:320

Variable Documentation

◆ g_IsKdModuleLoaded

BOOLEAN g_IsKdModuleLoaded
extern

shows whether the kernel debugger (KD) module is loaded or not

◆ g_IsSerialConnectedToRemoteDebuggee

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
extern

Shows if the debugger was connected to remote debuggee over (A remote guest).