NTSTATUS PurgeModifiedAndStandbyLists()

in Silhouette/Utils.cpp [188:213]


NTSTATUS PurgeModifiedAndStandbyLists()
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    ULONG command = 0;

    // Flush pages from modified list to the priority 0 standby list
    command = MemoryFlushModifiedList;
    ntStatus = ZwSetSystemInformation(SystemMemoryListInformation, &command, sizeof(command));
    if (!NT_SUCCESS(ntStatus))
    {
        goto Cleanup;
    }

    // Flush the priority 0 standby list
    command = MemoryPurgeLowPriorityStandbyList;
    ntStatus = ZwSetSystemInformation(SystemMemoryListInformation, &command, sizeof(command));
    if (!NT_SUCCESS(ntStatus))
    {
        goto Cleanup;
    }

    // DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, "Silhouette: Purged standby list\n");

Cleanup:
    return ntStatus;
}