GetVersionEx() depreciated, what should be used instead for Windows 7/8/10?
Christian Franke
Christian.Franke@t-online.de
Tue Mar 19 10:20:58 GMT 2024
Cedric Blancher via Cygwin wrote:
> How does cygwin uname -s work, i.e. how does it get the OS version,
> revision and build number ('10.0-19045')?
> I tried to replicate it via GetVersionEx(), but that is deprecated.
>
AFAICS, MS does not offer an official way to retrieve the actual Windows
version via the Win32 API layer. GetVersionEx() is unable to detect
Windows versions which are more recent than the compatibility level
advertised in the application manifest.
Cygwin uses the undocumented RtlGetNtVersionNumbers() from ntdll.dll
because even RtlGetVersion() may not return the correct values. See
function wincapc::init()
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/wincap.cc
--
Regards,
Christian
More information about the Cygwin
mailing list