File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -502,6 +502,7 @@ NTSTATUS BBFindOrMapModule(
502
502
ALLOCATE_FREE_MEMORY request = { 0 };
503
503
ALLOCATE_FREE_MEMORY_RESULT mapResult = { 0 };
504
504
505
+ request .pid = (ULONG )(ULONG_PTR )PsGetProcessId ( pProcess );
505
506
request .allocate = TRUE;
506
507
request .physical = TRUE;
507
508
request .protection = PAGE_EXECUTE_READWRITE ;
@@ -649,8 +650,22 @@ NTSTATUS BBFindOrMapModule(
649
650
// Delete remote image
650
651
if (pLocalImage -> baseAddress )
651
652
{
652
- SIZE_T tmpSize = 0 ;
653
- ZwFreeVirtualMemory ( ZwCurrentProcess (), & pLocalImage -> baseAddress , & tmpSize , MEM_RELEASE );
653
+ if (flags & KHideVAD )
654
+ {
655
+ ALLOCATE_FREE_MEMORY request = { 0 };
656
+ ALLOCATE_FREE_MEMORY_RESULT mapResult = { 0 };
657
+
658
+ request .pid = (ULONG )(ULONG_PTR )PsGetProcessId ( pProcess );
659
+ request .allocate = FALSE;
660
+ request .physical = TRUE;
661
+
662
+ BBAllocateFreePhysical ( pProcess , & request , & mapResult );
663
+ }
664
+ else
665
+ {
666
+ SIZE_T tmpSize = 0 ;
667
+ ZwFreeVirtualMemory ( ZwCurrentProcess (), & pLocalImage -> baseAddress , & tmpSize , MEM_RELEASE );
668
+ }
654
669
}
655
670
656
671
RtlFreeUnicodeString ( & pLocalImage -> fullPath );
You can’t perform that action at this time.
0 commit comments