345{
348 LIST_ENTRY ActiveProcessLinks = {0};
349 UCHAR ImageFileName[15] = {0};
351 UINT32 EnumerationCount = 0;
352 UINT32 MaximumBufferCount = 0;
354
355
356
357
359 CountOfProcesses == NULL)
360 {
362 }
363
365 (ListSaveBuffer == NULL || ListSaveBuffSize == 0))
366 {
368 }
369
370
371
372
374 {
376 }
377
378
379
380
385
386
387
388
393 {
395 }
396
397
398
399
401 {
402
403
404
405
407
408
409
410
411 Process = (
UINT64)ActiveProcessLinks.Flink - ActiveProcessLinksOffset;
412
413 do
414 {
415
416
417
419 &ImageFileName,
420 sizeof(ImageFileName));
421
423 &UniquePid,
424 sizeof(UniquePid));
425
427 &ActiveProcessLinks,
428 sizeof(ActiveProcessLinks));
429
430
431
432
435
436
437
438
439 switch (QueryAction)
440 {
442
443 Log(
"PROCESS\t%llx\n\tProcess Id: %04x\tDirBase (Kernel Cr3): %016llx\tImage: %s\n\n",
444 Process,
445 UniquePid,
447 ImageFileName);
448
450
451 EnumerationCount++;
452
453 break;
454
456
457 EnumerationCount++;
458
459
460
461
462 if (EnumerationCount == MaximumBufferCount - 1)
463 {
464
465
466
467 goto ReturnEnd;
468 }
469
470
471
472
473 SavingEntries[EnumerationCount - 1].
Eprocess = Process;
475 SavingEntries[EnumerationCount - 1].
Cr3 = ProcessCr3.
Flags;
476 RtlCopyMemory(&SavingEntries[EnumerationCount - 1].ImageFileName, ImageFileName, 15);
477
478 break;
479
480 default:
481
482 LogError(
"Err, invalid action specified for process enumeration");
483
484 break;
485 }
486
487
488
489
490 Process = (
UINT64)ActiveProcessLinks.Flink - ActiveProcessLinksOffset;
491
492 }
while ((
UINT64)ActiveProcessLinks.Flink != ActiveProcessHead);
493 }
494 else
495 {
496
497
498
500 }
501
502ReturnEnd:
503
504
505
506
508 {
509 *CountOfProcesses = EnumerationCount;
510 }
511
513}
unsigned char UCHAR
Definition BasicTypes.h:35
unsigned int UINT32
Definition BasicTypes.h:48
unsigned long ULONG
Definition BasicTypes.h:37
#define Log(format,...)
Log without any prefix.
Definition HyperDbgHyperLogIntrinsics.h:129
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
CR3 Structure.
Definition BasicTypes.h:130
UINT64 Flags
Definition BasicTypes.h:133
The structure showing list of processes (details of each entry)
Definition RequestStructures.h:714
UINT64 Cr3
Definition RequestStructures.h:717
UINT32 ProcessId
Definition RequestStructures.h:716
UINT64 Eprocess
Definition RequestStructures.h:715
ULONG UniquePidOffset
Definition RequestStructures.h:687
ULONG ImageFileNameOffset
Definition RequestStructures.h:686
ULONG ActiveProcessLinksOffset
Definition RequestStructures.h:688
UINT64 PsActiveProcessHead
Definition RequestStructures.h:685
KPROCESS Brief structure.
Definition Common.h:265
ULONG_PTR DirectoryTableBase
Definition Common.h:268