// GetSystemInfo.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <iomanip>
using namespace std;
int main()
{
SYSTEM_INFO systemInfo;
GetSystemInfo(&systemInfo);
//setw();相对于右对齐n位 setw()只对其后面紧跟的输出产生作用
cout <<setw(20) << "处理器掩码: " << systemInfo.dwActiveProcessorMask << endl
<<setw(20) << "处理器个数: " << systemInfo.dwNumberOfProcessors << endl
<<setw(20) << "处理器分页大小: " << systemInfo.dwPageSize << endl
<<setw(20) << "处理器类型: " << systemInfo.dwProcessorType << endl
<<setw(20) << "最大寻址单元: " << systemInfo.lpMaximumApplicationAddress << endl
<<setw(20) << "最小寻址单元: " << systemInfo.lpMinimumApplicationAddress << endl
<<setw(20) << "处理器等级: " << systemInfo.wProcessorLevel << endl
<<setw(20) << "处理器版本: " << systemInfo.wProcessorRevision << endl;
// LPOSVERSIONINFOA version;
OSVERSIONINFOEX version; //获取系统版本信息
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFOA)&version);
cout<<"System info:"<<endl;
cout<<"Version:"<<version.dwMajorVersion<<"."<<version.dwMinorVersion
<<" Build "<<version.dwBuildNumber
<<" Service Pack "<<version.wServicePackMajor<<"."<<version.wServicePackMinor<<endl;
return 0;
}
处理器掩码: 15
处理器个数: 4
处理器分页大小: 4096
处理器类型: 586
最大寻址单元: 7FFEFFFF
最小寻址单元: 00010000
处理器等级: 6
处理器版本: 15363
System info:
Version:6.1 Build 7601 Service Pack 1.0
Press any key to continue
时间: 2024-10-10 04:29:34