49{
55 vector<string> SplitCommandCaseSensitive {
Split(Command,
' ')};
56
57 if (SplitCommand.size() == 1 || SplitCommand.size() >= 5 ||
58 SplitCommand.size() == 3)
59 {
62 return;
63 }
64
65
66
67
68
70 {
72 }
73
74 if (SplitCommand.size() == 2)
75 {
76
77
78
80 {
81
82
83
85 SplitCommandCaseSensitive.at(1).c_str());
86 return;
87 }
88 }
89 else
90 {
91
92
93
94 if (!SplitCommand.at(1).compare("pid"))
95 {
97 {
98 ShowMessages(
"incorrect address, please enter a valid process id\n");
99 return;
100 }
102 {
103
104
105
107 SplitCommandCaseSensitive.at(3).c_str());
108 return;
109 }
110 }
111 else if (!SplitCommand.at(2).compare("pid"))
112 {
114 {
115
116
117
119 SplitCommandCaseSensitive.at(1).c_str());
120
121 return;
122 }
124 {
125 ShowMessages(
"incorrect address, please enter a valid process id\n");
126 return;
127 }
128 }
129 else
130 {
133 return;
134 }
135 }
136
137
138
139
140
144
146 {
147
148
149
150 if (Pid != 0)
151 {
153 return;
154 }
155
156
157
158
159
161 }
162 else
163 {
165
166 if (Pid == 0)
167 {
168 Pid = GetCurrentProcessId();
170 }
171
172
173
174
175 Status = DeviceIoControl(
178 &AddressDetails,
180 &AddressDetails,
182
183 &ReturnedLength,
184 NULL
185 );
186
187 if (!Status)
188 {
189 ShowMessages(
"ioctl failed with code 0x%x\n", GetLastError());
190 return;
191 }
192
194 {
195
196
197
199 }
200 else
201 {
202
203
204
206 }
207 }
208}
int BOOL
Definition BasicTypes.h:23
#define FALSE
Definition BasicTypes.h:54
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
VOID CommandPa2vaHelp()
help of the !pa2va command
Definition pa2va.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
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