Debugging string comparison problem
juan_lang at yahoo.com
Fri Jun 30 09:26:19 CDT 2006
> 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),
BSTR str1 = SysAllocStringLen(L"\0001\0002", 2);
BSTR str2 = SysAllocStringLen(L"\0002\0001", 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
More information about the wine-devel