https://bugs.winehq.org/show_bug.cgi?id=49778
Bug ID: 49778 Summary: StrCmpLogicalW() incorrectly sorts numeric characters ('0'-'9') versus some symbols ('.' and others) Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: shlwapi Assignee: wine-bugs@winehq.org Reporter: nailer592899230@halestrom.net Distribution: ---
Created attachment 68088 --> https://bugs.winehq.org/attachment.cgi?id=68088 sclw_test.cpp
StrCmpLogicalW() returns different results on Wine versus Windows 10 (1909 x86_64) when used to compare numeric and symbol characters. '.' and '%' are known culprits.
This is a strcmp()-like function, used for "natural" sorting of file listings. See https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-strcmp...
=== Example ===
Attached is a short .cpp file that can be compiled in Visual Studio Community 2019. Alternatively a pre-compiled .exe is up at https://halestrom.net/misc/wine/sclw_test.exe (sha1sum 4a71d6f03912ad4e735cc703d71cbd014ffa40e4)
When run on Windows 1909: "Result of running StrCmpLogicalW() on 'always.dat' and 'always2.dat': -1" When run on Wine : "Result of running StrCmpLogicalW() on 'always.dat' and 'always2.dat': 1"
The failing comes from comparing the '2' and '.' characters.
=== Impacts ===
Range from mostly harmless (different file listing orders in GUIs and TUIs) to severe (using this sort order to imply precedence or versions of files, as is my case where I discovered this problem).
APB version 3.5.0.0 (a free total-conversion for the game C&C Renegade) is partially broken by this problem (cannot play online, old versions of game data used), but there is a chance a patch I'm working on for it might be accepted as a workaround. https://w3dhub.com/#/games-apb
=== Thoughts on fix ===
I don't believe an exact spec for the full behaviour for StrCmpLogicalW() exists. Rumours are the inter-symbol sorting rules have changed between Windows Versions too http://archives.miloush.net/michkap/archive/2006/10/01/778990.html
In the very least: the '.' symbol needs to be given priority over numerals. Numbers and file-extensions are very common.