问题一:Windows SDK 8.1版本中的VersionHelper.h文件当中没有IsWindows10ORGreater,所以当你用IsWindows8Point1ORGreater判断出版本信息是Windows8.1以上的版本后,你就无法区分它到底是Win8.1还是Win10.

问题二:使用GetVersionEx这个API配合结构体OSVERSIONINFOEX这个方法获取版本信息,那么Win8以上的系统不论是Win8.1还是Win10都会被判定为主版本号为6,次版本号为2(即Win8的版本号)。

参考:

http://blog.csdn.net/pjl1119/article/details/8556693

和MSDN相关API说明。

那么如何区分Win8.1和Win10?

使用如下未文档化API:

RtlGetNtVersionNumbers

参考:

http://blog.csdn.net/magictong/article/details/40753519

使用方法如下:

  1. int main()
  2. {
  3. HMODULE hm;
  4. if (hm = LoadLibrary("ntdll.dll"))
  5. {
  6. DWORD i = , j = , p = ;
  7. typedef void (WINAPI *getver)(DWORD*, DWORD*, DWORD*);
  8. getver gv;
  9. gv = (getver)GetProcAddress(hm, "RtlGetNtVersionNumbers");
  10. if (gv)
  11. {
  12. gv(&i, &j, &p);
  13. printf("Major is %d\nMinor is %d\nOptional Build is %d\n", i, j, p);
  14.  
  15. }
  16.  
  17. FreeLibrary(hm);
  18. }
  19. system("pause");
  20. return ;
  21. }

Windows7下返回结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAABHCAIAAACsxL2GAAAKeklEQVR4nO2d+VcayRbH+T8Stm5oGlAzOXPmzJu/6kUniSaKCCqI+5bE5GXejArKIqgxmmhEm6VB3LLMvP/n/cAidFffrkZElPs5dTxN9a3vvVV8qw4BJTrf9JvhiYUh/8zhcUbMn2bzpxmxkBZP0tl8Sqllcootm09l8+mqlhFPyq2QzRWyxZ+klqk0sZART9Kllk+Lxbw5ISMep8WjVPYolT0SMkkhkzxOHx6lvlS1g6RwkBQOksf7h8f7h0f7h0efvxRb8vOX5KeD5KeDw739w939w93Ph7vFi/3kx/3kx4Pkxy9HO8WWPN4Rjj+kUzti6kMu9SGX2s6ltnOpLfF4K5VMJL8k9j/H9z4ldj8lPn5K7Ow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3xXt6+fdPsndYlLao9mvd5R0hkgbmnmwooRPbF0k2NesqO1JPii181Jk8wAa3M4B4NuBZgDwAc0A4AN5zQD4gGYA8AHNAODjNzVz1adlH6H8lBIQ9loA4Wb5bfkDzVxNlh+sd7obm2bIo9u7ywaaAfWkmmHJjJPyuzFKAZ6WPOiuD5HqZ+Z2JvU2St5U3jgtmZGedUvVCxb7ydP+JP3KNZ+LGRSyHbl/Mu1REkOVfs7m6Sn+cEeKmtl7gSUqxQlhcmHKjvdBTyfXzxD/jmwSL7acixQIsbx44brc9oM8rid2iu4l52tpdrT+0doTmUs0o/WzqBnNH+6JHJvJI/jWSbT/WadKHXYoWZfmO6v5abKrZEz2SaPU6/LaT2wlBpVdykZydgrzgEszWr65klOr9NstEe4BsIgqvXxhspfyOoWyKnNIwk5RrnuJZg5DbLAGEkKdh3JdPvu8dfKmonMpO1TUIzXVTNYfbogQm0UYvzSJI1OOMr0ZfMLo0v36y27Z2izhELNkTplnlPDt4vPM7anSjClmPbC20epncj4xO9g0maICOkQWSkgq7AfZ38m2cimKOsBodnL9k1k+mTWj1h1VrWHmyd5+WOv9zdRpRgnntDoQf32IXj+jasazaIoPnRuX3klKOty7KItMFeqIjFaU0hTaz4X+yXxfdLtsJ46wyZyb6TeNq2jmpaAecKM8gNZrz9uvbX+U39WM6dbthe2DT/GLmlnDglZzQGv74LP8omYA+FOgGQB8QDMA+IBmAPABzQDgA5oBwAc0A4CL//P3BEhbfI75AAAAAElFTkSuQmCC" alt="" />

这样我们即使不是用WindowsSDK10,也能区分开Win8.1和Win10了。

其他方法:

http://blog.csdn.net/k1988/article/details/47614529

其中这篇文章分析了很多方法:

http://blog.csdn.net/magictong/article/details/40753519

