GetSystemInfo

Retrieves information about the current system.

Syntax


VOID GetSystemInfo(
  [out] LPSYSTEM_INFO lpSystemInfo
);
            

Parameters

Name Type Description
lpSystemInfo LPSYSTEM_INFO A pointer to a SYSTEM_INFO structure that receives the system information.

Return Value

This function does not return a value.

Value Description
None This function does not return a value.

Remarks

SYSTEM_INFO Structure

The SYSTEM_INFO structure contains information about the current computer system. This information can be used to optimize the performance of applications.


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;
            

Members:

Example


#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 & std::endl;
    std::cout << "Processor Level: " << sysInfo.wProcessorLevel & std::endl;
    std::cout << "Processor Revision: " << sysInfo.wProcessorRevision & std::endl;

    return 0;
}
            

Requirements

Client Server
Windows 2000 Professional [desktop apps | only] Windows 2000 Server [desktop apps | only]
Windows XP Professional [desktop apps | only] Windows Server 2003 [desktop apps | only]
Windows Vista [desktop apps | only] Windows Server 2008 [desktop apps | only]
Windows 7 [desktop apps | only] Windows Server 2008 R2 [desktop apps | only]
Windows 8 [desktop apps | only] Windows Server 2012 [desktop apps | only]
Windows 8.1 [desktop apps | only] Windows Server 2012 R2 [desktop apps | only]
Windows 10 [desktop apps | only] Windows Server 2016 [desktop apps | only]
Windows 11 [desktop apps | only] Windows Server 2019 [desktop apps | only]
Windows Server 2022 [desktop apps | only]

See Also

Last updated: October 15, 2023. Copyright © Microsoft Corporation. All rights reserved.