GetSystemInfo retrieves information about the current system.
VOID GetSystemInfo(
_Out_ LPSYSTEM_INFO lpSystemInfo
);
| Parameter | Description |
|---|---|
lpSystemInfo |
A pointer to a SYSTEM_INFO structure that receives general information about the current computer. This structure contains information about the processor architecture, the number of processors, the page size, and the amount of physical memory and virtual memory available.
|
This function does not return a value.
The GetSystemInfo function retrieves a system's architecture-dependent information into the SYSTEM_INFO structure.
To retrieve detailed system information, use the GlobalMemoryStatusEx function.
For a table of supported operating systems, see Supported operating systems.
| Attribute | Value |
|---|---|
| Minimum supported client | Windows 2000 Professional [desktop apps only] |
| Minimum supported server | Windows 2000 Server [desktop apps only] |
| Header | winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
The SYSTEM_INFO structure receives general information about the current computer. This structure contains information about the processor architecture, the number of processors, the page size, and the amount of physical memory and virtual memory available.
typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO, *LPSYSTEM_INFO;
| Member | Description |
|---|---|
dwOemId |
This member is reserved. Do not use it. |
wProcessorArchitecture |
The processor architecture of the current computer. This member can be one of the following values:
|
dwPageSize |
The page size, in bytes. |
lpMinimumApplicationAddress |
A pointer to the minimum address space available to an application. |
lpMaximumApplicationAddress |
A pointer to the maximum address space available to an application. If the system is WOW64 (32-bit Windows on a 64-bit system), this member is (LPVOID)0x7FFFFFFF. If the system is not WOW64, the value is (LPVOID)0xFFFFFFFF. |
dwActiveProcessorMask |
A mask representing the set of processors currently active in the system. |
dwNumberOfProcessors |
The number of logical processors in the current processor group. |
dwProcessorType |
An array of bits that specify the type of processor in the system. This member can be one of the following values:
|
dwAllocationGranularity |
The granularity of the memory allocation, in bytes. This is the value for the dwGranularity member of the VirtualAlloc function. |
wProcessorLevel |
The level of the current processor. The value is processor-specific. |
wProcessorRevision |
The revision number of the current processor. |
The following C++ code retrieves system information and prints the number of processors and the page size.
#include <windows.h>
#include <iostream>
int main() {
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
std::wcout << L"Number of processors: " << sysInfo.dwNumberOfProcessors << std::endl;
std::wcout << L"Page size: " << sysInfo.dwPageSize << L" bytes" << std::endl;
std::wcout << L"Processor type: " << sysInfo.dwProcessorType << std::endl;
return 0;
}