63{
69 UINT32 ActionBreakToDebuggerLength = 0;
70 UINT32 ActionCustomCodeLength = 0;
71 UINT32 ActionScriptLength = 0;
73 UINT64 OptionalParam1 = 0;
74 UINT64 OptionalParam2 = 0;
83
84 if (CommandTokens.size() < 4)
85 {
86 ShowMessages("incorrect use of the '%s'\n\n",
88
90 return;
91 }
92
93
94
95
96
97
98
99
101 &CommandTokens,
103 &Event,
104 &EventLength,
105 &ActionBreakToDebugger,
106 &ActionBreakToDebuggerLength,
107 &ActionCustomCode,
108 &ActionCustomCodeLength,
109 &ActionScript,
110 &ActionScriptLength,
111 &EventParsingErrorCause))
112 {
113 return;
114 }
115
116
117
118
119 for (auto Section : CommandTokens)
120 {
122 {
123 continue;
124 }
125 else if (IsNextLength)
126 {
128 {
129 ShowMessages("err, you should enter a valid length\n\n");
130 return;
131 }
132
133 IsNextLength =
FALSE;
134 LengthAlreadySet =
TRUE;
136 }
138 {
140 SetAttributes =
TRUE;
141 }
143 {
145 SetAttributes =
TRUE;
146 }
148 {
150 SetAttributes =
TRUE;
151 }
153 {
155 SetAttributes =
TRUE;
156 }
158 !SetAttributes)
159 {
161 SetAttributes =
TRUE;
162 }
164 !SetAttributes)
165 {
167 SetAttributes =
TRUE;
168 }
175 !SetAttributes)
176 {
178 SetAttributes =
TRUE;
179 }
181 {
183 continue;
184 }
186 {
188 HookMemoryTypeSet =
TRUE;
189 continue;
190 }
192 {
194 HookMemoryTypeSet =
TRUE;
195 continue;
196 }
197 else
198 {
199
200
201
202 if (!SetFrom)
203 {
206 &OptionalParam1))
207 {
208
209
210
211 ShowMessages("err, couldn't resolve error at '%s'\n\n",
214
216 return;
217 }
219 }
220 else if (!SetTo && !LengthAlreadySet)
221 {
224 &OptionalParam2))
225 {
226
227
228
229 ShowMessages("err, couldn't resolve error at '%s'\n\n",
231
233
235 return;
236 }
238 }
239 else
240 {
241
242
243
244 ShowMessages("unknown parameter '%s'\n\n",
247
249 return;
250 }
251 }
252 }
253
254
255
256
257 if (!SetFrom || !SetTo)
258 {
259 ShowMessages("please choose the 'from' or 'to' values or specify the length\n");
261 return;
262 }
263
264
265
266
267 if (LengthAlreadySet)
268 {
269
270
271
272 OptionalParam2 = OptionalParam1 + HookLength - 1;
273 }
274
275
276
277
278 if (OptionalParam1 > OptionalParam2)
279 {
280
281
282
283 ShowMessages("please choose the 'from' value first, then choose the 'to' "
284 "value\n");
285
287 return;
288 }
289
290
291
292
293 if (!SetAttributes)
294 {
295 ShowMessages("please specify the attribute(s) that you want to monitor (r, w, x, rw, rx, wx, rwx)\n");
296
298 return;
299 }
300
301
302
303
307
308
309
310
312 {
313
314
315
316
317
318
320 return;
321 }
322
323
324
325
327 ActionBreakToDebugger,
328 ActionBreakToDebuggerLength,
329 ActionCustomCode,
330 ActionCustomCodeLength,
331 ActionScript,
332 ActionScriptLength))
333 {
334
335
336
337
339 return;
340 }
341}
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
BOOLEAN CompareLowerCaseStrings(CommandToken TargetToken, const CHAR *StringToCompare)
Compare lower case strings.
Definition common.cpp:503
BOOLEAN ConvertTokenToUInt32(CommandToken TargetToken, PUINT32 Result)
check and convert command token to a 32 bit unsigned integer
Definition common.cpp:546
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:1688
BOOLEAN InterpretGeneralEventAndActionsFields(vector< CommandToken > *CommandTokens, 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:1736
BOOLEAN SendEventToKernel(PDEBUGGER_GENERAL_EVENT_DETAIL Event, UINT32 EventBufferLength)
Register the event to the kernel.
Definition debugger.cpp:1367
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:1483
VOID CommandMonitorHelp()
help of the !monitor command
Definition monitor.cpp:20
NULL()
Definition test-case-generator.py:530
UINT64 OptionalParam2
Definition Events.h:278
UINT64 OptionalParam3
Definition Events.h:279
UINT64 OptionalParam1
Definition Events.h:277
DEBUGGER_EVENT_OPTIONS Options
Definition Events.h:396
VMM_EVENT_TYPE_ENUM EventType
Definition Events.h:394
BOOLEAN SymbolConvertNameOrExprToAddress(const string &TextToConvert, PUINT64 Result)
check and convert string to a 64 bit unsigned integer and also check for symbol object names and eval...
Definition symbol.cpp:359