[Bug 34176] New: Kernel32:CompareStringW strange behavior ?

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Jul 31 11:59:27 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=34176

             Bug #: 34176
           Summary: Kernel32:CompareStringW strange behavior ?
           Product: Wine
           Version: 1.6
          Platform: x86-64
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: wine.manette at manette.be
    Classification: Unclassified


Created attachment 45460
  --> http://bugs.winehq.org/attachment.cgi?id=45460
Sorce and compiled executable for wineTest.exe + winedbg log.txt

Hi all, I'm running wine 1.6 (i386) under Debian 7.1 (x86_64).
When running a console program of mine (Delphi XE2 compiled under Windows
Vista) I'm observing an important behavior difference under wine than
nativevely.

I narrowed down the symptom to a string comparison of some sort.
Source file below is a code snippet to reproduce the problem (source is UTF-8,
Delphi is utf-8 / WideString, WideChar aware).

Here is the (correct/expected) result when program is run natively under
Windows Vista:

G:\__Project-2\Code\wineTest>wineTest
* TEST-001: TRUE
* TEST-002: TRUE
* TEST-003: TRUE
* TEST-004: TRUE TRUE
* TEST-005: TRUE TRUE
* TEST-003: TRUE TRUE

Here is the same program output when run from Wine:

root at Bilbo-100:~# wine wineTest.exe
Wine cannot find the ncurses library (libncurses.so.5).
fixme:thread:GetThreadUILanguage : stub, returning default language.
fixme:thread:GetThreadPreferredUILanguages 56, 0x33d8f8, (nil) 0x33d920
fixme:thread:GetThreadPreferredUILanguages 56, 0x33d8f8, (nil) 0x33d920
* TEST-001: TRUE
* TEST-002: TRUE
* TEST-003: TRUE
* TEST-004: TRUE FALSE
* TEST-005: TRUE FALSE
* TEST-003: TRUE FALSE

For what I understood the TStringList IndexOf method may use Windows API's
CompareStringW function (http://source.winehq.org/WineAPI/CompareStringW.html)

Is this a configuration problem (locale ?)
May this be a bug or implementation problem ?

I can provide the corrsponding binary wineTest.exe

//////////////////////////////////////////////////

Using winedbg I could crosscheck that CompareStringW for two different strings
result in equality (CSTR_LESS_THAN = 1, CSTR_EQUAL = 2, CSTR_GREATER_THAN = 3).
Maybe this is because of locale setting or flags setup ?

root at Bilbo-100:~# WINEDEBUG=+relay,+snoop wine wineTest.exe &> log.txt

root at Bilbo-100:~# grep CompareStringW log.txt
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"m\00b2",00000002,00449890 L"m\00b2",00000002) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"m\00b2",00000002,004498bc L"m2",00000002) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"m\00b3",00000002,004498f8 L"m\00b3",00000002) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"m\00b3",00000002,0044990c L"m3",00000002) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"\00e9\00e9\00e9",00000003,00449920 L"\00e9\00e9\00e9",00000003) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0
0009:Call KERNEL32.CompareStringW(00000400,00000001,00549cac
L"\00e9\00e9\00e9",00000003,00449934 L"eee",00000003) ret=004187d0
0009:Ret  KERNEL32.CompareStringW() retval=00000002 ret=004187d0


///////////////////////////////////////////////////

program wineTest;

{$APPTYPE CONSOLE}

Uses Classes;

var

    sl : TStringList;

begin

        Write(ErrOutput, '* TEST-001: ');
        if not('m²'='m2') then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

        Write(ErrOutput, '* TEST-002: ');
        if not('m³'='m3') then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

        Write(ErrOutput, '* TEST-003: ');
        if not('ééé'='eee') then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

        sl := TStringList.Create;

        Write(ErrOutput, '* TEST-004: ');
        sl.Clear;
        sl.Add('m²');
        if not(sl.IndexOf('m²')<0) then Write(ErrOutput, 'TRUE') else
Write(ErrOutput, 'FALSE');
        Write(ErrOutput, ' ');
        if sl.IndexOf('m2')<0 then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

        Write(ErrOutput, '* TEST-005: ');
        sl.Clear;
        sl.Add('m³');
        if not(sl.IndexOf('m³')<0) then Write(ErrOutput, 'TRUE') else
Write(ErrOutput, 'FALSE');
        Write(ErrOutput, ' ');
        if sl.IndexOf('m3')<0 then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

        Write(ErrOutput, '* TEST-003: ');
        sl.Clear;
        sl.Add('ééé');
        if not(sl.IndexOf('ééé')<0) then Write(ErrOutput, 'TRUE') else
Write(ErrOutput, 'FALSE');
        Write(ErrOutput, ' ');
        if sl.IndexOf('eee')<0 then Writeln(ErrOutput, 'TRUE') else
Writeln(ErrOutput, 'FALSE');

end.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the wine-bugs mailing list