92{
98 vector<string> SplitCommandCaseSensitive {
Split(Command,
' ')};
99
100 if (SplitCommand.size() == 1 || SplitCommand.size() >= 5 ||
101 SplitCommand.size() == 3)
102 {
105 return;
106 }
107
108
109
110
111
113 {
115 }
116
117 if (SplitCommand.size() == 2)
118 {
119
120
121
123 {
124
125
126
128 SplitCommandCaseSensitive.at(1).c_str());
129 return;
130 }
131 }
132 else
133 {
134
135
136
137 if (!SplitCommand.at(1).compare("pid"))
138 {
140 {
141 ShowMessages(
"incorrect address, please enter a valid process id\n");
142 return;
143 }
144
146 {
147
148
149
151 SplitCommandCaseSensitive.at(3).c_str());
152 return;
153 }
154 }
155 else if (!SplitCommand.at(2).compare("pid"))
156 {
158 {
159
160
161
163 SplitCommandCaseSensitive.at(1).c_str());
164 return;
165 }
166
168 {
169 ShowMessages(
"incorrect address, please enter a valid process id\n");
170 return;
171 }
172 }
173 else
174 {
177 return;
178 }
179 }
180
181
182
183
184
187
189 {
190
191
192
193 if (Pid != 0)
194 {
196 return;
197 }
198
199
200
201
202
204 }
205 else
206 {
208
209 if (Pid == 0)
210 {
211 Pid = GetCurrentProcessId();
213 }
214
215
216
217
218 Status = DeviceIoControl(
221 &AddressDetails,
223 &AddressDetails,
225
226 &ReturnedLength,
227 NULL
228 );
229
230 if (!Status)
231 {
232 ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
233 return;
234 }
235
237 {
239 return;
240 }
241
242
243
244
246 }
247}
int BOOL
Definition BasicTypes.h:23
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
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_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS
ioctl, request to read page table entries
Definition Ioctls.h:99
#define SIZEOF_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS
Definition RequestStructures.h:14
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
BOOLEAN ShowErrorMessage(UINT32 Error)
shows the error message
Definition debugger.cpp:38
BOOLEAN KdSendPtePacketToDebuggee(PDEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS PtePacket)
Sends a PTE or '!pte' command packet to the debuggee.
Definition kd.cpp:907
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 CommandPteHelp()
help of the !pte command
Definition pte.cpp:26
VOID CommandPteShowResults(UINT64 TargetVa, PDEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS PteRead)
show results of !pte command
Definition pte.cpp:47
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
UINT32 ProcessId
Definition ud.h:51
BOOLEAN IsActive
Definition ud.h:49
request for !pte command
Definition RequestStructures.h:22
UINT64 VirtualAddress
Definition RequestStructures.h:23
UINT32 ProcessId
Definition RequestStructures.h:24
UINT32 KernelStatus
Definition RequestStructures.h:38
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