73{
80 vector<string> SplitCommandCaseSensitive {
Split(Command,
' ')};
81 UINT32 IndexInCommandCaseSensitive = 0;
82
83 string FirstCommand = SplitCommand.front();
84
85
86
87
88
90 {
92 }
93
94 if (SplitCommand.size() == 1)
95 {
96
97
98
99 ShowMessages(
"incorrect use of the '%s' command\n\n", FirstCommand.c_str());
101 return;
102 }
103
104 for (auto Section : SplitCommand)
105 {
106 IndexInCommandCaseSensitive++;
107
108 if (IsFirstCommand)
109 {
110 IsFirstCommand =
FALSE;
111 continue;
112 }
113
114 if (IsNextProcessId ==
TRUE)
115 {
117 {
118 ShowMessages(
"err, you should enter a valid process id\n\n");
119 return;
120 }
121 IsNextProcessId =
FALSE;
122 continue;
123 }
124
125 if (IsNextLength ==
TRUE)
126 {
128 {
129 ShowMessages(
"err, you should enter a valid length\n\n");
130 return;
131 }
132 IsNextLength =
FALSE;
133 continue;
134 }
135
136 if (!Section.compare("l"))
137 {
139 continue;
140 }
141
142 if (!Section.compare("pid"))
143 {
144 IsNextProcessId =
TRUE;
145 continue;
146 }
147
148
149
150
151 if (TargetAddress == 0)
152 {
154 &TargetAddress))
155 {
156
157
158
160 SplitCommandCaseSensitive.at(IndexInCommandCaseSensitive - 1).c_str());
161 return;
162 }
163 }
164 else
165 {
166
167
168
169 ShowMessages(
"err, incorrect use of the '%s' command\n\n",
170 FirstCommand.c_str());
172
173 return;
174 }
175 }
176
177 if (!TargetAddress)
178 {
179
180
181
183
184 return;
185 }
186
187 if (Length == 0)
188 {
189
190
191
192 if (!FirstCommand.compare("u") ||
193 !FirstCommand.compare("!u") ||
194 !FirstCommand.compare("u64") ||
195 !FirstCommand.compare("!u64"))
196 {
197 Length = 0x40;
198 }
199 else
200 {
201 Length = 0x80;
202 }
203 }
204
205 if (IsNextLength || IsNextProcessId)
206 {
207 ShowMessages(
"incorrect use of the '%s' command\n\n", FirstCommand.c_str());
209 return;
210 }
211
212
213
214
216 {
218 return;
219 }
220
221 if (Pid == 0)
222 {
223
224
225
226 Pid = GetCurrentProcessId();
227 }
228
229 if (!FirstCommand.compare("db"))
230 {
232 TargetAddress,
235 Pid,
236 Length,
237 NULL);
238 }
239 else if (!FirstCommand.compare("dc"))
240 {
242 TargetAddress,
245 Pid,
246 Length,
247 NULL);
248 }
249 else if (!FirstCommand.compare("dd"))
250 {
252 TargetAddress,
255 Pid,
256 Length,
257 NULL);
258 }
259 else if (!FirstCommand.compare("dq"))
260 {
262 TargetAddress,
265 Pid,
266 Length,
267 NULL);
268 }
269 else if (!FirstCommand.compare("!db"))
270 {
272 TargetAddress,
275 Pid,
276 Length,
277 NULL);
278 }
279 else if (!FirstCommand.compare("!dc"))
280 {
282 TargetAddress,
285 Pid,
286 Length,
287 NULL);
288 }
289 else if (!FirstCommand.compare("!dd"))
290 {
292 TargetAddress,
295 Pid,
296 Length,
297 NULL);
298 }
299 else if (!FirstCommand.compare("!dq"))
300 {
302 TargetAddress,
305 Pid,
306 Length,
307 NULL);
308 }
309
310
311
312
313 else if (!FirstCommand.compare("u") || !FirstCommand.compare("u64"))
314 {
317 TargetAddress,
320 Pid,
321 Length,
322 NULL);
323 }
324 else if (!FirstCommand.compare("!u") || !FirstCommand.compare("!u64"))
325 {
328 TargetAddress,
331 Pid,
332 Length,
333 NULL);
334 }
335 else if (!FirstCommand.compare("u2") || !FirstCommand.compare("u32"))
336 {
339 TargetAddress,
342 Pid,
343 Length,
344 NULL);
345 }
346 else if (!FirstCommand.compare("!u2") || !FirstCommand.compare("!u32"))
347 {
350 TargetAddress,
353 Pid,
354 Length,
355 NULL);
356 }
357}
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
@ READ_FROM_KERNEL
Definition RequestStructures.h:219
@ DEBUGGER_SHOW_COMMAND_DC
Definition RequestStructures.h:255
@ DEBUGGER_SHOW_COMMAND_DISASSEMBLE32
Definition RequestStructures.h:253
@ DEBUGGER_SHOW_COMMAND_DD
Definition RequestStructures.h:257
@ DEBUGGER_SHOW_COMMAND_DQ
Definition RequestStructures.h:256
@ DEBUGGER_SHOW_COMMAND_DB
Definition RequestStructures.h:254
@ DEBUGGER_SHOW_COMMAND_DISASSEMBLE64
Definition RequestStructures.h:252
@ DEBUGGER_READ_PHYSICAL_ADDRESS
Definition RequestStructures.h:229
@ DEBUGGER_READ_VIRTUAL_ADDRESS
Definition RequestStructures.h:230
const vector< string > Split(const string &s, const char &c)
general split command
Definition common.cpp:117
BOOLEAN ConvertStringToUInt32(string TextToConvert, PUINT32 Result)
check and convert string to a 32 bit unsigned it and also check for special notations like 0x etc.
Definition common.cpp:347
VOID CommandReadMemoryAndDisassemblerHelp()
help of u* d* !u* !d* commands
Definition d-u.cpp:26
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest)
Definition globals.h:231
ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState
State of active debugging thread.
Definition globals.h:362
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
VOID HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_MEMORY_STYLE Style, UINT64 Address, DEBUGGER_READ_MEMORY_TYPE MemoryType, DEBUGGER_READ_READING_TYPE ReadingType, UINT32 Pid, UINT32 Size, PDEBUGGER_DT_COMMAND_OPTIONS DtDetails)
Show memory or disassembler.
Definition readmem.cpp:193
UINT32 ProcessId
Definition ud.h:51
BOOLEAN IsActive
Definition ud.h:49
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:360