On Saturday 10 October 2026 15:15:03 LIU Hao wrote: > 在 2026-10-10 15:02, Pali Rohár 写道: > > On Saturday 10 October 2026 10:49:58 LIU Hao wrote: > > > 在 2026-10-9 18:16, Pali Rohár 写道: > > > > Probably not. But it shows that this inline function > > > > IsWindowsVersionOrGreater() cannot be used on older WinNT versions which > > > > sounds stupid, something which should return BOOL whether os system > > > > version is greater than or not, cause crashing of the whole process. > > > > It would not say it changes API, it just allows to execute this function > > > > also on older WinNT versions. I think that for such "version check" > > > > inline function, this can be a useful change not only for tests. > > > > > > `IsWindowsVersionOrGreater()` is documented to be available since Vista, > > > so > > > if you are targeting pre-Vista you should not call this function. > > > > > > > > > [1] > > > https://learn.microsoft.com/en-us/windows/win32/api/versionhelpers/nf-versionhelpers-iswindowsversionorgreater > > > > Then this function is totally useless as it always returns TRUE. > > ... ? > > The testcase calls `IsWindowsVistaOrGreater()` which is an inline wrapper > for `IsWindowsVersionOrGreater()`, which is documented as since Vista, but > that's completely fake information: It's an inline wrapper since Windows 8.1 > SDK for `VerifyVersionInfoW()` which is since Windows 2000. However no > inline helpers for Windows 2000 for any service packs exist, neither for 9x.
So for me it looks like this _implementation_ and _documentation_ of function is even worse. If the documentation is saying completely fake information then for me it really looks like the function is totally useless. From the function name and what it could do, for me the purpose of the function looks like to be runtime detection if running on older or newer windows, and allow application to correctly run on the older version by calling the fallback path. The importance is that this function is provided directly by the mingw-w64 (as inline) and not by MS. So that is why I originally thought that it makes sense to fix the function to be able to call it on any Windows system and to make it correctly return TRUE/FALSE, so application can decide what to do. Not to crash application at the startup. Function IsWindowsVersionOrGreater() which should detect if application is running on Windows Vista or higher, and per-documentation it requires Windows Vista, such function is really useless. Because it cannot be used for its purpose. So, does it make sense to fix this function to be useful, so it does not crash the application when called on older system? Or let it is is? > So even with erroneous documentation in mind, it still requires 2000. The > conclusion is the same: If the test has to run on 9x, it must not call > `IsWindowsVistaOrGreater()`. > > > -- > Best regards, > LIU Hao _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
