Windows-有没有较全的NtBuildNumber的列表和对应的系统?

Windows-有没有较全的NtBuildNumber的列表和对应的系统?

甜柠檬 发布于 2017-01-20 字数 151 浏览 1639 回复 2

在驱动开发中,需要判断当前的系统,一般用NtBuildNumber这个内核导出的整数来判断。有没有一个比较全的该变量的数据列表以及对应的Windows操作系统的列表

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灵芸 2017-07-01 2 楼

NtBuildNumber对应这的RTM build

Version - Marketing name - RTMbuild
NT 3.1 - Windows NT 3.1 - 528
NT 3.5 - Windows NT 3.5 - 807
NT 3.51 - Windows NT 3.51 - 1057
NT 4.0 - Windows NT 4.0 - 1381
NT 5.0 - Windows 2000 - 2195
NT 5.1 - Windows XP - 2600
NT 5.1 - Windows Fundamentals for Legacy PCs - 2600
NT 5.2 - Windows XP - 3790
NT 5.2 - Windows Server 2003 - 3790
NT 5.2 - Windows XP - 3790
NT 5.2 - Windows Server 2003 R2 - 3790
NT 5.2 - Windows Home Server - 3790
NT 6.0 - Windows Vista - 6000
- - 6001(SP1)
- - 6002(SP2)
NT 6.0 - Windows Server 2008 - 6001
- - 6002(SP2)
NT 6.1[20] - Windows 7 - 7600
- - 7601(SP1)
NT 6.1[20] - Windows Server 2008 R2 - 7600
- - 7601(SP1)
TBA - Windows 8 - TBA
TBA - Windows Server 8 - TBA

http://en.wikipedia.org/wiki/Windows_NT#Releases

想挽留 2017-03-29 1 楼

这是我驱动中获得操作系统版本的代码,稳定,看看吧。

typedef enum _WIN_VER_DETAIL {
WINDOWS_VERSION_NONE, // 0
WINDOWS_VERSION_2K,
WINDOWS_VERSION_XP,
WINDOWS_VERSION_2K3,
WINDOWS_VERSION_2K3_SP1_SP2,
WINDOWS_VERSION_VISTA_2008, //or windows 2008
WINDOWS_VERSION_7, //Windows7RC or Windows7Beta
} WIN_VER_DETAIL;

typedef NTSTATUS (NTAPI * PFN_RtlGetVersion)(OUT PRTL_OSVERSIONINFOW lpVersionInformation);

EXTERN_C WIN_VER_DETAIL GetWindowsVersion()
{
UNICODE_STRING ustrFuncName = { 0 };
RTL_OSVERSIONINFOEXW osverinfo = { sizeof(osverinfo) };
PFN_RtlGetVersion pfnRtlGetVersion = NULL;

RtlInitUnicodeString(&ustrFuncName, L"RtlGetVersion");
pfnRtlGetVersion = MmGetSystemRoutineAddress(&ustrFuncName);

if (pfnRtlGetVersion)
{
KdPrint(("[xxxxxxxx] Using "RtlGetVersion"n"));
pfnRtlGetVersion((PRTL_OSVERSIONINFOW)&osverinfo);
}
else
{
KdPrint(("[xxxxxxxx] Using "PsGetVersion"n"));
PsGetVersion(&osverinfo.dwMajorVersion, &osverinfo.dwMinorVersion, &osverinfo.dwBuildNumber, NULL);
}

KdPrint(("[xxxxxxxx] OSVersion NT %d.%d:%d sp%d.%dn",
osverinfo.dwMajorVersion, osverinfo.dwMinorVersion, osverinfo.dwBuildNumber,
osverinfo.wServicePackMajor, osverinfo.wServicePackMinor));

if (osverinfo.dwMajorVersion == 5 && osverinfo.dwMinorVersion == 0) {
return WINDOWS_VERSION_2K;
} else if (osverinfo.dwMajorVersion == 5 && osverinfo.dwMinorVersion == 1) {
return WINDOWS_VERSION_XP;
} else if (osverinfo.dwMajorVersion == 5 && osverinfo.dwMinorVersion == 2) {
if (osverinfo.wServicePackMajor==0) {
return WINDOWS_VERSION_2K3;
} else {
return WINDOWS_VERSION_2K3_SP1_SP2;
}
} else if (osverinfo.dwMajorVersion == 6 && osverinfo.dwMinorVersion == 0) {
return WINDOWS_VERSION_VISTA_2008;
}
else if ((osverinfo.dwMajorVersion == 6 && osverinfo.dwMinorVersion == 1) ||
osverinfo.dwBuildNumber == 7000) {
return WINDOWS_VERSION_7;
}

return WINDOWS_VERSION_NONE;
}