Commit 4b0f1163 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Load the locale.nls file at startup.

parent f1611958
......@@ -4129,6 +4129,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
RtlInitAnsiString( &func_name, "CtrlRoutine" );
LdrGetProcedureAddress( kernel32_handle, &func_name, 0, (void **)&pCtrlRoutine );
locale_init();
actctx_init();
if (wm->ldr.Flags & LDR_COR_ILONLY)
status = fixup_imports_ilonly( wm, NULL, entry );
......
......@@ -100,9 +100,12 @@ struct norm_table
/* WORD[] composition character sequences */
};
static const WCHAR *locale_strings;
static NLSTABLEINFO nls_info;
static struct norm_table *norm_tables[16];
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 )
{
......@@ -235,6 +238,36 @@ invalid:
}
void locale_init(void)
{
LARGE_INTEGER unused;
LCID system_lcid;
NTSTATUS status;
struct
{
UINT ctypes;
UINT unknown1;
UINT unknown2;
UINT unknown3;
UINT locales;
UINT charmaps;
UINT geoids;
UINT scripts;
} *header;
status = RtlGetLocaleFileMappingAddress( (void **)&header, &system_lcid, &unused );
if (status)
{
ERR( "locale init failed %x\n", status );
return;
}
locale_table = (const NLS_LOCALE_HEADER *)((char *)header + header->locales);
lcids_index = (const NLS_LOCALE_LCID_INDEX *)((char *)locale_table + locale_table->lcids_offset);
lcnames_index = (const NLS_LOCALE_LCNAME_INDEX *)((char *)locale_table + locale_table->lcnames_offset);
locale_strings = (const WCHAR *)((char *)locale_table + locale_table->strings_offset);
}
static BYTE rol( BYTE val, BYTE count )
{
return (val << count) | (val >> (8 - count));
......
......@@ -66,6 +66,7 @@ extern const char *debugstr_exception_code( DWORD code ) DECLSPEC_HIDDEN;
extern void version_init(void) DECLSPEC_HIDDEN;
extern void debug_init(void) DECLSPEC_HIDDEN;
extern void actctx_init(void) DECLSPEC_HIDDEN;
extern void locale_init(void) DECLSPEC_HIDDEN;
extern void init_user_process_params(void) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment