https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0569bbd4a7883a8aba936c9f658ffe80c2a51eb1

commit 0569bbd4a7883a8aba936c9f658ffe80c2a51eb1
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Tue Mar 28 21:09:27 2023 +0900
Commit:     GitHub <[email protected]>
CommitDate: Tue Mar 28 21:09:27 2023 +0900

    [KERNEL32] LCMapString: Sync to Wine a little (#5203)
    
    Preparation for LCMAP_FULLWIDTH and LCMAP_HALFWIDTH support.
    Slightly synchronize lang.c to locale.c in Wine's dlls/kernelbase.
    CORE-11700
---
 dll/win32/kernel32/winnls/string/lang.c | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/dll/win32/kernel32/winnls/string/lang.c 
b/dll/win32/kernel32/winnls/string/lang.c
index a22eacf8cff..a3fa2af9d75 100644
--- a/dll/win32/kernel32/winnls/string/lang.c
+++ b/dll/win32/kernel32/winnls/string/lang.c
@@ -1872,7 +1872,7 @@ BOOL WINAPI GetStringTypeExA( LCID locale, DWORD type, 
LPCSTR src, INT count, LP
  * Map characters in a locale sensitive string.
  *
  * PARAMS
- *  name     [I] Locale name for the conversion.
+ *  locale   [I] Locale name for the conversion.
  *  flags    [I] Flags controlling the mapping (LCMAP_ constants from 
"winnls.h")
  *  src      [I] String to map
  *  srclen   [I] Length of src in chars, or -1 if src is NUL terminated
@@ -1886,17 +1886,17 @@ BOOL WINAPI GetStringTypeExA( LCID locale, DWORD type, 
LPCSTR src, INT count, LP
  *  Success: The length of the mapped string in dst, including the NUL 
terminator.
  *  Failure: 0. Use GetLastError() to determine the cause.
  */
-INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, 
LPWSTR dst, INT dstlen,
-                         LPNLSVERSIONINFO version, LPVOID reserved, LPARAM 
lparam)
+INT WINAPI LCMapStringEx(LPCWSTR locale, DWORD flags, LPCWSTR src, INT srclen, 
LPWSTR dst, INT dstlen,
+                         LPNLSVERSIONINFO version, LPVOID reserved, LPARAM 
handle)
 {
     LPWSTR dst_ptr;
 
     if (version) FIXME("unsupported version structure %p\n", version);
     if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
-    if (lparam)
+    if (handle)
     {
         static int once;
-        if (!once++) FIXME("unsupported lparam %lx\n", lparam);
+        if (!once++) FIXME("unsupported lparam %Ix\n", handle);
     }
 
     if (!src || !srclen || dstlen < 0)
@@ -1905,6 +1905,19 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, 
LPCWSTR src, INT srclen, LPW
         return 0;
     }
 
+    if (srclen < 0) srclen = lstrlenW(src) + 1;
+
+    TRACE( "(%s,0x%08lx,%s,%d,%p,%d)\n",
+           debugstr_w(locale), flags, debugstr_wn(src, srclen), srclen, dst, 
dstlen );
+
+    flags &= ~LOCALE_USE_CP_ACP;
+
+    if (src == dst && (flags & ~(LCMAP_LOWERCASE | LCMAP_UPPERCASE)))
+    {
+        SetLastError(ERROR_INVALID_FLAGS);
+        return 0;
+    }
+
     /* mutually exclusive flags */
     if ((flags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | 
LCMAP_UPPERCASE) ||
         (flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | 
LCMAP_KATAKANA) ||
@@ -1928,9 +1941,6 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, 
LPCWSTR src, INT srclen, LPW
 
         if (srclen < 0) srclen = strlenW(src);
 
-        TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
-              debugstr_w(name), flags, debugstr_wn(src, srclen), srclen, dst, 
dstlen);
-
         ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
         if (ret == 0)
             SetLastError(ERROR_INSUFFICIENT_BUFFER);
@@ -1946,11 +1956,6 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, 
LPCWSTR src, INT srclen, LPW
         return 0;
     }
 
-    if (srclen < 0) srclen = strlenW(src) + 1;
-
-    TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
-          debugstr_w(name), flags, debugstr_wn(src, srclen), srclen, dst, 
dstlen);
-
     if (!dst) /* return required string length */
     {
         INT len;
@@ -1993,11 +1998,6 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, 
LPCWSTR src, INT srclen, LPW
     }
     else
     {
-        if (src == dst)
-        {
-            SetLastError(ERROR_INVALID_FLAGS);
-            return 0;
-        }
         for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
         {
             WCHAR wch = *src;

Reply via email to