ntdll: Use RtlLcidToLocaleName() in the preferred UI language stub.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a2d44e89ea
commit
c3023a123e
|
@ -81,8 +81,6 @@ const WCHAR windows_dir[] = L"C:\\windows";
|
|||
/* system directory with trailing backslash */
|
||||
const WCHAR system_dir[] = L"C:\\windows\\system32\\";
|
||||
|
||||
HMODULE kernel32_handle = 0;
|
||||
|
||||
/* system search path */
|
||||
static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows";
|
||||
|
||||
|
@ -4117,17 +4115,16 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
|
|||
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
||||
NtTerminateProcess( GetCurrentProcess(), status );
|
||||
}
|
||||
kernel32_handle = kernel32->ldr.DllBase;
|
||||
node_kernel32 = kernel32->ldr.DdagNode;
|
||||
RtlInitAnsiString( &func_name, "BaseThreadInitThunk" );
|
||||
if ((status = LdrGetProcedureAddress( kernel32_handle, &func_name,
|
||||
if ((status = LdrGetProcedureAddress( kernel32->ldr.DllBase, &func_name,
|
||||
0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
|
||||
{
|
||||
MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %x\n", status );
|
||||
NtTerminateProcess( GetCurrentProcess(), status );
|
||||
}
|
||||
RtlInitAnsiString( &func_name, "CtrlRoutine" );
|
||||
LdrGetProcedureAddress( kernel32_handle, &func_name, 0, (void **)&pCtrlRoutine );
|
||||
LdrGetProcedureAddress( kernel32->ldr.DllBase, &func_name, 0, (void **)&pCtrlRoutine );
|
||||
|
||||
locale_init();
|
||||
actctx_init();
|
||||
|
|
|
@ -107,26 +107,6 @@ static const NLS_LOCALE_LCID_INDEX *lcids_index;
|
|||
static const NLS_LOCALE_LCNAME_INDEX *lcnames_index;
|
||||
static const NLS_LOCALE_HEADER *locale_table;
|
||||
|
||||
static NTSTATUS load_string( ULONG id, LANGID lang, WCHAR *buffer, ULONG len )
|
||||
{
|
||||
const IMAGE_RESOURCE_DATA_ENTRY *data;
|
||||
LDR_RESOURCE_INFO info;
|
||||
NTSTATUS status;
|
||||
WCHAR *p;
|
||||
int i;
|
||||
|
||||
info.Type = 6; /* RT_STRING */
|
||||
info.Name = (id >> 4) + 1;
|
||||
info.Language = lang;
|
||||
if ((status = LdrFindResource_U( kernel32_handle, &info, 3, &data ))) return status;
|
||||
p = (WCHAR *)((char *)kernel32_handle + data->OffsetToData);
|
||||
for (i = 0; i < (id & 0x0f); i++) p += *p + 1;
|
||||
if (*p >= len) return STATUS_BUFFER_TOO_SMALL;
|
||||
memcpy( buffer, p + 1, *p * sizeof(WCHAR) );
|
||||
buffer[*p] = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static DWORD mbtowc_size( const CPTABLEINFO *info, LPCSTR str, UINT len )
|
||||
{
|
||||
|
@ -625,9 +605,16 @@ static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG
|
|||
|
||||
FIXME("(0x%x %p %p %p) returning a dummy value (current locale)\n", flags, count, buffer, size);
|
||||
|
||||
status = load_string( (flags & MUI_LANGUAGE_ID) ? LOCALE_ILANGUAGE : LOCALE_SNAME,
|
||||
lang, name, ARRAY_SIZE(name) );
|
||||
if (status) return status;
|
||||
if (flags & MUI_LANGUAGE_ID) swprintf( name, ARRAY_SIZE(name), L"%04lx", lang );
|
||||
else
|
||||
{
|
||||
UNICODE_STRING str;
|
||||
|
||||
str.Buffer = name;
|
||||
str.MaximumLength = sizeof(name);
|
||||
status = RtlLcidToLocaleName( lang, &str, 0, FALSE );
|
||||
if (status) return status;
|
||||
}
|
||||
|
||||
len = wcslen( name ) + 2;
|
||||
name[len - 1] = 0;
|
||||
|
|
|
@ -80,7 +80,6 @@ extern void RELAY_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
|
|||
extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
|
||||
extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
|
||||
extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
|
||||
extern HMODULE kernel32_handle DECLSPEC_HIDDEN;
|
||||
|
||||
extern void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) DECLSPEC_HIDDEN;
|
||||
extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue