Windows Dev Center

System Information API Reference

Overview

This section provides APIs for retrieving and managing system-level information about the Windows operating system and its hardware components. Developers can use these APIs to gain insights into system performance, configuration, and available resources.

Key areas covered include:

  • Hardware details (CPU, memory, disk, network adapters)
  • Operating system version and build information
  • User session data
  • System power status
  • Device enumeration

Core APIs

GetSystemInfo()

Retrieves general information about the current system.

DWORD GetSystemInfo(
  LPSYSTEM_INFO lpSystemInfo
);

Parameters

  • lpSystemInfo: A pointer to a SYSTEM_INFO structure that receives information about the current system.

Return Value

If the function succeeds, the return value is non-zero.

If the function fails, the return value is zero. To get extended error information, call GetLastError().

GlobalMemoryStatusEx()

Fills the MEMORYSTATUSEX structure with information about the current memory availability. This includes information about the total physical memory and available physical memory, the total virtual memory and available virtual memory, and the amount of memory used by the operating system.

BOOL GlobalMemoryStatusEx(
  LPMEMORYSTATUSEX lpBuffer
);

Parameters

  • lpBuffer: A pointer to a MEMORYSTATUSEX structure that receives information about the current memory status.

Return Value

If the function succeeds, the return value is a non-zero value, and lpBuffer is updated with the memory information.

If the function fails, the return value is zero, and lpBuffer is not updated.

GetNativeSystemInfo()

Retrieves detailed information about the current processor and operating system. This function is similar to GetSystemInfo but provides more architecture-specific information.

VOID GetNativeSystemInfo(
  LPSYSTEM_INFO lpSystemInfo
);

Parameters

  • lpSystemInfo: A pointer to a SYSTEM_INFO structure that receives information about the current system.
Note: Ensure proper error handling by checking the return values of these functions and using GetLastError() when necessary to diagnose issues.