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

preactivate command More...

#include "pch.h"

Functions

VOID CommandPreactivateHelp ()
 help of the preactivate command
 
VOID CommandPreactivate (vector< string > SplitCommand, string Command)
 preactivate command handler
 

Detailed Description

preactivate command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.7
Date
2023-10-25

Function Documentation

◆ CommandPreactivate()

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

preactivate command handler

Parameters
SplitCommand
Command
Returns
VOID
43{
44 BOOL Status;
45 ULONG ReturnedLength;
46 DEBUGGER_PREACTIVATE_COMMAND PreactivateRequest = {0};
47
48 if (SplitCommand.size() != 2)
49 {
50 ShowMessages("incorrect use of the 'Preactivate'\n\n");
52 return;
53 }
54
55 //
56 // Set the type of preactivation
57 //
58 if (!SplitCommand.at(1).compare("mode") || !SplitCommand.at(1).compare("!mode"))
59 {
61 }
62 else
63 {
64 //
65 // Couldn't resolve or unknown parameter
66 //
67 ShowMessages("err, couldn't resolve error at '%s'\n",
68 SplitCommand.at(1).c_str());
69 return;
70 }
71
73
74 //
75 // Send IOCTL
76 //
77 Status = DeviceIoControl(
78 g_DeviceHandle, // Handle to device
79 IOCTL_PREACTIVATE_FUNCTIONALITY, // IO Control Code (IOCTL)
80 &PreactivateRequest, // Input Buffer to driver.
81 SIZEOF_DEBUGGER_PREACTIVATE_COMMAND, // Input buffer length
82 &PreactivateRequest, // Output Buffer from driver.
83 SIZEOF_DEBUGGER_PREACTIVATE_COMMAND, // Length of output
84 // buffer in bytes.
85 &ReturnedLength, // Bytes placed in buffer.
86 NULL // synchronous call
87 );
88
89 if (!Status)
90 {
91 ShowMessages("ioctl failed with code 0x%x\n", GetLastError());
92 return;
93 }
94
95 if (PreactivateRequest.KernelStatus == DEBUGGER_OPERATION_WAS_SUCCESSFUL)
96 {
97 ShowMessages("the requested service is activated successfully!\n");
98 }
99 else
100 {
101 //
102 // An err occurred, no results
103 //
104 ShowErrorMessage(PreactivateRequest.KernelStatus);
105 }
106}
int BOOL
Definition BasicTypes.h:23
unsigned long ULONG
Definition BasicTypes.h:37
#define DEBUGGER_OPERATION_WAS_SUCCESSFUL
General value to indicate that the operation or request was successful.
Definition ErrorCodes.h:23
#define IOCTL_PREACTIVATE_FUNCTIONALITY
ioctl, to preactivate a functionality
Definition Ioctls.h:289
@ DEBUGGER_PREACTIVATE_COMMAND_TYPE_MODE
Definition RequestStructures.h:190
#define SIZEOF_DEBUGGER_PREACTIVATE_COMMAND
Definition RequestStructures.h:194
BOOLEAN ShowErrorMessage(UINT32 Error)
shows the error message
Definition debugger.cpp:38
#define AssertShowMessageReturnStmt(expr, message, rc)
Definition common.h:51
#define AssertReturn
Definition common.h:19
#define ASSERT_MESSAGE_DRIVER_NOT_LOADED
Definition common.h:25
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:471
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
VOID CommandPreactivateHelp()
help of the preactivate command
Definition preactivate.cpp:20
requests for the 'preactivate' command
Definition RequestStructures.h:202
UINT32 KernelStatus
Definition RequestStructures.h:204
DEBUGGER_PREACTIVATE_COMMAND_TYPE Type
Definition RequestStructures.h:203

◆ CommandPreactivateHelp()

VOID CommandPreactivateHelp ( )

help of the preactivate command

Returns
VOID
21{
22 ShowMessages("preactivate : preactivates a special functionality.\n\n");
23
24 ShowMessages("syntax : \tpreactivate [Type (string)]\n");
25
26 ShowMessages("\n");
27 ShowMessages("\t\te.g : preactivate mode\n");
28
29 ShowMessages("\n");
30 ShowMessages("type of activations:\n");
31 ShowMessages("\tmode: used for preactivation of the '!mode' event\n");
32}