kernelbase: Reimplement LocaleNameToLCID() using the locale.nls data.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-03-24 16:52:42 +01:00
parent 17c353a3bb
commit e74b0dc880
1 changed files with 8 additions and 3 deletions

View File

@ -5596,10 +5596,15 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringW( LCID lcid, DWORD flags, const WCHAR *
LCID WINAPI DECLSPEC_HOTPATCH LocaleNameToLCID( const WCHAR *name, DWORD flags ) LCID WINAPI DECLSPEC_HOTPATCH LocaleNameToLCID( const WCHAR *name, DWORD flags )
{ {
LCID lcid; LCID lcid;
const NLS_LOCALE_DATA *locale = get_locale_by_name( name, &lcid );
if (!name) return GetUserDefaultLCID(); if (!locale)
if (!set_ntstatus( RtlLocaleNameToLcid( name, &lcid, 2 ))) return 0; {
if (!(flags & LOCALE_ALLOW_NEUTRAL_NAMES)) lcid = ConvertDefaultLocale( lcid ); SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if (!(flags & LOCALE_ALLOW_NEUTRAL_NAMES) && !locale->inotneutral)
lcid = locale->idefaultlanguage;
return lcid; return lcid;
} }