Retrieves information about the current system.
VOID GetSystemInfo(LPSYSTEM_INFO lpSystemInfo);
Parameter | Description |
---|---|
lpSystemInfo |
A pointer to a SYSTEM_INFO structure that receives general information about the current computer. This structure can include information about the processor architecture, processor number, page size, and the smallest addressable unit of the computer. |
This function does not return a value. The information is returned in the structure pointed to by the lpSystemInfo
parameter.
The GetSystemInfo
function retrieves information about the computer, such as the number of processors and the page size. This information can be useful for a variety of tasks, including performance tuning and memory management.
The SYSTEM_INFO
structure populated by this function contains the following members:
Member | Description |
---|---|
wProcessorArchitecture |
The processor architecture of the installed computer. |
wReserved |
This parameter is reserved for future use. |
dwPageSize |
The page size and the granularity of memory allocation in bytes. |
lpMinimumApplicationAddress |
A pointer to the lowest memory address accessible to applications and dynamic-link libraries (DLLs). |
lpMaximumApplicationAddress |
A pointer to the highest memory address accessible to applications and DLLs. |
dwActiveProcessorMask |
A bitmask representing the set of processors that are currently active. |
dwNumberOfProcessors |
The number of logical processors in the current running environment. |
dwProcessorType |
An identifier for the architecture-specific processor type. |
dwAllocationGranularity |
The granularity of the virtual memory, in bytes. |
wProcessorLevel |
The processor level. |
wProcessorRevision |
The processor revision. |
Note: For Windows Server 2008 and later, the dwNumberOfProcessors
member is only valid if GetNativeSystemInfo
is called.
#include <windows.h>
#include <iostream>
int main() {
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
std::cout << "Processor Architecture: " << sysInfo.wProcessorArchitecture << std::endl;
std::cout << "Number of Processors: " << sysInfo.dwNumberOfProcessors << std::endl;
std::cout << "Page Size: " << sysInfo.dwPageSize << " bytes" << std::endl;
std::cout << "Active Processor Mask: " << std::hex << sysInfo.dwActiveProcessorMask << std::dec << std::endl;
return 0;
}
winbase.h
Kernel32.lib
Kernel32.dll