127{
129 UINT32 EnumerationCount = 0;
131 LIST_ENTRY ThreadLinks = {0};
132 CLIENT_ID ThreadCid = {0};
133 UINT32 MaximumBufferCount = 0;
135
136
137
138
140 CountOfThreads == NULL)
141 {
143 }
144
146 (ListSaveBuffer == NULL || ListSaveBuffSize == 0))
147 {
149 }
150
151
152
153
155 {
157 }
158
164
165
166
167
173 {
175 }
176
177
178
179
181 {
182
183
184
185 ThreadListSymbolInfo->
Process = (
UINT64)PsGetCurrentProcess();
186 ThreadListHead = (
UINT64)PsGetCurrentProcess() + ThreadListHeadOffset;
187 }
188 else
189 {
190
191
192
193 ThreadListHead = (
UINT64)ThreadListSymbolInfo->
Process + ThreadListHeadOffset;
194 }
195
196
197
198
200 {
202 }
203
204
205
206
208 PsActiveProcessHeadAddress,
209 ActiveProcessLinksOffset))
210 {
212 }
213
215 {
216
217
218
219 Log(
"PROCESS\t%llx\tIMAGE\t%s\n",
222 }
223
224
225
226
228
229
230
231
232 Thread = (
UINT64)ThreadLinks.Flink - ThreadListEntryOffset;
233
234 do
235 {
236
237
238
240 &ThreadCid,
241 sizeof(ThreadCid));
242
243 switch (QueryAction)
244 {
246
247
248
249
250 Log(
"\tTHREAD\t%llx (%llx.%llx)\n", Thread, ThreadCid.UniqueProcess, ThreadCid.UniqueThread);
251
252 break;
253
255
256 EnumerationCount++;
257
258 break;
259
261
262 EnumerationCount++;
263
264
265
266
267 if (EnumerationCount == MaximumBufferCount - 1)
268 {
269
270
271
272 goto ReturnEnd;
273 }
274
275
276
277
278 SavingEntries[EnumerationCount - 1].
Eprocess = ThreadListSymbolInfo->
Process;
281 SavingEntries[EnumerationCount - 1].
Ethread = Thread;
282
283 RtlCopyMemory(&SavingEntries[EnumerationCount - 1].ImageFileName,
285 15);
286
287 break;
288
289 default:
290 break;
291 }
292
294 &ThreadLinks,
295 sizeof(ThreadLinks));
296
297
298
299
300 Thread = (
UINT64)ThreadLinks.Flink - ThreadListEntryOffset;
301
302 }
while ((
UINT64)ThreadLinks.Flink != ThreadListHead);
303
304ReturnEnd:
305
306
307
309 {
310 *CountOfThreads = EnumerationCount;
311 }
312
314}
BOOLEAN CheckAccessValidityAndSafety(UINT64 TargetAddress, UINT32 Size)
Check the safety to access the memory.
Definition AddressCheck.c:156
unsigned char BYTE
Definition BasicTypes.h:24
unsigned int UINT32
Definition BasicTypes.h:48
#define Log(format,...)
Log without any prefix.
Definition HyperDbgHyperLogIntrinsics.h:129
BOOLEAN ProcessCheckIfEprocessIsValid(UINT64 Eprocess, UINT64 ActiveProcessHead, ULONG ActiveProcessLinksOffset)
checks whether the given nt!_EPROCESS is valid or not
Definition Process.c:264
The structure showing list of threads (details of each entry)
Definition RequestStructures.h:728
UINT64 Ethread
Definition RequestStructures.h:730
UINT32 ThreadId
Definition RequestStructures.h:732
UINT64 Eprocess
Definition RequestStructures.h:729
UINT32 ProcessId
Definition RequestStructures.h:731
UINT32 ThreadListHeadOffset
Definition RequestStructures.h:699
UINT32 CidOffset
Definition RequestStructures.h:701
UINT32 ThreadListEntryOffset
Definition RequestStructures.h:700
UINT64 PsActiveProcessHead
Definition RequestStructures.h:702
UINT64 Process
Definition RequestStructures.h:704
ULONG ActiveProcessLinksOffset
Definition RequestStructures.h:703