From 04116e8dd6ae2357fdfcd1873e9bca05fc75f424 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sun, 24 Feb 2008 17:06:10 +0000 Subject: [PATCH] - Isolate the NLS-tables hack so that it's applied only when really needed (freeldr boot process always requires the hack, winldr boot process does not). svn path=/trunk/; revision=32469 --- reactos/ntoskrnl/ex/init.c | 44 ++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 4f5d43b9953..53ecffb5875 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -239,27 +239,33 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED); /* Copy the codepage data in its new location. */ - //RtlCopyMemory(ExpNlsTableBase, - // LoaderBlock->NlsData->AnsiCodePageData, - // ExpNlsTableSize); + if (NlsTablesEncountered == 1) + { + /* Ntldr-way boot process */ + RtlCopyMemory(ExpNlsTableBase, + LoaderBlock->NlsData->AnsiCodePageData, + ExpNlsTableSize); + } + else + { + /* + * In NT, the memory blocks are contiguous, but in ReactOS they aren't, + * so unless someone fixes FreeLdr, we'll have to use this icky hack. + */ + RtlCopyMemory(ExpNlsTableBase, + LoaderBlock->NlsData->AnsiCodePageData, + NlsTableSizes[0]); - /* - * In NT, the memory blocks are contiguous, but in ReactOS they aren't, - * so unless someone fixes FreeLdr, we'll have to use this icky hack. - */ - RtlCopyMemory(ExpNlsTableBase, - LoaderBlock->NlsData->AnsiCodePageData, - NlsTableSizes[0]); + RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0]), + LoaderBlock->NlsData->OemCodePageData, + NlsTableSizes[1]); - RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0]), - LoaderBlock->NlsData->OemCodePageData, - NlsTableSizes[1]); - - RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0] + - NlsTableSizes[1]), - LoaderBlock->NlsData->UnicodeCodePageData, - NlsTableSizes[2]); - /* End of Hack */ + RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0] + + NlsTableSizes[1]), + LoaderBlock->NlsData->UnicodeCodePageData, + NlsTableSizes[2]); + /* End of Hack */ + } /* Initialize and reset the NLS TAbles */ RtlInitNlsTables((PVOID)((ULONG_PTR)ExpNlsTableBase +