kernel32: Fix lstrcmp(i)A/W to correct return values and document this behaviour

Dmitry Timoshkov dmitry at baikal.ru
Sat Oct 25 00:58:02 CDT 2003


"Rolf Kalbermatter" <rolf.kalbermatter at citeng.com> wrote:

>  int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
>  {
> -    int ret = CompareStringA(GetThreadLocale(), 0, str1, -1, str2, -1);
> -    if (ret) ret -= 2;
> -    return ret;
> +   int ret = CompareStringA(GetThreadLocale(), 0, str1, -1, str2, -1);
> +    if (!ret)
> +    {
> +      ret = CompareStringA(GetSystemDefaultLCID(), 0, str1, -1, str2, -1);
> +      if (!ret)
> +      {
> +        if (!str1)
> +          return (str2 ? -1 : 0);
> +        else if (!str2)
> +          return 1;
> +        return strcasecmp(str1, str2);
> +      }
> +    }
> +    return ret - 2;
>  }

Windows doesn't do anything of the above. A patch for CompareString I sent
recently to wine-devel has lots of tests and fixes for all the differences
we have found so far. It just needs a clean approach for unicode.org/windows
collation table differences merge to be included in Wine.

-- 
Dmitry.





More information about the wine-devel mailing list