diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-03-09 23:10:17 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-09 23:10:17 +0100 |
commit | 48511f3d3847c35352d09cded56e25f0c1b22bc9 (patch) | |
tree | 1d87a108e94c24b6c8adf381fedfd6d7afc900b3 | |
parent | 264b5e137e20d0a8062497f8555759eb8bf8cc02 (diff) | |
download | cygnal-48511f3d3847c35352d09cded56e25f0c1b22bc9.tar.gz cygnal-48511f3d3847c35352d09cded56e25f0c1b22bc9.tar.bz2 cygnal-48511f3d3847c35352d09cded56e25f0c1b22bc9.zip |
Overwite potentially faked kernel version with correct values
* ntdll.h (RtlGetNtVersionNumbers): Declare.
* wincap.cc (wincapc::init): Overwrite kernel version info
returned by RtlGetVersion with correct info returnd by
RtlGetNtVersionNumbers. Add comment.
Originally, using RtlGetVersion instead of GetVersionEx was supposed to
fix the fact that GetVersionInfo returns the wrong kernel version if the
executable has been built with an old manifest (or none at all), starting
with Windows 8.1. Either this never really worked as desired and our
testing was flawed, or this has been changed again with Windows 10, so
that RtlGetVersion does the kernel faking twist as well. Since we're
only reading the value in the first process in a process tree. the entire
process tree is running with a wrong OS version information in that case.
Fortunately, the (undocumented) RtlGetNtVersionNumbers function is not
affected by this nonsense, so we simply override the OS version info
fields with the correct values now.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/ntdll.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/wincap.cc | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 5cc7c46f7..2792112b5 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -1452,6 +1452,7 @@ extern "C" PACL *, PBOOLEAN); NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *, PBOOLEAN); + NTSTATUS NTAPI RtlGetNtVersionNumbers (LPDWORD, LPDWORD, LPDWORD); NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *, PBOOLEAN); NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW); diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index c7c9f2e37..313d7f986 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -276,6 +276,11 @@ wincapc::init () GetSystemInfo (&system_info); version.dwOSVersionInfoSize = sizeof (RTL_OSVERSIONINFOEXW); RtlGetVersion (&version); + /* Overwrite unreliable kernel version with correct values returned by + RtlGetNtVersionNumbers. See git log of this change for a description. */ + RtlGetNtVersionNumbers (&version.dwMajorVersion, + &version.dwMinorVersion, + &version.dwBuildNumber); switch (version.dwMajorVersion) { |