Hi all,
Is there any kernel API which allows determining platform physical
memory size available?
Thanks,
Igor Markov
Hi all,
Is there any kernel API which allows determining platform physical
memory size available?
Thanks,
Igor Markov
Posted by Igor Slewsarev to this list some time ago:
***************************************************************
Hi!
ZwQuerySystemInformation proto:
NTSYSAPI
NTSTATUS
NTAPI
ZwQuerySystemInformation(
IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
IN OUT PVOID SystemInformation,
IN ULONG SystemInformationLength,
OUT PULONG ReturnLength OPTIONAL
);
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemBasicInformation = 0,
// there are a lot of values, see “Windows NT/2000 Native API Reference”
// by Gary Nebbet for details
}SYSTEM_INFORMATION_CLASS;
typedef struct _SYSTEM_BASIC_INFORMATION {
ULONG Unknown; // Unknown
ULONG MaximumIncrement; // Timer increment in 100 ns units
ULONG PhysicalPageSize; // Hope, you know
ULONG NumberOfPhysicalPages; // Total number of pages manged by ntoskrnl
ULONG LowestPhysicalPage; // Lowest physical page number (usually
2 on PC)
ULONG HighestPhysicalPage; // Highest physical page number (This is
exactly you need)
ULONG AllocationGranularity;
ULONG LowestUserAddress;
ULONG HighestUserAddress;
ULONG ActiveProcessors;
UCHAR NumberProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
However NumberOfPhysicalPages field is the number of pages managed by NT OS
memory manager; so this value is lower than the ‘real’ number of MB.
Note, some amount of memory is reserved for BIOS/Option ROM shadowing, some
for ACPI tables and etc.
*****************************************************************************
Dmitriy Budko, VMware
NtQuerySystemInformation is (partially) documented in the Platform SDK.
=====================
Mark Roddy
Windows .NET/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dmitriy Budko
Sent: Tuesday, January 11, 2005 5:31 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Platform physical memory determinationPosted by Igor Slewsarev to this list some time ago:
***************************************************************
Hi!
ZwQuerySystemInformation proto:NTSYSAPI
NTSTATUS
NTAPI
ZwQuerySystemInformation(
IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
IN OUT PVOID SystemInformation,
IN ULONG SystemInformationLength,
OUT PULONG ReturnLength OPTIONAL
);typedef enum _SYSTEM_INFORMATION_CLASS {
SystemBasicInformation = 0,
// there are a lot of values, see “Windows NT/2000 Native API
Reference”
// by Gary Nebbet for details
}SYSTEM_INFORMATION_CLASS;typedef struct _SYSTEM_BASIC_INFORMATION {
ULONG Unknown; // Unknown
ULONG MaximumIncrement; // Timer increment in 100 ns units
ULONG PhysicalPageSize; // Hope, you know
ULONG NumberOfPhysicalPages; // Total number of pages
manged by ntoskrnl
ULONG LowestPhysicalPage; // Lowest physical page
number (usually
2 on PC)
ULONG HighestPhysicalPage; // Highest physical page
number (This is
exactly you need)
ULONG AllocationGranularity;
ULONG LowestUserAddress;
ULONG HighestUserAddress;
ULONG ActiveProcessors;
UCHAR NumberProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;However NumberOfPhysicalPages field is the number of pages
managed by NT OS memory manager; so this value is lower than
the ‘real’ number of MB.
Note, some amount of memory is reserved for BIOS/Option ROM
shadowing, some for ACPI tables and etc.
**************************************************************
***************Dmitriy Budko, VMware
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com