mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[KERNEL32]
* Sync LCMapString{A,W} with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=64896
This commit is contained in:
parent
c094a9b51f
commit
1994661271
1 changed files with 43 additions and 13 deletions
|
@ -1386,17 +1386,35 @@ BOOL WINAPI GetStringTypeExA( LCID locale, DWORD type, LPCSTR src, INT count, LP
|
|||
return GetStringTypeA(locale, type, src, count, chartype);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* LCMapStringW (KERNEL32.@)
|
||||
* LCMapStringEx (KERNEL32.@)
|
||||
*
|
||||
* See LCMapStringA.
|
||||
* Map characters in a locale sensitive string.
|
||||
*
|
||||
* PARAMS
|
||||
* name [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
|
||||
* dst [O] Destination for mapped string
|
||||
* dstlen [I] Length of dst in characters
|
||||
* version [I] reserved, must be NULL
|
||||
* reserved [I] reserved, must be NULL
|
||||
* lparam [I] reserved, must be 0
|
||||
*
|
||||
* RETURNS
|
||||
* Success: The length of the mapped string in dst, including the NUL terminator.
|
||||
* Failure: 0. Use GetLastError() to determine the cause.
|
||||
*/
|
||||
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
||||
LPWSTR dst, INT dstlen)
|
||||
INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen,
|
||||
LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
|
||||
{
|
||||
LPWSTR dst_ptr;
|
||||
|
||||
if (version) FIXME("unsupported version structure %p\n", version);
|
||||
if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
|
||||
if (lparam) FIXME("unsupported lparam %lx\n", lparam);
|
||||
|
||||
if (!src || !srclen || dstlen < 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -1415,8 +1433,6 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
|||
|
||||
if (!dstlen) dst = NULL;
|
||||
|
||||
lcid = ConvertDefaultLocale(lcid);
|
||||
|
||||
if (flags & LCMAP_SORTKEY)
|
||||
{
|
||||
INT ret;
|
||||
|
@ -1428,8 +1444,8 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
|||
|
||||
if (srclen < 0) srclen = strlenW(src);
|
||||
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
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)
|
||||
|
@ -1448,8 +1464,8 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
|||
|
||||
if (srclen < 0) srclen = strlenW(src) + 1;
|
||||
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
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 */
|
||||
{
|
||||
|
@ -1517,6 +1533,20 @@ INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
|||
return dst_ptr - dst;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* LCMapStringW (KERNEL32.@)
|
||||
*
|
||||
* See LCMapStringA.
|
||||
*/
|
||||
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
|
||||
LPWSTR dst, INT dstlen)
|
||||
{
|
||||
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
|
||||
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
|
||||
|
||||
return LCMapStringEx(NULL, flags, src, srclen, dst, dstlen, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* LCMapStringA (KERNEL32.@)
|
||||
*
|
||||
|
@ -1586,7 +1616,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
|
|||
goto map_string_exit;
|
||||
}
|
||||
|
||||
dstlenW = LCMapStringW(lcid, flags, srcW, srclenW, NULL, 0);
|
||||
dstlenW = LCMapStringEx(NULL, flags, srcW, srclenW, NULL, 0, NULL, NULL, 0);
|
||||
if (!dstlenW)
|
||||
goto map_string_exit;
|
||||
|
||||
|
@ -1597,7 +1627,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
|
|||
goto map_string_exit;
|
||||
}
|
||||
|
||||
LCMapStringW(lcid, flags, srcW, srclenW, dstW, dstlenW);
|
||||
LCMapStringEx(NULL, flags, srcW, srclenW, dstW, dstlenW, NULL, NULL, 0);
|
||||
ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, dstW);
|
||||
|
||||
|
|
Loading…
Reference in a new issue