windows驱动获取系统版本信息 PsGetVersion RtlGetVersion

驱动获取系统版本信息有2个函数,分别是PsGetVersion RtlGetVersion
PsGetVersion在XP后已经不建议使用,

  1. /*Returns the windows version we're running on*/
  2. vboxWinVersion_t VBoxQueryWinVersion()
  3. {
  4.     ULONG major, minor, build;
  5.     BOOLEAN checkedBuild;
  6.     static vboxWinVersion_t s_WinVersion = UNKNOWN_WINVERSION;

  7.     if (s_WinVersion != UNKNOWN_WINVERSION)
  8.         return s_WinVersion;

  9.     checkedBuild = PsGetVersion(&major, &minor, &build, NULL);
  10.     LOG(("running on version %d.%d, build %d(checked=%d)", major, minor, build, (int)checkedBuild));

  11.     if(major == 6)
  12.     {
  13.         if (minor == 3)
  14.             s_WinVersion = WIN81;
  15.         else if (minor == 2)
  16.             s_WinVersion = WIN8;
  17.         else if (minor == 1)
  18.             s_WinVersion = WIN7;
  19.         else if (minor == 0)
  20.             s_WinVersion = WINVISTA; /* Or Windows Server 2008. */
  21.     }
  22.     else if (major == 5)
  23.         s_WinVersion = (minor>=1) ? WINXP:WIN2K;
  24.     else if (major == 4)
  25.         s_WinVersion = WINNT4;
  26.     else
  27.         WARN(("NT4 required!"));
  28.     return s_WinVersion;
  29. }



阅读(2200) | 评论(0) | 转发(0) |
0

上一篇:WINDOWS 驱动 PAGED_CODE

下一篇:AC_CHECK_LIBS autoconf

相关热门文章
  • LNK1123: 转换到 COFF 期间失...
  • WIN7访问共享:0x80070035 找不...
  • Delphi 2010下载+完美破解...
  • vs2010调试C++程序时提示 无...
  • VISIO,不规则封闭图形填充方...
  • linux dhcp peizhi roc
  • 关于Unix文件的软链接
  • 求教这个命令什么意思,我是新...
  • sed -e "/grep/d" 是什么意思...
  • 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~
评论热议

你可能感兴趣的:(windows驱动获取系统版本信息 PsGetVersion RtlGetVersion)