利用未文档化API:RtlGetNtVersionNumbers 获取系统版本号的更多相关文章

  1. 利用未文档化API:RtlAdjustPrivilege 提权实现自动关机

    这里主要是利用NTDLL.dll中未文档化的API: RtlAdjustPrivilege 来实现提权.自动关机的功能. RtlAdjustPrivilege定义如下: NTSTATUS RtlAdj ...

  2. NTDLL未文档化函数RtlGetNtVersionNumbers获取操作系统版本

    作为新手,对获取操作系统版本号好奇过,因为曾经假象过一个场景:自己的程序在windows xp环境下编译,在windows 2003, windows 7,windows 8是否需要提权或者兼容处理, ...

  3. 使用 Swagger 文档化和定义 RESTful API

    大部分 Web 应用程序都支持 RESTful API,但不同于 SOAP API——REST API 依赖于 HTTP 方法,缺少与 Web 服务描述语言(Web Services Descript ...

  4. 使用.NET 6开发TodoList应用(27)——实现API的Swagger文档化

    系列导航及源代码 使用.NET 6开发TodoList应用文章索引 需求 在日常开发中,我们需要给前端提供文档化的API接口定义,甚至需要模拟架设一个fake服务用来调试接口字段.或者对于后端开发人员 ...

  5. 使用Xcode HeaderDoc和Doxygen文档化你的Objective-C和Swift代码

    在一个应用的整个开发过程中涉及到了无数的步骤.其中一些是应用的说明,图片的创作,应用的实现,和实现过后的测试阶段.写代码可能组成了这个过程的绝大部分,因为正是它给了应用生命,但是这样还不够,与它同等重 ...

  6. Effective Java 第三版——74. 文档化每个方法抛出的所有异常

    Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所 ...

  7. sphinx-python文档化

    概述 下文讲述使用sphinx自动生成reStructuredText python API文档的简单过程. 配置流程 安装依赖 $ pip install sphinx blurb python-d ...

  8. 在线文档转换API word,excel,ppt等在线文件转pdf、png

    在线文档转换API提供word,excel,ppt等在线文件转pdf.png等,文档:https://www.juhe.cn/docs/api/id/259 接口地址:http://v.juhe.cn ...

  9. tbls ci 友好的数据库文档化工具

    tbls 是用golang 编写的数据库文档化工具,当前支持的数据库有pg.mysql.bigquery 此工具同时提供了变更对比.lint 校验,生成是markdown格式的 简单使用 安装 mac ...

随机推荐

  1. 20_学生选课数据库SQL语句练习题

    一.            设有一数据库,包括四个表:学生表(Student).课程表(Course).成绩表(Score)以及教师信息表(Teacher).四个表的结构分别如表1-1的表(一)~表( ...

  2. ELK 基本搭建

    ELK是一套日志分析系统: 开发人员不能登录线上服务器查看详细日志各个系统都有日志,日志数据分散难以查找日志数据量大,查询速度慢,或者数据不够实时一个调用会设计多个系统,难以在这些系统的日志中快速定位 ...

  3. forEach用法介绍

    array.forEach(callback[, thisArg]) forEach() 方法让数组的每一项都执行一次给定的函数. callback在数组每一项上执行的函数,接收三个参数: curre ...

  4. POJ 2387 Til the Cows Come Home(dij+邻接矩阵)

    ( ̄▽ ̄)" //dijkstra算法: //这题建邻接矩阵的时候有坑(先读入边后读入点),还有重边: #include<iostream> #include<cstdio ...

  5. 3.请问配置JDK时环境变量path和JAVA_HOME的作用是什么?

    1.PATH环境变量.作用是指定命令搜索路径,在i命令行下面执行命令如javac编译java程序时,它会到PATH变量所指定的路径中查找看是否能找到相应的命令程序.需要把jdk安装目录下的bin目录增 ...

  6. Let'sencrypt认证的网站Https配置

    推荐使用这个脚本,具体说明里面都有 https://github.com/xdtianyu/scripts/tree/master/le-dns 它是通过调用dns服务商的api更新txt记录实现,无 ...

  7. Oracle 游标及存储过程实例

    /*********实例一*********/ create or replace procedure users_procedure is cursor users_cursor is select ...

  8. git clean -fdx

    http://stackoverflow.com/questions/5807137/git-how-to-revert-uncommitted-changes-including-files-and ...

  9. List<T>转换为ObservableCollection<T>

    ObservableCollection能通知他变化了也正是因为它实现了INotifyPropertyChanged接口, 在wpf项目中经常会遇到把List<T>转换为Observabl ...

  10. 【经典dp】 poj 3671

    开一个dp[30010][3]的数组 其中dp[i][j]表示把第i个数改成j最少要花多少次 那么状态转移方程就列出来了: 令a=1 j!=a[i] 0 j==a[i] 那么dp[i][1]=dp[i ...