Debugging string comparison problem

Robert Shearman rob at codeweavers.com
Fri Jun 30 09:37:33 CDT 2006


Juan Lang wrote:

>>You missed the two collation_table lookups.
>>    
>>
>
>You're right, I did miss that.
>
>  
>
>>Note that on Windows using CompareString on L"\0001\0002" and 
>>L"\0002\0001" gives a result of CSTR_EQUAL, so I don't think the bug is 
>>in the collation tables.
>>    
>>
>
>Really?  For which locale, and which version of Windows?  For US English,
>on WinXP, it returns CSTR_LESS_THAN for me.  Here's a quick proggie:
>
>    LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
>     SORT_DEFAULT);
>    BSTR str1 = SysAllocStringLen(L"\0001\0002", 2);
>    BSTR str2 = SysAllocStringLen(L"\0002\0001", 2);
>  
>

I think the bug is here. Using SysAllocString instead of 
SysAllocStringLen I get:

VarBstrCmp returns 1
CompareStringW returns 2


>    printf("VarBstrCmp returns %ld\n", VarBstrCmp(str1, str2, lcid, 0));
>    printf("CompareStringW returns %d\n",
>     CompareStringW(lcid, 0, str1, 2, str2, 2));
>
>The output is:
>VarBstrCmp returns 0
>CompareStringW returns 1
>


-- 
Rob Shearman




More information about the wine-devel mailing list