设为首页 加入收藏

TOP

获取系统信息(一)
2014-11-23 21:38:08 来源: 作者: 【 】 浏览:6
Tags:获取 系统 信息

在注册表HKEY_LOCAL_MACHINE\HARDWARE \DESCRIPTION\System\CentralProcessor\0\ProcessorNameString和~MHz字段下是 CPU字符串描述和主频描述,可以用读注册表函数读出。

CPU内核个数的获取:

主要和以下系统结构有关

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;

使用GlobalSystemInfo函数直接获取

2.内存信息

主要和以下系统结构有关

typedef struct _MEMORYSTATUS {
DWORD dwLength ; // 结构自身长度
DWORD dwMemoryLoad ; //
SIZE_T dwTotalPhys ; // 总的内存总量(内存条)
SIZE_T dwAvailPhys ; // 除去当前系统用的,剩下的空闲内存量
SIZE_T dwTotalPageFile ;
SIZE_T dwAvailPageFile ;
SIZE_T dwTotalVirtual ;
SIZE_T dwAvailVirtual ; } MEMORYSTATUS,
*LPMEMORYSTATUS;

使用GlobalMemoryStatus直接获取

3.操作系统信息

主要和以下系统结构有关

typedef struct _OSVERSIONINFO {
DWORD dwOSVersionInfoSize ; // 结构自身长度
DWORD dwMajorVersion ; // 主版本
DWORD dwMinorVersion ; // 小版本
DWORD dwBuildNumber ; // 创建号
DWORD dwPlatformId ; // 2:winnt 1:win9x
TCHAR szCSDVersion [128]; } OSVERSIONINFO;

typedef struct _OSVERSIONINFOEX {
DWORD dwOSVersionInfoSize ;
DWORD dwMajorVersion ;
DWORD dwMinorVersion ;
DWORD dwBuildNumber ;
DWORD dwPlatformId ;
TCHAR szCSDVersion [128]; // 服务号字符串
WORD wServicePackMajor ; // 主服务号
WORD wServicePackMinor ; // 次服务号
WORD wSuiteMask ; // 软件套装掩码
BYTE wProductType ; // 产品类型(服务器,工作站,域控制器)
BYTE wReserved ; } OSVERSIONINFOEX,
*POSVERSIONINFOEX,
*LPOSVERSIONINFOEX;

使用GetVersionEx直接获取

4.系统运行时间

使用函数DWORD WINAPI GetTickCount(void)获取,返回系统开始运行到现在的毫秒数

5.系统目录

使用函数GetSystemDirectory获取

6.系统语言

使用函数GetSystemDefaultLangID(void)获取,返回一个语言ID号

一般对应值

{0x0401,"Arabic (Saudi Arabia)"},
{0x0801,"Arabic (Iraq)"},
{0x0c01,"Arabic (Egypt)"},
{0x1001,"Arabic (Libya)"},
{0x1401,"Arabic (Algeria)"},
{0x1801,"Arabic (Morocco)"},
{0x1c01,"Arabic (Tunisia)"},
{0x2001,"Arabic (Oman)"},
{0x2401,"Arabic (Yemen)"},
{0x2801,"Arabic (Syria)"},
{0x2c01,"Arabic (Jordan)"},
{0x3001,"Arabic (Lebanon)"},
{0x3401,"Arabic (Kuwait)"},
{0x3801,"Arabic (U.A.E.)"},
{0x3c01,"Arabic (Bahrain)"},
{0x4001,"Arabic (Qatar)"},
{0x0402,"Bulgarian"},
{0x0403,"Catalan"},
{0x0404,"Chinese (Taiwan Region, PRC)"},
{0x0804,"Chinese (PRC)"},
{0x0c04,"Chinese (Hong Kong SAR, PRC)"},
{0x1004,"Chinese (Singapore , PRC)"},
{0x0405,"Czech"},
{0x0406,"Danish"},
{0x0407,"German (Standard)"},
{0x0807,"German (Swiss)"},
{0x0c07,"German (Austrian)"},
{0x1007,"German (Luxembourg)"},
{0x1407,"German (Liechtenstein)"},
{0x0408,"Greek"},
{0x0409,"English (United States)"},
{0x0809,"English (United Kingdom)"},
{0x0c09,"English (Australian)"},
{0x1009,"English (Canadian)"},
{0x1409,"English (New Zealand)"},
{0x1809,"English (Ireland)"},
{0x1c09,"English (South Africa)"},
{0x2009,"English (Jamaica)"},
{0x2409,"English (Caribbean)"},
{0x2809,"English (Belize)"},
{0x2c09,"English (Trinidad)"},
{0x040a,"Spanish (Traditional Sort)"},
{0x080a,"Spanish (Mexican)"},
{0x0c0a,"Spanish (Modern Sor

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇C语言之变量的作用域和存储类型详.. 下一篇服务函数编程

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: