Re: WCMD not working anymore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Sylvain Petreolle" <spetreolle@yahoo.fr> wrote:

> With the command "DIR" entered we have :
> ...
> 0009:Call kernel32.CompareStringA(00000400,00001001,40792654
> "DIR",00000003,4057bcd3 "DIR",ffffffff) ret=405769b9
> 0009:Ret  kernel32.CompareStringA() retval=00000001 ret=405769b9
> ....
> 
> where the return code should be 2 (CSTR_EQUAL)

Thanks for the report. Here is the patch. I've added a test case
for that bug as well.

Changelog:
    Dmitry Timoshkov <dmitry@codeweavers.com>
    Exit ealier from LCMapStringA in the case of LCMAP_SORTKEY.
    Don't rely on computing string length by MultiByteToWideChar
    in CompareStringA, do it manually.

-- 
Dmitry.
diff -u cvs/hq/wine/dlls/kernel/locale.c wine/dlls/kernel/locale.c
--- cvs/hq/wine/dlls/kernel/locale.c	Sat Jun 28 14:30:49 2003
+++ wine/dlls/kernel/locale.c	Wed Jul  2 21:29:56 2003
@@ -1154,6 +1154,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD
             goto map_string_exit;
         }
         ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
+        goto map_string_exit;
     }
 
     if (flags & SORT_STRINGSORT)
@@ -1224,6 +1225,9 @@ INT WINAPI CompareStringA(LCID lcid, DWO
         SetLastError(ERROR_INVALID_PARAMETER);
         return 0;
     }
+
+    if (len1 < 0) len1 = strlen(str1);
+    if (len2 < 0) len2 = strlen(str2);
 
     GetLocaleInfoW(lcid, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
                    (WCHAR *)&locale_cp, (sizeof(locale_cp)/sizeof(WCHAR)));
diff -u cvs/hq/wine/dlls/kernel/tests/locale.c wine/dlls/kernel/tests/locale.c
--- cvs/hq/wine/dlls/kernel/tests/locale.c	Tue Jul  1 16:17:51 2003
+++ wine/dlls/kernel/tests/locale.c	Wed Jul  2 21:29:56 2003
@@ -719,6 +719,10 @@ char buffer1[BUFFER_SIZE], buffer2[BUFFE
 
 	ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, 0);
 	ok (ret == 3, "CompareStringA (st1=%s str2=%s) expected result=3, got %d", buffer1, buffer2, ret);
+
+	strcpy(buffer1, "Salut"); strcpy(buffer2, "saLuT");
+	ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, 5, buffer2, -1);
+	ok (ret == 2, "CompareStringA (st1=%s str2=%s) expected result=2, got %d", buffer1, buffer2, ret);
 }
 
 void test_LCMapStringA(void)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux