85{
91 UINT32 ActionBreakToDebuggerLength = 0;
92 UINT32 ActionCustomCodeLength = 0;
93 UINT32 ActionScriptLength = 0;
96 vector<string> SplitCommandCaseSensitive {
Split(Command,
' ')};
98 string Cmd;
99
100
101
102
103
104 Cmd = SplitCommand.at(0);
105 if (!Cmd.compare("!syscall") || !Cmd.compare("!syscall2"))
106 {
108 &SplitCommand,
109 &SplitCommandCaseSensitive,
111 &Event,
112 &EventLength,
113 &ActionBreakToDebugger,
114 &ActionBreakToDebuggerLength,
115 &ActionCustomCode,
116 &ActionCustomCodeLength,
117 &ActionScript,
118 &ActionScriptLength,
119 &EventParsingErrorCause))
120 {
121 return;
122 }
123 }
124 else
125 {
127 &SplitCommand,
128 &SplitCommandCaseSensitive,
130 &Event,
131 &EventLength,
132 &ActionBreakToDebugger,
133 &ActionBreakToDebuggerLength,
134 &ActionCustomCode,
135 &ActionCustomCodeLength,
136 &ActionScript,
137 &ActionScriptLength,
138 &EventParsingErrorCause))
139 {
140 return;
141 }
142 }
143
144
145
146
147
148
149
150
151
152
153
154 if (!Cmd.compare("!syscall") || !Cmd.compare("!syscall2"))
155 {
156 for (auto Section : SplitCommand)
157 {
158 if (!Section.compare("!syscall") ||
159 !Section.compare("!syscall2") ||
160 !Section.compare("!sysret") ||
161 !Section.compare("!sysret2"))
162 {
163 continue;
164 }
165
166 else if (!GetSyscallNumber)
167 {
168
169
170
172 {
173
174
175
176 ShowMessages(
"unknown parameter '%s'\n\n", Section.c_str());
177
178 if (!Cmd.compare("!syscall") || !Cmd.compare("!syscall2"))
179 {
181 }
182 else
183 {
185 }
186
188 return;
189 }
190 else
191 {
192 GetSyscallNumber =
TRUE;
193 }
194 }
195 else
196 {
197
198
199
200 ShowMessages(
"unknown parameter '%s'\n\n", Section.c_str());
201
202 if (!Cmd.compare("!syscall") || !Cmd.compare("!syscall2"))
203 {
205 }
206 else
207 {
209 }
210
212 return;
213 }
214 }
215
216
217
218
220 }
221
222
223
224
225 if (!Cmd.compare("!syscall2") || !Cmd.compare("!sysret2"))
226 {
227
228
229
231 }
232 else
233 {
234
235
236
238 }
239
240
241
242
244 {
245
246
247
248
249
250
252 return;
253 }
254
255
256
257
259 ActionBreakToDebugger,
260 ActionBreakToDebuggerLength,
261 ActionCustomCode,
262 ActionCustomCodeLength,
263 ActionScript,
264 ActionScriptLength))
265 {
266
267
268
269
271 return;
272 }
273}
UCHAR BOOLEAN
Definition BasicTypes.h:39
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
#define DEBUGGER_EVENT_SYSCALL_ALL_SYSRET_OR_SYSCALLS
Apply to all syscalls and sysrets.
Definition Constants.h:635
const vector< string > Split(const string &s, const char &c)
general split command
Definition common.cpp:117
BOOLEAN ConvertStringToUInt64(string TextToConvert, PUINT64 Result)
check and convert string to a 64 bit unsigned integer and also check for special notations like 0x,...
Definition common.cpp:240
VOID FreeEventsAndActionsMemory(PDEBUGGER_GENERAL_EVENT_DETAIL Event, PDEBUGGER_GENERAL_ACTION ActionBreakToDebugger, PDEBUGGER_GENERAL_ACTION ActionCustomCode, PDEBUGGER_GENERAL_ACTION ActionScript)
Deallocate buffers relating to events and actions.
Definition debugger.cpp:2292
BOOLEAN InterpretGeneralEventAndActionsFields(vector< string > *SplitCommand, vector< string > *SplitCommandCaseSensitive, VMM_EVENT_TYPE_ENUM EventType, PDEBUGGER_GENERAL_EVENT_DETAIL *EventDetailsToFill, PUINT32 EventBufferLength, PDEBUGGER_GENERAL_ACTION *ActionDetailsToFillBreakToDebugger, PUINT32 ActionBufferLengthBreakToDebugger, PDEBUGGER_GENERAL_ACTION *ActionDetailsToFillCustomCode, PUINT32 ActionBufferLengthCustomCode, PDEBUGGER_GENERAL_ACTION *ActionDetailsToFillScript, PUINT32 ActionBufferLengthScript, PDEBUGGER_EVENT_PARSING_ERROR_CAUSE ReasonForErrorInParsing)
Interpret general event fields.
Definition debugger.cpp:2342
BOOLEAN SendEventToKernel(PDEBUGGER_GENERAL_EVENT_DETAIL Event, UINT32 EventBufferLength)
Register the event to the kernel.
Definition debugger.cpp:1969
BOOLEAN RegisterActionToEvent(PDEBUGGER_GENERAL_EVENT_DETAIL Event, PDEBUGGER_GENERAL_ACTION ActionBreakToDebugger, UINT32 ActionBreakToDebuggerLength, PDEBUGGER_GENERAL_ACTION ActionCustomCode, UINT32 ActionCustomCodeLength, PDEBUGGER_GENERAL_ACTION ActionScript, UINT32 ActionScriptLength)
Register the action to the event.
Definition debugger.cpp:2086
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
NULL()
Definition test-case-generator.py:530
UINT64 OptionalParam2
Definition Events.h:273
UINT64 OptionalParam1
Definition Events.h:272
Each event can have multiple actions.
Definition Events.h:406
Each command is like the following struct, it also used for tracing works in user mode and sending it...
Definition Events.h:350
DEBUGGER_EVENT_OPTIONS Options
Definition Events.h:391
VOID CommandSysretHelp()
help of the !sysret command
Definition syscall-sysret.cpp:54
VOID CommandSyscallHelp()
help of the !syscall command
Definition syscall-sysret.cpp:20