windows 获得系统信息 GetSystemInfo

#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")

void main()
{
   SYSTEM_INFO siSysInfo;

   // Copy the hardware information to the SYSTEM_INFO structure. 

   GetSystemInfo(&siSysInfo); 

   // Display the contents of the SYSTEM_INFO structure. 

   printf("Hardware information: \n");  
   printf(" OEM ID: %u\n", siSysInfo.dwOemId);
   printf(" Number of processors: %u\n", 
      siSysInfo.dwNumberOfProcessors); 
   printf(" Page size: %u\n", siSysInfo.dwPageSize); 
   printf(" Processor type: %u\n", siSysInfo.dwProcessorType); 
   printf(" Minimum application address: %lx\n", 
      siSysInfo.lpMinimumApplicationAddress); 
   printf(" Maximum application address: %lx\n", 
      siSysInfo.lpMaximumApplicationAddress); 
   printf(" Active processor mask: %u\n", 
      siSysInfo.dwActiveProcessorMask); 
}

SYSTEM_INFO siSysInfo类型信息

typedef struct _SYSTEM_INFO {
  union {
    DWORD  dwOemId;
    struct {
      WORD wProcessorArchitecture;
      WORD wReserved;
    };
  };
  DWORD     dwPageSize;
  LPVOID    lpMinimumApplicationAddress;
  LPVOID    lpMaximumApplicationAddress;
  DWORD_PTR dwActiveProcessorMask;
  DWORD     dwNumberOfProcessors;
  DWORD     dwProcessorType;
  DWORD     dwAllocationGranularity;
  WORD      wProcessorLevel;
  WORD      wProcessorRevision;
} SYSTEM_INFO;

你可能感兴趣的:(windows,系统信息)