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;
Members
dwNumberOfProcessors
Number of processors in the system.
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;
Members
dwNumberOfProcessors
Number of processors in the system.
DWORD GetNumberOfProcessors()
{
SYSTEM_INFO SysInfo; GetSystemInfo(&SysInfo);
return SysInfo.dwNumberOfProcessors;
}
NtQuerySystemInformation(1,&SYSTEM_PROCESSOR_INFORMATION,sizeof(SYSTEM_PROCESSOR_INFORMATION),&dwLen);大致如此
此函数在ntdll.dll内
[NtQuerySystemInformation is available for use in Windows 2000 and Windows XP. It may be altered or unavailable in subsequent versions. Applications should use the alternate functions listed in this topic.]