GetSystemInfo()

时间:2021-03-18 07:35:56

关于“GetSystemInfo()”的详细信息,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724381(v=vs.85).aspx

Getting Hardware Information 例程:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724423(v=vs.85).aspx

函数原型:void WINAPI GetSystemInfo(   _Out_ LPSYSTEM_INFO lpSystemInfo );

作用:获取当前系统的信息。

参数:lpSystemInfo - A pointer to a SYSTEM_INFO structure that receives the information.

 #include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib") int 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);
return ;
}