From fe746680f95ef3ae488f3fe77b2df10889d254e2 Mon Sep 17 00:00:00 2001 From: v1k1ngfr Date: Thu, 11 Apr 2024 16:24:12 +0200 Subject: [PATCH] Support Win10 - modify _PF_MEMORY_RANGE_INFO structure, set version to 2 and flags to 0 --- MemInfo/MemInfo.cpp | 8 +++++--- MemInfo/MemInfo.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/MemInfo/MemInfo.cpp b/MemInfo/MemInfo.cpp index 8ace6f3..90fecd6 100644 --- a/MemInfo/MemInfo.cpp +++ b/MemInfo/MemInfo.cpp @@ -60,9 +60,10 @@ NTSTATUS PfiQueryMemoryRanges() { ULONG ResultLength = 0; // - // Memory Ranges API was added in RTM, this is Version 1 + // Memory Ranges API was added in RTM, this is Version 1. Since Windows 10 it is Version 2. // - MemoryRangeInfo.Version = 1; + MemoryRangeInfo.Version = 2; + MemoryRangeInfo.flags = 0; // // Build the Superfetch Information Buffer @@ -84,7 +85,8 @@ NTSTATUS PfiQueryMemoryRanges() { // Reallocate memory // MemoryRanges = static_cast(::HeapAlloc(GetProcessHeap(), 0, ResultLength)); - MemoryRanges->Version = 1; + MemoryRanges->Version = 2; + MemoryRanges->flags = 0; // // Rebuild the buffer diff --git a/MemInfo/MemInfo.h b/MemInfo/MemInfo.h index aa2e2e9..97a2830 100644 --- a/MemInfo/MemInfo.h +++ b/MemInfo/MemInfo.h @@ -139,11 +139,21 @@ typedef struct _PF_PHYSICAL_MEMORY_RANGE { ULONG_PTR PageCount; } PF_PHYSICAL_MEMORY_RANGE, *PPF_PHYSICAL_MEMORY_RANGE; +/* typedef struct _PF_MEMORY_RANGE_INFO { ULONG Version; ULONG RangeCount; PF_PHYSICAL_MEMORY_RANGE Ranges[ANYSIZE_ARRAY]; } PF_MEMORY_RANGE_INFO, *PPF_MEMORY_RANGE_INFO; +*/ +//Information from https://blog.midi12.re/systemsuperfetchinformation/ +typedef struct _PF_MEMORY_RANGE_INFO { + ULONG Version; + ULONG flags; // added between 10_1709_16299_248 and 10_1803_17134_81 + ULONG RangeCount; + PF_PHYSICAL_MEMORY_RANGE Ranges[ANYSIZE_ARRAY]; +} PF_MEMORY_RANGE_INFO, * PPF_MEMORY_RANGE_INFO; + // // Sub-Information Types for PFN Identity