https://bugs.winehq.org/show_bug.cgi?id=40972
Bug ID: 40972 Summary: RtlVerifyVersionInfo returns wrong results Product: Wine Version: 1.9.14 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: marcinwiaz@poczta.onet.pl Distribution: ---
Created attachment 55126 --> https://bugs.winehq.org/attachment.cgi?id=55126 Tiny test program - EXE and source
(Note: this a different problem than in Bug 36143)
Steps to reproduce:
1) Download and unpack Reproduce.exe, which is attached to this bug report 2) Configure Wine to emulate Windows 2003 (which has version number 5.2) for Reproduce.exe 3) Launch Reproduce.exe - you will see in the console window:
CurrentOS is: 5.2 RequestedOS is >= than: 5.19 CurrentOS is < than RequestedOS (which is WRONG!)
4) Run true Microsoft Windows 2003 Server 5) Launch Reproduce.exe - you will see in the console window:
CurrentOS is: 5.2 RequestedOS is >= than: 5.19 CurrentOS is >= than RequestedOS
Explanation: Minor version numbers should be treated similarly to digits after a decimal point - so when comparing software versions:
version 5.1 is < than version 5.2 version 5.11 is < than version 5.2 (note that 11 is > than 2 !) version 5.19 is < than version 5.2 (note that 19 is > than 2 !)
So when comparing for VER_MINORVERSION or VER_SERVICEPACKMINOR inside the "VerifyVersionInfo" API, Microsoft uses a lexical comparison - which works as:
lstrcmp(tostring(dwMinorVersion1),tostring(dwMinorVersion2)) or lstrcmp(tostring(wServicePackMinor1),tostring(wServicePackMinor2))
Please note, that it's still different than comparing real numbers, because:
5.20 = 5.2 but lstrcmp("5.20","5.2") != 0
So lstrcmp-like function must be used for VER_MINORVERSION and VER_SERVICEPACKMINOR checking inside the "RtlVerifyVersionInfo" function (which is called by the "VerifyVersionInfo" API in Wine) to be compatible with Microsoft Windows.
Possible fix: in "version.c" file, add a new "version_compare_values_lexical" function. It should be based on the original "version_compare_values" function, but should use "lstrcmp" calls instead of integer comparisons. This "version_compare_values_lexical" function should be called instead of "version_compare_values" when checking for VER_MINORVERSION and VER_SERVICEPACKMINOR inside the "RtlVerifyVersionInfo" function.
https://bugs.winehq.org/show_bug.cgi?id=40972
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase
https://bugs.winehq.org/show_bug.cgi?id=40972
Detlef Riekenberg wine.dev@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |wine.dev@web.de
https://bugs.winehq.org/show_bug.cgi?id=40972
--- Comment #1 from Detlef Riekenberg wine.dev@web.de --- The tests on Windows can be improved with the Version GUIDs
https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).a...
https://bugs.winehq.org/show_bug.cgi?id=40972
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #2 from Gijs Vermeulen gijsvrm@gmail.com --- Output of the reproducer is still the same, so seems to be still present with wine-6.9.
https://bugs.winehq.org/show_bug.cgi?id=40972
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
--- Comment #3 from Fabian Maurer dark.shadow4@web.de --- No change in wine-9.21