50{
56 vector<string> SplitCommandCaseSensitive {
Split(Command,
' ')};
57
58 if (SplitCommand.size() == 1 || SplitCommand.size() >= 5 ||
59 SplitCommand.size() == 3)
60 {
63 return;
64 }
65
66
67
68
69
71 {
73 }
74
75 if (SplitCommand.size() == 2)
76 {
77
78
79
81 {
82
83
84
86 SplitCommandCaseSensitive.at(1).c_str());
87 return;
88 }
89 }
90 else
91 {
92
93
94
95 if (!SplitCommand.at(1).compare("pid"))
96 {
98 {
99 ShowMessages(
"incorrect address, please enter a valid process id\n");
100 return;
101 }
102
104 {
105
106
107
109 SplitCommandCaseSensitive.at(3).c_str());
110 return;
111 }
112 }
113 else if (!SplitCommand.at(2).compare("pid"))
114 {
116 {
117
118
119
121 SplitCommandCaseSensitive.at(1).c_str());
122 return;
123 }
124
126 {
127 ShowMessages(
"incorrect address, please enter a valid process id\n");
128 return;
129 }
130 }
131 else
132 {
135 return;
136 }
137 }
138
139
140
141
142
146
148 {
149
150
151
152 if (Pid != 0)
153 {
155 return;
156 }
157
158
159
160
161
163 }
164 else
165 {
167
168 if (Pid == 0)
169 {
170 Pid = GetCurrentProcessId();
172 }
173
174
175
176
177 Status = DeviceIoControl(
180 &AddressDetails,
182 &AddressDetails,
184
185 &ReturnedLength,
186 NULL
187 );
188
189 if (!Status)
190 {
191 ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
192 return;
193 }
194
196 {
197
198
199
201 }
202 else
203 {
204
205
206
208 }
209 }
210}
int BOOL
Definition BasicTypes.h:23
#define TRUE
Definition BasicTypes.h:55
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_VA2PA_AND_PA2VA_COMMANDS
ioctl, for !va2pa and !pa2va commands
Definition Ioctls.h:127
#define SIZEOF_DEBUGGER_VA2PA_AND_PA2VA_COMMANDS
Definition RequestStructures.h:46
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 KdSendVa2paAndPa2vaPacketToDebuggee(PDEBUGGER_VA2PA_AND_PA2VA_COMMANDS Va2paAndPa2vaPacket)
Sends VA2PA and PA2VA packest, or '!va2pa' and '!pa2va' commands packet to the debuggee.
Definition kd.cpp:965
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
UINT32 ProcessId
Definition ud.h:51
BOOLEAN IsActive
Definition ud.h:49
requests for !va2pa and !pa2va commands
Definition RequestStructures.h:54
BOOLEAN IsVirtual2Physical
Definition RequestStructures.h:58
UINT32 KernelStatus
Definition RequestStructures.h:59
UINT64 PhysicalAddress
Definition RequestStructures.h:56
UINT32 ProcessId
Definition RequestStructures.h:57
UINT64 VirtualAddress
Definition RequestStructures.h:55
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
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 CommandVa2paHelp()
help of the !va2pa command
Definition va2pa.cpp:26