85{
88 UINT32 ModuleDetailsSize = 0;
93 SIZE_T CharSize = 0;
94 WCHAR * WcharBuff =
NULL;
95 wstring SearchModuleString;
96
97
98
99
101
102
103
104
105 ModuleCountRequest.
ProcessId = ProcessId;
107
108
109
110
111 Status = DeviceIoControl(
114
115 &ModuleCountRequest,
117 &ModuleCountRequest,
119
120 &ReturnedLength,
121 NULL
122 );
123
124 if (!Status)
125 {
126 ShowMessages("ioctl failed with code 0x%x\n", GetLastError());
128 }
129
130
131
132
134 {
136
137
138
141
143
144 if (ModuleDetailsRequest == NULL)
145 {
147 }
148
149 RtlZeroMemory(ModuleDetailsRequest, ModuleDetailsSize);
150
151
152
153
154 ModuleDetailsRequest->
ProcessId = ProcessId;
156
157
158
159
160 Status = DeviceIoControl(
163
164 ModuleDetailsRequest,
166 ModuleDetailsRequest,
167 ModuleDetailsSize,
168
169 &ReturnedLength,
170 NULL
171 );
172
173 if (!Status)
174 {
175 free(ModuleDetailsRequest);
176 ShowMessages("ioctl failed with code 0x%x\n", GetLastError());
178 }
179
180
181
182
184 {
187 ShowMessages("user mode\n");
188 ShowMessages("start\t\t\tentrypoint\t\tpath\n\n");
189
190 if (SearchModule != NULL)
191 {
192 CharSize = strlen(SearchModule) + 1;
193 WcharBuff = (WCHAR *)malloc(CharSize * 2);
194
195 if (WcharBuff == NULL)
196 {
198 }
199
200 RtlZeroMemory(WcharBuff, CharSize);
201
202 mbstowcs(WcharBuff, SearchModule, CharSize);
203
204 SearchModuleString.assign(WcharBuff, wcslen(WcharBuff));
205 }
206
207 for (SIZE_T i = 0; i < ModulesCount; i++)
208 {
209
210
211
212 if (SearchModule != NULL)
213 {
214
215
216
217 std::wstring FullPathName((WCHAR *)Modules[i].FilePath);
218
220 {
221
222
223
224 continue;
225 }
226 }
227
228
229
230
231 if (ModuleDetailsRequest->
Is32Bit)
232 {
233 ShowMessages("%016llx\t%016llx\t%ws\n",
234 Modules[i].BaseAddress,
235 Modules[i].Entrypoint,
237 }
238 else
239 {
240 ShowMessages("%016llx\t%016llx\t%ws\n",
241 Modules[i].BaseAddress,
242 Modules[i].Entrypoint,
243 Modules[i].FilePath);
244 }
245 }
246
247 if (SearchModule != NULL)
248 {
249 free(WcharBuff);
250 }
251 }
252 else
253 {
256 }
257
258 free(ModuleDetailsRequest);
260 }
261 else
262 {
265 }
266}
SIZE_T FindCaseInsensitiveW(std::wstring Input, std::wstring ToSearch, SIZE_T Pos)
Find case insensitive sub string in a given substring (unicode).
Definition common.cpp:885
BOOLEAN ShowErrorMessage(UINT32 Error)
shows the error message
Definition debugger.cpp:40
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:481
BOOLEAN g_IsKdModuleLoaded
shows whether the kernel debugger (KD) module is loaded or not
Definition globals.h:22
std::wstring CommandLmConvertWow64CompatibilityPaths(const WCHAR *LocalFilePath)
Convert redirection of 32-bit compatibility path.
Definition lm.cpp:52
UINT32 Result
Definition Symbols.h:52
UINT32 ModulesCount
Definition Symbols.h:51
UINT32 ProcessId
Definition Symbols.h:48
BOOLEAN Is32Bit
Definition Symbols.h:50
BOOLEAN OnlyCountModules
Definition Symbols.h:49