驱动获取系统版本信息有2个函数,分别是PsGetVersion RtlGetVersion
PsGetVersion在XP后已经不建议使用,
-
/*Returns the windows version we're running on*/
-
vboxWinVersion_t VBoxQueryWinVersion()
-
{
-
ULONG major, minor, build;
-
BOOLEAN checkedBuild;
-
static vboxWinVersion_t s_WinVersion = UNKNOWN_WINVERSION;
-
-
if (s_WinVersion != UNKNOWN_WINVERSION)
-
return s_WinVersion;
-
-
checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
-
LOG(("running on version %d.%d, build %d(checked=%d)", major, minor, build, (int)checkedBuild));
-
-
if(major == 6)
-
{
-
if (minor == 3)
-
s_WinVersion = WIN81;
-
else if (minor == 2)
-
s_WinVersion = WIN8;
-
else if (minor == 1)
-
s_WinVersion = WIN7;
-
else if (minor == 0)
-
s_WinVersion = WINVISTA; /* Or Windows Server 2008. */
-
}
-
else if (major == 5)
-
s_WinVersion = (minor>=1) ? WINXP:WIN2K;
-
else if (major == 4)
-
s_WinVersion = WINNT4;
-
else
-
WARN(("NT4 required!"));
-
return s_WinVersion;
-
}
阅读(5114) | 评论(0) | 转发(0) |