delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/20/07:40:21

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFDE73858418
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1710934818;
bh=Eeft9BUMcPW31lKC5WTeOm4H3XmraC7KKT00kF2dhcQ=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=D4hezfVH2Y0fr30EGnLEHSOVWcFlnT4fcjYD3z53UeK+gCOeYDhXGtxCBK/eAL8y6
/IiXHXii05dNhqTHQS90QD76jUuAY6kpuCpuyf7C45+O1Gcc4yZFHMePwjKMYJxwrT
vfYe3BxaoAQW8/Tf0l51X1jHc/ad6JelUqhaX96o=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD8D73858CD1
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AD8D73858CD1
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710934797; cv=none;
b=j4KaxgZ/c32P1RznoeeQyuJWPiju5GABbMCvyvcernbktuv15AlvDkHvl3DjfGt/3BMy2XAj/NZHQVHeFmxuMmQpAjgcUL41AAINWGmMcnuuS7Yf42PcjhfNyNQ55Yv+013nyqDTObdbeyVi8Xw20+s5VHfr9YtJvF2ODOQmW/I=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1710934797; c=relaxed/simple;
bh=U1zAaS0itedKuDl+29BsW5FRXyDqzs89zWAAO83Yp+E=;
h=Subject:To:From:Message-ID:Date:MIME-Version;
b=LXbAH3Gm+7KBPbO8AYIxa7SJ89DDp5rMw082fReAaU9MxsVNR3m1HeijAAO6beKBsfGsTksKZeB4EKW4/P3AsPHJ3tgPCYwXfnGZ4YHWhw3Bj7KK/+UACweBPRg+vwAW8Xgro1uyhTItEUTiuwz88lUx9UvUaN54uQap7uV0F1g=
ARC-Authentication-Results: i=1; server2.sourceware.org
Subject: Re: GetVersionEx() depreciated, what should be used instead for
Windows 7/8/10?
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>
<Zfm7ZqZBdMBaoEOM AT calimero DOT vinschen DOT de>
Message-ID: <0d8daf74-2861-8b08-b47c-28cf5d3b991f@t-online.de>
Date: Wed, 20 Mar 2024 12:39:46 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
SeaMonkey/2.53.16
MIME-Version: 1.0
In-Reply-To: <Zfm7ZqZBdMBaoEOM@calimero.vinschen.de>
X-TOI-EXPURGATEID: 150726::1710934788-877FD968-3F15E044/0/0 CLEAN NORMAL
X-TOI-MSGID: 8180fd73-1132-427d-81fd-01cddb7c4999
X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM,
KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,
SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
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: Christian Franke via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Christian Franke <Christian DOT Franke AT t-online DOT de>
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 42KBeK071100520

Corinna Vinschen via Cygwin wrote:
> 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.

Could not reproduce the latter on Win10. I tested with recent Win10 and 
Win11 and also found a Win10 1511 (and Slackware 1.1.2, Win3.1, OS/2, 
...) in my VM image museum.

Regardless of the exe manifest, RtlGetVersion and RtlGetNtVersionNumbers 
return the correct versions:
10.0.22621 (Win11 22H2)
10.0.19045 (Win10 22H2)
10.0.10586 (Win10 1511)

Without a manifest, GetVersionEx returns:
6.2.9200 (Win8)

-- 
Regards,
Christian


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019