GetSystemInfo详解

VOID GetSystemInfo(LPSYSTEM_INFO lpSystemInfo)
这个函数是用来获取系统信息的
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;
SYSTEM_INFO为需要填充的结构体

dwPageSize:用于显示CPU的页面大小,在x86CPU上,这个值为4096,在Alpha CPU上,这个值为8192,在IA-64上,这个值为8192
在讲lpMinimumApplicationAddress之前,我们先看张图
GetSystemInfo详解_第1张图片
应用程序可用的地址为用户方式的分区,对于windows98来说是0x00400000-0x7FFFFFFF,对于2GB方式的32位windows2000来说为0x00010000-0x7FFEFFFF,对于3GB方式的32位windows2000来说为0x00010000-0xBFFEFFFF,对于64位的windows2000用户方式分区就更大了,在这里lpMinimumApplicationAddress选择起始地址,lpMaximumApplicationAddress选择终止地址

lpMinimumApplicationAddress:如上对于windows98来说为0x00400000,对于windows2000来说为0x00010000

lpMaximumApplicationAddres:windows98为0x7FFFFFFF,windows2000为0x7FFEFFFF

dwAllocationGranularity:所有的windows平台的分配粒度都为64KB

dwOemId,wReserved已废弃

dwNumberOfProcessors:处理器的数目

dwActiveProcessorMask:位屏蔽,用于指明哪些CPU是可活动的,比如0x0000000000000003表明CPU0和CPU1可活动

dwProcessorType:只用于windows98,用于指明处理器的类型

详细要说的是这部分
wProcessorArchitecture,wProcessorLevel,wProcessRevision这部分是配合的
我就说下我收集到的资料
当wProcessorArchitecture为PROCESSOR_ARCHITECTURE_INTEL=0时
wProcessorLevel为3: CPU为80386
4:80486
5:Pentinum
15:Pentinum4
6:当wProcessorLevel为6时:
取wProcessorRevision的高字节
HIBYTE(wProcessorRevision)
1:Pentinum Pro
3,5:Pentinum II
6:Celeron
7,8,11:Pentinum III
9,13:Pentinum M
10:Pentinum Xeon
15:Core2 Duo

你可能感兴趣的:(GetSystemInfo详解)