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) {