delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 2DC1D3858C98 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1710865279; | |
bh=a2xXUg7cy3dn5IfG6NWYmr2DKpLSBkbSUPNMGiWeu4g=; | |
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=LxCuHOHWBlh+ONZSZKxuNhIYavow3LI3XUsZ0Kq1htMG12Clg6I0GdxvfMF0RZ4xV | |
dO6o4FhUOLDPbJWwGupKKI83+DvSqBgLtwpZ2r8vQA34ZCDFdXv9bRMtXRE8fRuuk8 | |
Hk2B05aTjHa+QoGYfQ2rnpfemzLyY2XP4eBI4X+s= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 0B0DB3858D1E |
Date: | Tue, 19 Mar 2024 17:20:54 +0100 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: GetVersionEx() depreciated, what should be used instead for |
Windows 7/8/10? | |
Message-ID: | <Zfm7ZqZBdMBaoEOM@calimero.vinschen.de> |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <CALXu0UdrjFfhrBmBPNYepvMJ3hL7CPf1n6HEowxZgOxwdoy1TA AT mail DOT gmail DOT com> |
<b47b7092-716a-c626-a14d-e5847bc86926 AT t-online DOT de> | |
<CANV9t=S2BJ2d-_zNm3ZgVeerQ+ZEONQ4fjN1MXc6JVp+Gvrxsg AT mail DOT gmail DOT com> | |
<CALwydEs5ZTYqSxfZOp_hWobWQxFEeLGio8WoUCwTAM2eaph_sA AT mail DOT gmail DOT com> | |
<CANV9t=QHLHyv_jvvrCREpyrEX=JqmTdQvnmfUXbSKuvMrhHn9A AT mail DOT gmail DOT com> | |
MIME-Version: | 1.0 |
In-Reply-To: | <CANV9t=QHLHyv_jvvrCREpyrEX=JqmTdQvnmfUXbSKuvMrhHn9A@mail.gmail.com> |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | cygwin AT cygwin DOT com |
Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 42JGLKqf798753 |
On Mar 19 09:18, Bill Stewart via Cygwin wrote: > On Tue, Mar 19, 2024 at 9:01 AM Richard Campbell wrote: > > On Tue, Mar 19, 2024 at 9:04 AM Bill Stewart via Cygwin <cygwin AT cygwin DOT com> > > wrote: > > > > > Can you please clarify the circumstances under which the RtlGetVersion > > > function "may not return the correct values"? > > > > "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." > > > > https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=48511f3d3847c35352d09cded56e25f0c1b22bc9 > > > > Interesting. I have not yet been able to find a scenario where the > RtlGetVersion function gets "manifested" like GetVersionEx. > > I wrote a small Win32 console utility for displaying and testing OS > information (requires Windows Vista/Server 2008 or later): > > https://github.com/Bill-Stewart/osinfo > > It uses RtlGetVersion, and this function works correctly for me in all > current Windows versions (Windows 10, Server 2016, Windows 11, Server 2019, > Server 2022, etc.). > > I'm not sure of the exact scenario that led to the "RtlGetVersion is > subject to manifesting" conclusion, but I can't reproduce it. You have to create an application with an application manifest not supporting your OS. For Cygwin apps, this occured when you built, say, an executable under Windows 8.1 before Windows 10 support was added to the Cygwin toolchain: the manifest linked to the Cygwin executable didn't yet contain a GUID entry for Windows 10 support. In this case, RtlGetVersion returns an OS version 6.3 even when running under the 10.0 kernel. This behaviour exists back 'til Windows Vista. Fortunately Microsoft didn't change the required manifest GUID entry since the introduction of Windows 10. Even Windows 11 is still using the same GUID. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |