delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/22/18:14:30

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D7143858C35
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1711145668;
bh=NNUpUiheK2dpD0iv0ShubEX3jlz2CGdpG60E+NhQ2fU=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=VR7H0qxU6QPMbw+8vKhMqap8ZahqE2wcSPkqK/jRfq5SrlOWwlYIGoMBGTjW8UzmY
T/HQccpZST6yxUCM5ANDBWxM7JA3SCB/S1KFxcs2H/dk1QCuUneoN34izJMH45DiUT
TMVl8380Oxs8daS6w+ZluTAVErrflDrZa0uoiOWc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB1DD3858D1E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EB1DD3858D1E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711145642; cv=none;
b=A5Wgz03+ReKdX9MOK39Iwdy5GsLLJq/PaFCK6ZBBgw3F7YSkM3LuL3SeUd0TYQ2Ki4d9xG40FZBhtu1jE+JiQYHUlco7/BhiDHtL2JXLaC8hYCVQ+ySioFYvv3S/TJYz8dO3K9u/xh6vXljIH+J4s+js1DbqNEKjmQF1IqlyzXc=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1711145642; c=relaxed/simple;
bh=RJhTo+JHuA4j2b7ZFM7ysSD+V7h+VpYjuEPGbhweh6s=;
h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
b=INpmxdYCgeuFZbSolDs7sC4zzvYByPA0ypfdrjeFqu2Leug+NL6zKK8+JuT9eRBgieKWVg040Ft/3OM3sY6QNk1SuQXiTtfcTURgSjyB5oM39xHxEr8hvuKGDTyECq+afzBy1qWEMc4LSReZ5FXquwoZ3BJU3QMSNWJ2trVkvSs=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1711145638; bh=sro+cv8TUELFI5zaeDK9L6jthnuIokrb6GU2+GEdrXP=;
h=X-Sonic-MF:Date:Subject:To:From:From:Subject;
b=b3R4Fien45t8xSsoYeiTVdT9Nfc5uiwDb4aD0N4012CNXoe4cqhR3DxtRdBHGHU6QVmsRQriJ2Jo+JdiavRrFhxzIigfh+hdhaEZEPrJQSuSXchgMOnXm2m/dxdddop8gshio1FyQAuhzZAzAqERTMnIcsF7O9lUuHak4DaxAqoeND31ukvVwgweSza9WPepuLfzAxyTUl09acwi5gzCTOtVZkjHnCw0d2THqaXCfxEehWEazpostrCa2+6lxqp/B6UQopuEntExAKrXT2P62zQFQpLdtoyNQzBDuf8JQIjo1IFLY8y5S4Vmn/JTwTV5KuItOb9asUDepwJFAg2JzA==
X-YMail-OSG: KBjBSicVM1mvV0vQpS7m3UZAeXCzoQK4.I78IVQQgM5Agaw_Uq9YaGBFXVeXScv
fEIv7mD8YVhrNt.SsQ5NxDTMT4ytxDgjFeTYenVRLJHnkmo5z3feT0cEA87kw15JYqVIyYTELGe_
ty1xh4YN0tl5C_91vy1oZq1z6jZJBMY3fHdFxlxM6ZMu6e8JC713fSamUmKcXsf0kVrlkBUzRliQ
QgcLY7somqire5JYgkiiABpRIyqrvGl0f1sj7WqXEichbzWlH174XxvymCgq7c.cJQd54GiC0YCM
HXlGahgFZ2HVt9.rI.UsK0D6sNbAYwOZ3x4DrKrhewj_ebH_JoVI9FT2PYu0Hwln.ZjhRi2cW7Yo
nw_.RCY.XsS6E2XCD2qhjPtAGRJc4SCsOR4lfOPVBjT8CBGmUAp0ZlT.PyuPumalXslJLC3qG3CR
7OvAujI_pA9Zocgx4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tQlKZTmgzoo6s.OeCYE9.z2R2g1dnVsCEC0QfQ9j2K4g8R2VswCyrgzMi7Vl6fbOaxJRW7Kp
odW3m2ipGDWOzw0ce4gK1bjQYR7rw_g_qk5U.d2p22wjM541Y59rkULXu6HMNfVTZ3INRkzwcTMq
yUp_74SA5I4zit.2FaXROFfziOlx_Xd_nlmuL_M1UOcbFYtf1fpejd4ml_N0oxYJ70agvQb6zJrj
S_GsHsVjI04vQx5GLfaQsfw.PpZODK8ek93Bn8Fb_JEc.h8uYlGHnlmmt3d48HHTKZBdjn5dNMC9
O8IhwepFoIAeSrXGpfdo5RgtzCucCO8xb.iPjkRoVCLhGI9quJj0lplEX1n.x0.ZAmuL57BBM1xx
8g6uWvGRGiMIz7DiPmIXG0KUew.rJSXKVojkQznoKmB7edOEhDip0uem7WvLMhiejXt9nroUQOud
YWElFZwDre_d7rKstzwQroUX4Ebo2h_1hAYTm5ixqkuc3hMlKL4NSQ.gfkAnifWXoEy3bBFEXX99
2EOspAqmopRtqBuuF9C2vtC0uV3dMWCO7_Cj7AUC6xZ8vXsYZ0bRI990.1x00_oDL04VVAVoeaUW
sa8c4_uZLVT_Gr32RKMsURWS5qOPFdZ7KmxqOkTLSDZgEyngbU_mb71lGr_vt9pbVbGfq2KSFzBp
8s_huVbWsBr1mnPaJqqRDonTJyGWwv3H1V1adWLHp1rKf73pi2TkLPfxiHFyJRnTObw_CLefYwCx
2qjQIRgYwIadevQBvDcI.1vlVqIW7ARngAlPoN6lIoP6T8Sqc1Hz9QVpnbQ--
X-Sonic-MF: <raysatiro AT yahoo DOT com>
X-Sonic-ID: d68d4683-7297-4125-8a20-664b2cce0af6
Message-ID: <14f228c5-2ed6-4be6-b29d-b512d5b3a8cd@yahoo.com>
Date: Fri, 22 Mar 2024 18:13:47 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
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>
<0d8daf74-2861-8b08-b47c-28cf5d3b991f AT t-online DOT de>
<ZfszwBeYDxxApO9v AT calimero DOT vinschen DOT de>
<538aa134-b079-12ec-76fe-5a60fc77c3ee AT t-online DOT de>
<ZfxPIbU5K_VgX5hZ AT calimero DOT vinschen DOT de>
Autocrypt: addr=raysatiro AT yahoo DOT com; keydata=
xjMEY1zaDhYJKwYBBAHaRw8BAQdAlo7qP5flkegNdjtqvQNlVBP+3P5c4/VR7dnCe+HWaXXN
IFJheSBTYXRpcm8gPHJheXNhdGlyb0B5YWhvby5jb20+wpkEExYKAEEWIQQzyO2861MiKV+F
dr4LkJJ14BcGgwUCY1zaDgIbAwUJB4TOAAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAK
CRALkJJ14BcGgxSmAQCXTehlpNnWT87QCNPPHOsG4dsYKvhn1VGZapKdf6D3FAEAnxI5uH75
aUaKWrg11fgscRE5/MUcZkngTwarD9xJMQnOOARjXNoyEgorBgEEAZdVAQUBAQdAaZyn1lpB
/HAQMMxmWrGZKkJslG4Xrpv5mmYBqnpavSoDAQgHwn4EGBYKACYWIQQzyO2861MiKV+Fdr4L
kJJ14BcGgwUCY1zaMgIbDAUJB4TOAAAKCRALkJJ14BcGgwolAP4u0T46AwRmXgFQGtjYfDba
HVcx3FqJWPYZElcewEAEuAD+KcaPjf8xhHBxVD5Qe+C92Xq73yxmWxrF3tih3anTXQU=
In-Reply-To: <ZfxPIbU5K_VgX5hZ@calimero.vinschen.de>
X-Mailer: WebService/1.1.22205
mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
TXREP 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-Content-Filtered-By: Mailman/MimeDel 2.1.30
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: Ray Satiro via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Ray Satiro <raysatiro AT yahoo 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>

On 3/21/2024 11:15 AM, Corinna Vinschen via Cygwin wrote:
> On Mar 21 09:58, Christian Franke via Cygwin wrote:
>> Corinna Vinschen via Cygwin wrote:
>>> On Mar 20 12:39, Christian Franke via Cygwin wrote:
>>>> Corinna Vinschen via Cygwin wrote:
>>>>> 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)
> I just gave it a try on W11. The results are even more funny than I
> anticipated:
>
> I created a simple application just calling GetVersionEx, RtlGetVersion
> and RtlGetNtVersionNumbers.
>
> Linked with our Cygwin default manifest claiming W10 compatibility, the
> result is the expected:
>
>    GetVersionEx          : 10.0.22631
>    RtlGetVersion         : 10.0.22631
>    RtlGetNtVersionNumbers: 10.0.22631
>
> The "Operating system context" in Task Manager is empty.
>
> Next I linked against a Windows 8.1 manifest:
>
>    GetVersionEx          : 6.3.9600
>    RtlGetVersion         : 10.0.22631
>    RtlGetNtVersionNumbers: 10.0.22631
>
> So GetVersionEx reports Windows 8.1, RtlGetVersion/ RtlGetNtVersionNumbers
> both report W10.  The "Operating system context" in Task Manager reports
>
>    "Windows 8.1"
>
> No surprise there.
>
> Next I linked against a Windows 7 manifest:
>
>    GetVersionEx          : 6.2.9200
>    RtlGetVersion         : 10.0.22631
>    RtlGetNtVersionNumbers: 10.0.22631
>
> So GetVersionEx reports Windows 8, not Windows 7.
>
> However, the "Operating system context" in Task Manager reports
>
>    "Windows 7"
>
> I also tried this with a Vista manifest:
>
>    GetVersionEx          : 6.2.9200
>    RtlGetVersion         : 10.0.22631
>    RtlGetNtVersionNumbers: 10.0.22631
>
>    "Windows Vista"
>
> So Task Manager reports the right context per the manifest, but
> GetVersionEx doesn't go below Windows 8.
>
> Same goes for Windows 10...
>
>    GetVersionEx          : 6.2.9200
>    RtlGetVersion         : 10.0.19045
>    RtlGetNtVersionNumbers: 10.0.19045
>
>    "Windows Vista"
>
> as well as for Windows 8.1:
>
>    GetVersionEx          : 6.2.9200
>    RtlGetVersion         : 6.3.9600
>    RtlGetNtVersionNumbers: 6.3.9600
>
>    "Windows Vista"
>
> So, yeah, with your observations especially on older W10 versions and
> with 8.1 doing the same thing, I guess we can safely drop the extra call
> to RtlGetNtVersionNumbers now.  After such a long time, I don't know
> on which version of Windows we observed the problem.
>
> For those interested in patch forensics, I searched the archives and
> came up with two mail threads referring to GetVersionEx and RtlGetVersion:
>
>    https://cygwin.com/pipermail/cygwin/2013-November/211795.html
>    https://cygwin.com/pipermail/cygwin/2014-June/215836.html
>
> Unfortunately I found*no*  thread talking about RtlGetNtVersionNumbers,
> so the only information we have now is the commit message of
>
>    https://cygwin.com/cgit/newlib-cygwin/commit/?id=48511f3d3847c


The code in that commit doesn't look right. RtlGetNtVersionNumbers is a 
void function and the third parameter may not be just the build number. 
The first two parameters are sort of known because the CRT used to use 
it to get the major and minor version but passed NULL for the third 
parameter.

typedef void (__stdcall *NTVERSION_INFO_FCN)(PDWORD, PDWORD, PDWORD);

I assume that it contains at least the build number and type (production 
or checked), according to a blog post discussing it [1].

Here's results from a test program [2] with manifest on Windows 11:

 >test-RtlGetNtVersionNumbers.exe
GetVersionExW: 10.0.22000
RtlGetVersion: 10.0.22000
RtlGetNtVersionNumbers: 10 major, 0 minor, 4026553840 unknown
LOWORD of unknown: 22000 (0x55f0)
HIWORD of unknown: 61440 (0xf000)


[1]: 
https://dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on
[2]: https://gist.github.com/jay/ae07fba61fe6853f5620eb142c66807b


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