News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

SYSTEM_BASIC_INFORMATION documented

Started by guga, July 13, 2014, 06:15:46 PM

Previous topic - Next topic

guga

SYSTEM_BASIC_INFORMATION fully documented by me.

Quote
SYSTEM_BASIC_INFORMATION

structure

When the SystemInformationClass parameter is SYS_NFO_SYSTEM_BASIC_INFORMATION (SystemBasicInformation), the buffer pointed to by the SystemInformation parameter of the function NtQuerySystemInformation should be large enough to hold a single SYSTEM_BASIC_INFORMATION structure having the following layout:

RosAsm syntax:

[SYSTEM_BASIC_INFORMATION:
Reserved: D$ 0
TimerResolution: D$ 0
PageSize: D$ 0
NumberOfPhysicalPages: D$ 0
LowestPhysicalPageNumber: D$ 0
HighestPhysicalPageNumber: D$ 0
AllocationGranularity: D$ 0
MinimumUserModeAddress: D$ 0
MaximumUserModeAddress: D$ 0
ActiveProcessorsAffinityMask: D$ 0
NumberOfProcessors: B$ 0]

C Syntax:

typedef struct _SYSTEM_BASIC_INFORMATION {
    ULONG Reserved;
    ULONG TimerResolution;
    ULONG PageSize;
    ULONG NumberOfPhysicalPages;
    ULONG LowestPhysicalPageNumber;
    ULONG HighestPhysicalPageNumber;
    ULONG AllocationGranularity;
    ULONG MinimumUserModeAddress;
    ULONG MaximumUserModeAddress;
    KAFFINITY ActiveProcessorsAffinityMask;
    CCHAR NumberOfProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;

Members:

Reserved
   This value is reserved. Should not be used. It is always set to zero or an unknown value.
TimerResolution
The resolution of the hardware time. All time values in NT are specified as 64-bit LARGE_INTEGER values in units of 100 nanoseconds. This field allows an application to
understand how many of the low order bits of a system time value are insignificant. The values are limitd to a maximum number of 100-nanosecond units between clock ticks.
Also the number of 100-nanosecond units per clock tick for kernel intervals measured in clock ticks.
PageSize
   The physical page size (in bytes) for virtual memory objects. Physical memory is committed in PageSize chunks. Each chunk is represented by the equate
      PAGE_SIZE 0x1000 <-- This value is the same for Intel 386 and AMD64
      An alias for this equate in NT is:
      PAGE_SIZE_X86NT 0x1000
NumberOfPhysicalPages
   The number of physical pages managed by the operating system.
LowestPhysicalPageNumber
   The number of the lowest physical page managed by the operating system (numbered from zero).
HighestPhysicalPageNumber
   The number of the highest physical page managed by the operating system (numbered from zero).
AllocationGranularity
   The granularity to which the base address of virtual memory reservations is rounded. The logical page size for virtual memory objects.
   Allocating 1 byte of virtual memory will actually allocate AllocationGranularity bytes of virtual memory.
   Storing into that byte will commit the first physical page of the virtual memory.
   The granularity can be represented by the equate:
   MM_ALLOCATION_GRANULARITY ((ULONG)0x10000)
MinimumUserModeAddress
   The lowest virtual address potentially available to user mode applications. The smallest valid user mode address.
   The first AllocationGranularity bytes of the virtual address space are reserved.
   This forces access violations for code the dereferences a zero pointer.
   The equate representation can be:
      MM_LOWEST_USER_ADDRESS 0x10000
MaximumUserModeAddress
   The highest virtual address potentially available to user mode applications. The largest valid user mode address.
   The next AllocationGranularity bytes of the virtual address space are reserved.
   This allows system service routines to validate user mode pointer parameters quickly.
ActiveProcessorsAffinityMask
   A bit mask representing the set of active processors in the system. Bit 0 is processor 0; bit 31 is processor 31. The affinity mask for the current hardware configuration
NumberOfProcessors
   The NumberOfProcessors member contains the number of logical processors in the current group. Use GetSystemInfo, GetLogicalProcessorInformation or GetLogicalProcessorInformationEx instead to retrieve this information.
       Note  For information about the physical processors shared by logical processors, call GetLogicalProcessorInformationEx with the RelationshipType parameter set to RelationProcessorPackage (3).

Remarks:
   Much of the data in this information class can be obtained by calling the Win32 function GetSystemInfo.

Header:
sysinfo.c in Windows Research kernel

See Also:
NtQueryTimer
NtSetTimerResolution


This structure is to be used with SYS_NFO_SYSTEM_BASIC_INFORMATION equate (Aka: SystemBasicInformation. Value = 0) in NtQuerySystemInformation function.

Example of usage:
[SYSTEM_BASIC_INFORMATION:
SYSTEM_BASIC_INFORMATION.Reserved: D$ 0
SYSTEM_BASIC_INFORMATION.TimerResolution: D$ 0
SYSTEM_BASIC_INFORMATION.PageSize: D$ 0
SYSTEM_BASIC_INFORMATION.NumberOfPhysicalPages: D$ 0
SYSTEM_BASIC_INFORMATION.LowestPhysicalPageNumber: D$ 0
SYSTEM_BASIC_INFORMATION.HighestPhysicalPageNumber: D$ 0
SYSTEM_BASIC_INFORMATION.AllocationGranularity: D$ 0
SYSTEM_BASIC_INFORMATION.MinimumUserModeAddress: D$ 0
SYSTEM_BASIC_INFORMATION.MaximumUserModeAddress: D$ 0
SYSTEM_BASIC_INFORMATION.ActiveProcessorsAffinityMask: D$ 0
SYSTEM_BASIC_INFORMATION.NumberOfProcessors: B$ 0]

[Size_of_SYSTEM_BASIC_INFORMATION 44]

call 'ntdll.NtQuerySystemInformation' &SYS_NFO_SYSTEM_BASIC_INFORMATION, SYSTEM_BASIC_INFORMATION, Size_of_SYSTEM_BASIC_INFORMATION, 0



Note by me:
I really don´t underdstand why M$ didn´t documented those structures and enumerations. The information is all there in the NT, 2000 and Xp sources and not only collected here and there.
DAMN M$. Those structures provides rich informatin that can be way better used then the common Apis, and despite what it does says on msdn site, the enumerations and structures ARE NOT CHANGED since NT days. Some can being update, but the members of some structures have being increased. So, it won´t bottler that much if they documented all this valuable info.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com