Implemented NLS section (not usable yet) and updated NLS functions.

svn path=/trunk/; revision=4685
This commit is contained in:
Eric Kohl 2003-05-15 11:07:51 +00:00
parent 54aa3104d4
commit 556a38e0c0
14 changed files with 449 additions and 362 deletions

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.7 2003/04/26 23:13:27 hyperion Exp $ /* $Id: rtl.h,v 1.8 2003/05/15 11:01:02 ekohl Exp $
* *
*/ */
@ -921,7 +921,7 @@ RtlCreateUnicodeStringFromAsciiz (OUT PUNICODE_STRING Destination,
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlCustomCPToUnicodeN ( RtlCustomCPToUnicodeN (
PRTL_NLS_DATA NlsData, IN PCPTABLEINFO CustomCP,
PWCHAR UnicodeString, PWCHAR UnicodeString,
ULONG UnicodeSize, ULONG UnicodeSize,
PULONG ResultSize, PULONG ResultSize,
@ -1181,7 +1181,7 @@ RtlImageDirectoryEntryToData (
PIMAGE_NT_HEADERS PIMAGE_NT_HEADERS
STDCALL STDCALL
RtlImageNtHeader ( RtlImageNtHeader (
PVOID BaseAddress IN PVOID BaseAddress
); );
PIMAGE_SECTION_HEADER PIMAGE_SECTION_HEADER
@ -1208,6 +1208,22 @@ RtlInitAnsiString (
PCSZ SourceString PCSZ SourceString
); );
VOID
STDCALL
RtlInitCodePageTable (
IN PUSHORT TableBase,
OUT PCPTABLEINFO CodePageTable
);
VOID
STDCALL
RtlInitNlsTables (
OUT PNLSTABLEINFO NlsTable,
IN PUSHORT CaseTableBase,
IN PUSHORT OemTableBase,
IN PUSHORT AnsiTableBase
);
VOID VOID
STDCALL STDCALL
RtlInitString ( RtlInitString (
@ -1282,15 +1298,21 @@ RtlIsGenericTableEmpty (
IN PRTL_GENERIC_TABLE Table IN PRTL_GENERIC_TABLE Table
); );
BOOLEAN STDCALL BOOLEAN
RtlIsNameLegalDOS8Dot3(IN PUNICODE_STRING UnicodeName, STDCALL
IN PANSI_STRING AnsiName, RtlIsNameLegalDOS8Dot3 (
OUT PBOOLEAN SpacesFound); IN PUNICODE_STRING UnicodeName,
IN PANSI_STRING AnsiName,
OUT PBOOLEAN SpacesFound
);
ULONG STDCALL ULONG
RtlIsTextUnicode (PVOID Buffer, STDCALL
ULONG Length, RtlIsTextUnicode (
ULONG *Flags); PVOID Buffer,
ULONG Length,
ULONG *Flags
);
LARGE_INTEGER LARGE_INTEGER
STDCALL STDCALL
@ -1626,12 +1648,21 @@ RtlReAllocateHeap (
DWORD size DWORD size
); );
NTSTATUS STDCALL NTSTATUS
RtlReserveChunk(IN USHORT CompressionFormat, STDCALL
IN OUT PUCHAR *CompressedBuffer, RtlReserveChunk (
IN PUCHAR EndOfCompressedBufferPlus1, IN USHORT CompressionFormat,
OUT PUCHAR *ChunkBuffer, IN OUT PUCHAR *CompressedBuffer,
IN ULONG ChunkSize); IN PUCHAR EndOfCompressedBufferPlus1,
OUT PUCHAR *ChunkBuffer,
IN ULONG ChunkSize
);
VOID
STDCALL
RtlResetRtlTranslations (
IN PNLSTABLEINFO NlsTable
);
/* /*
* VOID * VOID
@ -1835,7 +1866,7 @@ RtlUnicodeStringToOemString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUnicodeToCustomCPN ( RtlUnicodeToCustomCPN (
PRTL_NLS_DATA NlsData, IN PCPTABLEINFO CustomCP,
PCHAR MbString, PCHAR MbString,
ULONG MbSize, ULONG MbSize,
PULONG ResultSize, PULONG ResultSize,
@ -1927,7 +1958,7 @@ RtlUpcaseUnicodeStringToOemString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUpcaseUnicodeToCustomCPN ( RtlUpcaseUnicodeToCustomCPN (
PRTL_NLS_DATA NlsData, IN PCPTABLEINFO CustomCP,
PCHAR MbString, PCHAR MbString,
ULONG MbSize, ULONG MbSize,
PULONG ResultSize, PULONG ResultSize,

View file

@ -1,4 +1,4 @@
/* $Id: rtltypes.h,v 1.5 2003/04/26 23:13:27 hyperion Exp $ /* $Id: rtltypes.h,v 1.6 2003/05/15 11:01:02 ekohl Exp $
* *
*/ */
@ -153,36 +153,32 @@ typedef struct _RTL_ATOM_TABLE
LIST_ENTRY Slot[0]; LIST_ENTRY Slot[0];
} RTL_ATOM_TABLE, *PRTL_ATOM_TABLE; } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
typedef struct _LB_RANGE
{
UCHAR upper;
UCHAR lower;
} LB_RANGE;
typedef struct _RTL_NLS_DATA #define MAXIMUM_LEADBYTES 12
{
USHORT CodePage;
USHORT MaxCharacterSize; // SBCS = 1, DBCS = 2
WCHAR DefaultCharacter;
WCHAR char1;
WCHAR char2;
WCHAR char3;
USHORT DbcsFlag;
LB_RANGE LeadByteRange[6];
USHORT reserved;
PWCHAR MultiByteToUnicode;
PCHAR UnicodeToMultiByte;
PWCHAR DosMultiByteToUnicode;
PCHAR DbcsTags;
} RTL_NLS_DATA, *PRTL_NLS_DATA;
typedef struct _RTL_NLS_TABLE typedef struct _CPTABLEINFO
{ {
RTL_NLS_DATA OemInfo; USHORT CodePage;
RTL_NLS_DATA AnsiInfo; USHORT MaximumCharacterSize; // SBCS = 1, DBCS = 2
PWCHAR UpcaseTable; USHORT DefaultCharacter;
PWCHAR DowncaseTable; USHORT UniDefaultChar;
} RTL_NLS_TABLE, *PRTL_NLS_TABLE; USHORT TransDefaultChar;
USHORT TransUniDefaultChar;
USHORT DBCSCodePage;
UCHAR LeadByte[MAXIMUM_LEADBYTES];
PUSHORT MultiByteTable;
PVOID WideCharTable;
PUSHORT DBCSRanges;
PUSHORT DBCSOffsets;
} CPTABLEINFO, *PCPTABLEINFO;
typedef struct _NLSTABLEINFO
{
CPTABLEINFO OemTableInfo;
CPTABLEINFO AnsiTableInfo;
PUSHORT UpperCaseTable;
PUSHORT LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO;
typedef struct _RTL_GENERIC_TABLE typedef struct _RTL_GENERIC_TABLE

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.98 2003/04/29 02:16:59 hyperion Exp $ ; $Id: ntdll.def,v 1.99 2003/05/15 11:02:03 ekohl Exp $
; ;
; ReactOS Operating System ; ReactOS Operating System
; ;
@ -441,8 +441,8 @@ RtlImageRvaToSection@12
RtlImageRvaToVa@16 RtlImageRvaToVa@16
RtlImpersonateSelf@4 RtlImpersonateSelf@4
RtlInitAnsiString@8 RtlInitAnsiString@8
;RtlInitCodePageTable RtlInitCodePageTable@8
;RtlInitNlsTables RtlInitNlsTables@16
RtlInitString@8 RtlInitString@8
RtlInitUnicodeString@8 RtlInitUnicodeString@8
;RtlInitializeAtomPackage ;RtlInitializeAtomPackage
@ -526,7 +526,7 @@ RtlReAllocateHeap@16
RtlReleasePebLock@0 RtlReleasePebLock@0
RtlReleaseResource@4 RtlReleaseResource@4
;RtlRemoteCall ;RtlRemoteCall
;RtlResetRtlTranslations RtlResetRtlTranslations@4
RtlRunDecodeUnicodeString@8 RtlRunDecodeUnicodeString@8
RtlRunEncodeUnicodeString@8 RtlRunEncodeUnicodeString@8
RtlSecondsSince1970ToTime@8 RtlSecondsSince1970ToTime@8

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.87 2003/04/29 02:16:59 hyperion Exp $ ; $Id: ntdll.edf,v 1.88 2003/05/15 11:02:03 ekohl Exp $
; ;
; ReactOS Operating System ; ReactOS Operating System
; ;
@ -52,7 +52,7 @@ LdrQueryProcessModuleInformation=LdrQueryProcessModuleInformation@12
LdrShutdownProcess=LdrShutdownProcess@0 LdrShutdownProcess=LdrShutdownProcess@0
LdrShutdownThread=LdrShutdownThread@0 LdrShutdownThread=LdrShutdownThread@0
LdrUnloadDll=LdrUnloadDll@4 LdrUnloadDll=LdrUnloadDll@4
;LdrVerifyImageMatchesChecksum@16 ;LdrVerifyImageMatchesChecksum=LdrVerifyImageMatchesChecksum@16
NlsAnsiCodePage DATA NlsAnsiCodePage DATA
NlsMbCodePageTag DATA NlsMbCodePageTag DATA
NlsMbOemCodePageTag DATA NlsMbOemCodePageTag DATA
@ -440,8 +440,8 @@ RtlImageRvaToSection=RtlImageRvaToSection@12
RtlImageRvaToVa=RtlImageRvaToVa@16 RtlImageRvaToVa=RtlImageRvaToVa@16
RtlImpersonateSelf=RtlImpersonateSelf@4 RtlImpersonateSelf=RtlImpersonateSelf@4
RtlInitAnsiString=RtlInitAnsiString@8 RtlInitAnsiString=RtlInitAnsiString@8
;RtlInitCodePageTable RtlInitCodePageTable=RtlInitCodePageTable@8
;RtlInitNlsTables RtlInitNlsTables=RtlInitNlsTables@16
RtlInitString=RtlInitString@8 RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8 RtlInitUnicodeString=RtlInitUnicodeString@8
;RtlInitializeAtomPackage ;RtlInitializeAtomPackage
@ -525,7 +525,7 @@ RtlReAllocateHeap=RtlReAllocateHeap@16
RtlReleasePebLock=RtlReleasePebLock@0 RtlReleasePebLock=RtlReleasePebLock@0
RtlReleaseResource=RtlReleaseResource@4 RtlReleaseResource=RtlReleaseResource@4
;RtlRemoteCall ;RtlRemoteCall
;RtlResetRtlTranslations RtlResetRtlTranslations=RtlResetRtlTranslations@4
RtlRunDecodeUnicodeString=RtlRunDecodeUnicodeString@8 RtlRunDecodeUnicodeString=RtlRunDecodeUnicodeString@8
RtlRunEncodeUnicodeString=RtlRunEncodeUnicodeString@8 RtlRunEncodeUnicodeString=RtlRunEncodeUnicodeString@8
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8 RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8

View file

@ -1,4 +1,4 @@
/* $Id: exception.c,v 1.13 2003/04/07 23:10:08 gvg Exp $ /* $Id: exception.c,v 1.14 2003/05/15 11:03:20 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -70,6 +70,6 @@ RtlBaseProcessStart(PTHREAD_START_ROUTINE StartAddress,
ExitStatus = (NTSTATUS) (StartAddress)(Parameter); ExitStatus = (NTSTATUS) (StartAddress)(Parameter);
NtTerminateProcess(NtCurrentProcess(), ExitStatus); NtTerminateProcess(NtCurrentProcess(), ExitStatus);
} }
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: image.c,v 1.4 2002/09/08 10:23:05 chorns Exp $ /* $Id: image.c,v 1.5 2003/05/15 11:03:21 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -20,22 +20,23 @@
PIMAGE_NT_HEADERS STDCALL PIMAGE_NT_HEADERS STDCALL
RtlImageNtHeader (IN PVOID BaseAddress) RtlImageNtHeader (IN PVOID BaseAddress)
{ {
PIMAGE_NT_HEADERS NtHeader; PIMAGE_NT_HEADERS NtHeader;
PIMAGE_DOS_HEADER DosHeader = (PIMAGE_DOS_HEADER)BaseAddress; PIMAGE_DOS_HEADER DosHeader = (PIMAGE_DOS_HEADER)BaseAddress;
if (DosHeader && DosHeader->e_magic != IMAGE_DOS_SIGNATURE) if (DosHeader && DosHeader->e_magic != IMAGE_DOS_SIGNATURE)
{ {
DPRINT1("DosHeader->e_magic %x\n", DosHeader->e_magic); DPRINT1("DosHeader->e_magic %x\n", DosHeader->e_magic);
DPRINT1("NtHeader %x\n", (BaseAddress + DosHeader->e_lfanew)); DPRINT1("NtHeader %x\n", (BaseAddress + DosHeader->e_lfanew));
} }
// if (DosHeader && DosHeader->e_magic == IMAGE_DOS_SIGNATURE) if (DosHeader && DosHeader->e_magic == IMAGE_DOS_SIGNATURE)
// { {
NtHeader = (PIMAGE_NT_HEADERS)(BaseAddress + DosHeader->e_lfanew); NtHeader = (PIMAGE_NT_HEADERS)(BaseAddress + DosHeader->e_lfanew);
if (NtHeader->Signature == IMAGE_NT_SIGNATURE) if (NtHeader->Signature == IMAGE_NT_SIGNATURE)
return NtHeader; return NtHeader;
// } }
return NULL;
return NULL;
} }

View file

@ -1,4 +1,4 @@
/* $Id: nls.c,v 1.7 2003/03/16 13:07:02 chorns Exp $ /* $Id: nls.c,v 1.8 2003/05/15 11:03:21 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -59,68 +59,76 @@ PWCHAR NlsUnicodeLowercaseTable = NULL;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/*
* Missing functions:
* RtlInitCodePageTable
* RtlInitNlsTables
* RtlResetRtlTranslations
*/
/* /*
* RtlConsoleMultiByteToUnicodeN@24 * RtlConsoleMultiByteToUnicodeN@24
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlCustomCPToUnicodeN ( RtlCustomCPToUnicodeN(IN PCPTABLEINFO CustomCP,
PRTL_NLS_DATA NlsData, PWCHAR UnicodeString,
PWCHAR UnicodeString, ULONG UnicodeSize,
ULONG UnicodeSize, PULONG ResultSize,
PULONG ResultSize, PCHAR CustomString,
PCHAR CustomString, ULONG CustomSize)
ULONG CustomSize)
{ {
ULONG Size = 0; ULONG Size = 0;
ULONG i; ULONG i;
if (NlsData->DbcsFlag == FALSE) if (CustomCP->DBCSCodePage == 0)
{
/* single-byte code page */
if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
Size = UnicodeSize / sizeof(WCHAR);
else
Size = CustomSize;
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
{ {
/* single-byte code page */ *UnicodeString = CustomCP->MultiByteTable[(int)*CustomString];
if (CustomSize > (UnicodeSize / sizeof(WCHAR))) UnicodeString++;
Size = UnicodeSize / sizeof(WCHAR); CustomString++;
else
Size = CustomSize;
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
{
*UnicodeString = NlsData->MultiByteToUnicode[(int)*CustomString];
UnicodeString++;
CustomString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
} }
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
VOID VOID STDCALL
STDCALL RtlGetDefaultCodePage(PUSHORT AnsiCodePage,
RtlGetDefaultCodePage ( PUSHORT OemCodePage)
PUSHORT AnsiCodePage,
PUSHORT OemCodePage
)
{ {
*AnsiCodePage = NlsAnsiCodePage; *AnsiCodePage = NlsAnsiCodePage;
*OemCodePage = NlsOemCodePage; *OemCodePage = NlsOemCodePage;
}
VOID STDCALL
RtlInitCodePageTable(IN PUSHORT TableBase,
OUT PCPTABLEINFO CodePageTable)
{
UNIMPLEMENTED;
}
VOID STDCALL
RtlInitNlsTables(OUT PNLSTABLEINFO NlsTable,
IN PUSHORT CaseTableBase,
IN PUSHORT OemTableBase,
IN PUSHORT AnsiTableBase)
{
UNIMPLEMENTED;
} }
@ -240,46 +248,50 @@ RtlOemToUnicodeN (
} }
NTSTATUS VOID STDCALL
STDCALL RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
RtlUnicodeToCustomCPN (
PRTL_NLS_DATA NlsData,
PCHAR CustomString,
ULONG CustomSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{ {
ULONG Size = 0; UNIMPLEMENTED;
ULONG i; }
if (NlsData->DbcsFlag == 0)
NTSTATUS STDCALL
RtlUnicodeToCustomCPN(IN PCPTABLEINFO CustomCP,
PCHAR CustomString,
ULONG CustomSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize)
{
ULONG Size = 0;
ULONG i;
if (CustomCP->DBCSCodePage == 0)
{
/* single-byte code page */
if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
Size = CustomSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{ {
/* single-byte code page */ *CustomString = ((PCHAR)CustomCP->WideCharTable)[*UnicodeString];
if (UnicodeSize > (CustomSize * sizeof(WCHAR))) CustomString++;
Size = CustomSize; UnicodeString++;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
*CustomString = NlsData->UnicodeToMultiByte[*UnicodeString];
CustomString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
} }
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -400,51 +412,48 @@ RtlUnicodeToOemN (
} }
NTSTATUS NTSTATUS STDCALL
STDCALL RtlUpcaseUnicodeToCustomCPN(IN PCPTABLEINFO CustomCP,
RtlUpcaseUnicodeToCustomCPN ( PCHAR CustomString,
PRTL_NLS_DATA NlsData, ULONG CustomSize,
PCHAR CustomString, PULONG ResultSize,
ULONG CustomSize, PWCHAR UnicodeString,
PULONG ResultSize, ULONG UnicodeSize)
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{ {
WCHAR UpcaseChar; WCHAR UpcaseChar;
ULONG Size = 0; ULONG Size = 0;
ULONG i; ULONG i;
if (NlsData->DbcsFlag == 0) if (CustomCP->DBCSCodePage == 0)
{
/* single-byte code page */
if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
Size = CustomSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{ {
/* single-byte code page */ *CustomString = ((PCHAR)CustomCP->WideCharTable)[*UnicodeString];
if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
Size = CustomSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
*CustomString = NlsData->UnicodeToMultiByte[*UnicodeString];
#if 0 #if 0
UpcaseChar = NlsUnicodeUpcaseTable[*UnicodeString]; UpcaseChar = NlsUnicodeUpcaseTable[*UnicodeString];
*CustomString = NlsData->UnicodeToMultiByte[UpcaseChar]; *CustomString = NlsData->UnicodeToMultiByte[UpcaseChar];
#endif #endif
CustomString++; CustomString++;
UnicodeString++; UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
} }
}
else
{
/* multi-byte code page */
/* FIXME */
assert(FALSE);
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }

View file

@ -0,0 +1,33 @@
/*
* ReactOS kernel
* Copyright (C) 2003 Eric Kohl <ekohl@rz-online.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_NLS_H
#define __NTOSKRNL_INCLUDE_INTERNAL_NLS_H
extern PSECTION_OBJECT NlsSection;
VOID RtlpInitNlsTables(VOID);
NTSTATUS RtlpInitNlsSection(VOID);
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_NLS_H */
/* EOF */

View file

@ -50,15 +50,6 @@ BOOLEAN CmImportSystemHive(PCHAR ChunkBase, ULONG ChunkSize);
BOOLEAN CmImportHardwareHive(PCHAR ChunkBase, ULONG ChunkSize); BOOLEAN CmImportHardwareHive(PCHAR ChunkBase, ULONG ChunkSize);
VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock); VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
VOID RtlpInitNlsTables(VOID);
NTSTATUS RtlpInitNlsSections(ULONG Mod1Start,
ULONG Mod1End,
ULONG Mod2Start,
ULONG Mod2End,
ULONG Mod3Start,
ULONG Mod3End);
#endif /* __ASM__ */ #endif /* __ASM__ */
/* /*

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: main.c,v 1.153 2003/05/13 21:28:26 chorns Exp $ /* $Id: main.c,v 1.154 2003/05/15 11:05:20 ekohl Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -47,6 +47,7 @@
#include <internal/trap.h> #include <internal/trap.h>
#include "../dbg/kdb.h" #include "../dbg/kdb.h"
#include <internal/registry.h> #include <internal/registry.h>
#include <internal/nls.h>
#include <reactos/bugcodes.h> #include <reactos/bugcodes.h>
#ifdef HALDBG #ifdef HALDBG
@ -333,7 +334,7 @@ ExpInitializeExecutive(VOID)
(PADDRESS_RANGE)&KeMemoryMap, (PADDRESS_RANGE)&KeMemoryMap,
KeMemoryMapRangeCount); KeMemoryMapRangeCount);
/* create default nls tables */ /* Create default nls tables */
RtlpInitNlsTables(); RtlpInitNlsTables();
/* /*
@ -425,6 +426,10 @@ ExpInitializeExecutive(VOID)
CmInitializeRegistry(); CmInitializeRegistry();
NtInit(); NtInit();
MmInit3(); MmInit3();
/* Create the nls section */
RtlpInitNlsSection();
CcInit(); CcInit();
KdInit2(); KdInit2();
FsRtlpInitFileLockingImplementation(); FsRtlpInitFileLockingImplementation();
@ -444,42 +449,6 @@ ExpInitializeExecutive(VOID)
KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart); KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart);
} }
/* Pass 1: load nls files */
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
name = (PCHAR)KeLoaderModules[i].String;
if (RtlpCheckFileNameExtension(name, ".nls"))
{
ULONG Mod2Start = 0;
ULONG Mod2End = 0;
ULONG Mod3Start = 0;
ULONG Mod3End = 0;
name = (PCHAR)KeLoaderModules[i+1].String;
if (RtlpCheckFileNameExtension(name, ".nls"))
{
Mod2Start = (ULONG)KeLoaderModules[i+1].ModStart;
Mod2End = (ULONG)KeLoaderModules[i+1].ModEnd;
name = (PCHAR)KeLoaderModules[i+2].String;
if (RtlpCheckFileNameExtension(name, ".nls"))
{
Mod3Start = (ULONG)KeLoaderModules[i+2].ModStart;
Mod3End = (ULONG)KeLoaderModules[i+2].ModEnd;
}
}
/* Initialize nls sections */
RtlpInitNlsSections((ULONG)KeLoaderModules[i].ModStart,
(ULONG)KeLoaderModules[i].ModEnd,
Mod2Start,
Mod2End,
Mod3Start,
Mod3End);
break;
}
}
/* Pass 2: import system hive registry chunk */ /* Pass 2: import system hive registry chunk */
SetupBoot = TRUE; SetupBoot = TRUE;
for (i = 1; i < KeLoaderBlock.ModsCount; i++) for (i = 1; i < KeLoaderBlock.ModsCount; i++)
@ -629,6 +598,7 @@ ExpInitializeExecutive(VOID)
{ {
KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0); KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
} }
/* /*
* Crash the system if the initial process terminates within 5 seconds. * Crash the system if the initial process terminates within 5 seconds.
*/ */

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.151 2003/04/25 18:36:10 fireball Exp $ ; $Id: ntoskrnl.def,v 1.152 2003/05/15 11:07:51 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -758,7 +758,7 @@ RtlGetGroupSecurityDescriptor@12
RtlGetOwnerSecurityDescriptor@12 RtlGetOwnerSecurityDescriptor@12
RtlImageNtHeader@4 RtlImageNtHeader@4
RtlInitAnsiString@8 RtlInitAnsiString@8
;RtlInitCodePageTable RtlInitCodePageTable@8
RtlInitString@8 RtlInitString@8
RtlInitUnicodeString@8 RtlInitUnicodeString@8
RtlInitializeBitMap@12 RtlInitializeBitMap@12

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.137 2003/04/25 18:36:10 fireball Exp $ ; $Id: ntoskrnl.edf,v 1.138 2003/05/15 11:07:51 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -757,7 +757,7 @@ RtlGetGroupSecurityDescriptor=RtlGetGroupSecurityDescriptor@12
RtlGetOwnerSecurityDescriptor=RtlGetOwnerSecurityDescriptor@12 RtlGetOwnerSecurityDescriptor=RtlGetOwnerSecurityDescriptor@12
RtlImageNtHeader=RtlImageNtHeader@4 RtlImageNtHeader=RtlImageNtHeader@4
RtlInitAnsiString=RtlInitAnsiString@8 RtlInitAnsiString=RtlInitAnsiString@8
;RtlInitCodePageTable RtlInitCodePageTable=RtlInitCodePageTable@8
RtlInitString=RtlInitString@8 RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8 RtlInitUnicodeString=RtlInitUnicodeString@8
RtlInitializeBitMap=RtlInitializeBitMap@12 RtlInitializeBitMap=RtlInitializeBitMap@12

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.97 2003/04/26 23:13:33 hyperion Exp $ /* $Id: process.c,v 1.98 2003/05/15 11:06:24 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -28,10 +28,12 @@
#include <roscfg.h> #include <roscfg.h>
#include <internal/se.h> #include <internal/se.h>
#include <internal/kd.h> #include <internal/kd.h>
#include <internal/nls.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS ******************************************************************/ /* GLOBALS ******************************************************************/
PEPROCESS EXPORTED PsInitialSystemProcess = NULL; PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
@ -54,10 +56,10 @@ static ULONG PiProcessNotifyRoutineCount = 0;
static PCREATE_PROCESS_NOTIFY_ROUTINE static PCREATE_PROCESS_NOTIFY_ROUTINE
PiProcessNotifyRoutine[MAX_PROCESS_NOTIFY_ROUTINE_COUNT]; PiProcessNotifyRoutine[MAX_PROCESS_NOTIFY_ROUTINE_COUNT];
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PEPROCESS
PEPROCESS
PsGetNextProcess(PEPROCESS OldProcess) PsGetNextProcess(PEPROCESS OldProcess)
{ {
KIRQL oldIrql; KIRQL oldIrql;
@ -295,57 +297,87 @@ PiDeleteProcess(PVOID ObjectBody)
(HANDLE)Process->UniqueProcessId, (HANDLE)Process->UniqueProcessId,
FALSE); FALSE);
} }
RemoveEntryList(&Process->ProcessListEntry); RemoveEntryList(&Process->ProcessListEntry);
KeReleaseSpinLock(&PsProcessListLock, oldIrql); KeReleaseSpinLock(&PsProcessListLock, oldIrql);
/* KDB hook */ /* KDB hook */
KDB_DELETEPROCESS_HOOK(Process); KDB_DELETEPROCESS_HOOK(Process);
ObDereferenceObject(Process->Token); ObDereferenceObject(Process->Token);
ObDeleteHandleTable(Process); ObDeleteHandleTable(Process);
(VOID)MmReleaseMmInfo(Process); (VOID)MmReleaseMmInfo(Process);
} }
static NTSTATUS static NTSTATUS
PsCreatePeb(HANDLE ProcessHandle, PsCreatePeb(HANDLE ProcessHandle,
PVOID ImageBase, PEPROCESS Process,
PVOID* RPeb) PVOID ImageBase)
{ {
NTSTATUS Status; LARGE_INTEGER SectionOffset;
PVOID PebBase; ULONG PebSize;
ULONG PebSize; PPEB Peb;
PEB Peb; PUCHAR BaseAddress;
ULONG BytesWritten; ULONG ViewSize;
NTSTATUS Status;
memset(&Peb, 0, sizeof(Peb));
Peb.ImageBaseAddress = ImageBase;
PebBase = (PVOID)PEB_BASE;
PebSize = 0x1000;
Status = NtAllocateVirtualMemory(ProcessHandle,
&PebBase,
0,
&PebSize,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
return(Status);
}
NtWriteVirtualMemory(ProcessHandle,
(PVOID)PEB_BASE,
&Peb,
sizeof(Peb),
&BytesWritten);
DPRINT("PsCreatePeb: Peb created at %x\n", PebBase); /* Allocate the Process Environment Block (PEB) */
Peb = (PPEB)PEB_BASE;
*RPeb = PebBase; PebSize = PAGE_SIZE;
Status = NtAllocateVirtualMemory(ProcessHandle,
return(STATUS_SUCCESS); (PVOID*)&Peb,
0,
&PebSize,
MEM_RESERVE | MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtAllocateVirtualMemory() failed (Status %lx)\n", Status);
return(Status);
}
DPRINT("Peb %p PebSize %lu\n", Peb, PebSize);
KeAttachProcess(Process);
/* Map the NLS section into the new process */
BaseAddress = NULL;
ViewSize = 0;
SectionOffset.QuadPart = 0LL;
Status = MmMapViewOfSection(NlsSection,
Process,
(PVOID*)&BaseAddress,
0,
0,
&SectionOffset,
&ViewSize,
ViewShare,
SEC_NO_CHANGE | MEM_TOP_DOWN,
PAGE_READONLY);
if (!NT_SUCCESS(Status))
{
DPRINT1("MmMapViewOfSection() failed (Status %lx)\n", Status);
KeDetachProcess();
return(Status);
}
DPRINT("BaseAddress %p ViewSize %lu\n", BaseAddress, ViewSize);
/* Initialize the PEB */
RtlZeroMemory(Peb, sizeof(PEB));
Peb->ImageBaseAddress = ImageBase;
/* FIXME: Initialize more PEB variables */
Peb->AnsiCodePageData = BaseAddress;
// Peb->OemCodePageData =
Process->Peb = Peb;
KeDetachProcess();
DPRINT("PsCreatePeb: Peb created at %p\n", Peb);
return(STATUS_SUCCESS);
} }
@ -355,13 +387,13 @@ KeGetCurrentProcess(VOID)
* FUNCTION: Returns a pointer to the current process * FUNCTION: Returns a pointer to the current process
*/ */
{ {
return(&(PsGetCurrentProcess()->Pcb)); return(&(PsGetCurrentProcess()->Pcb));
} }
HANDLE STDCALL HANDLE STDCALL
PsGetCurrentProcessId(VOID) PsGetCurrentProcessId(VOID)
{ {
return((HANDLE)PsGetCurrentProcess()->UniqueProcessId); return((HANDLE)PsGetCurrentProcess()->UniqueProcessId);
} }
/* /*
@ -434,7 +466,6 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
KIRQL oldIrql; KIRQL oldIrql;
PVOID LdrStartupAddr; PVOID LdrStartupAddr;
PVOID ImageBase; PVOID ImageBase;
PVOID Peb;
PEPORT DebugPort; PEPORT DebugPort;
PEPORT ExceptionPort; PEPORT ExceptionPort;
PVOID BaseAddress; PVOID BaseAddress;
@ -658,8 +689,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
*/ */
DPRINT("Creating PEB\n"); DPRINT("Creating PEB\n");
Status = PsCreatePeb(*ProcessHandle, Status = PsCreatePeb(*ProcessHandle,
ImageBase, Process,
&Peb); ImageBase);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status); DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status);
@ -669,7 +700,6 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
*ProcessHandle = NULL; *ProcessHandle = NULL;
return(Status); return(Status);
} }
Process->Peb = Peb;
/* /*
* Maybe send a message to the creator process's debugger * Maybe send a message to the creator process's debugger

View file

@ -1,4 +1,4 @@
/* $Id: nls.c,v 1.10 2002/11/10 13:36:59 robd Exp $ /* $Id: nls.c,v 1.11 2003/05/15 11:07:07 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -20,24 +20,20 @@
* 4) Add multi-byte translation code. * 4) Add multi-byte translation code.
*/ */
#ifdef WIN32_REGDBG
#include "cm_win32.h"
#else
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
//#include <internal/nls.h> #include <internal/mm.h>
#include <internal/nls.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
#endif
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
BOOLEAN NlsMbCodePageTag = FALSE; BOOLEAN NlsMbCodePageTag = FALSE;
BOOLEAN NlsMbOemCodePageTag = FALSE; BOOLEAN NlsMbOemCodePageTag = FALSE;
BYTE NlsLeadByteInfo = 0; /* ? */ UCHAR NlsLeadByteInfo = 0; /* ? */
USHORT NlsOemLeadByteInfo = 0; USHORT NlsOemLeadByteInfo = 0;
@ -53,6 +49,8 @@ PCHAR UnicodeToOemTable =NULL; /* size: 65536*sizeof(CHAR) */
PWCHAR UnicodeUpcaseTable = NULL; /* size: 65536*sizeof(WCHAR) */ PWCHAR UnicodeUpcaseTable = NULL; /* size: 65536*sizeof(WCHAR) */
PWCHAR UnicodeLowercaseTable = NULL; /* size: 65536*sizeof(WCHAR) */ PWCHAR UnicodeLowercaseTable = NULL; /* size: 65536*sizeof(WCHAR) */
PSECTION_OBJECT NlsSection = NULL;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -150,78 +148,81 @@ RtlpInitNlsTables(VOID)
NTSTATUS NTSTATUS
RtlpInitNlsSections(ULONG Mod1Start, RtlpInitNlsSection(VOID)
ULONG Mod1End,
ULONG Mod2Start,
ULONG Mod2End,
ULONG Mod3Start,
ULONG Mod3End)
{ {
UNICODE_STRING UnicodeString;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE DirectoryHandle;
HANDLE SectionHandle; HANDLE SectionHandle;
NTSTATUS Status;
LARGE_INTEGER SectionSize; LARGE_INTEGER SectionSize;
NTSTATUS Status;
DPRINT("Ansi section start: 0x%08lX\n", Mod1Start); PUCHAR MappedBuffer;
DPRINT("Ansi section end: 0x%08lX\n", Mod1End); ULONG Size;
DPRINT("Oem section start: 0x%08lX\n", Mod2Start); ULONG ViewSize;
DPRINT("Oem section end: 0x%08lX\n", Mod2End);
DPRINT("Upcase section start: 0x%08lX\n", Mod3Start);
DPRINT("Upcase section end: 0x%08lX\n", Mod3End);
/* Create the '\NLS' directory */ DPRINT1("RtlpInitNlsSection() called\n");
RtlInitUnicodeStringFromLiteral(&UnicodeString,
L"\\NLS");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
OBJ_PERMANENT,
NULL,
NULL);
Status = NtCreateDirectoryObject(&DirectoryHandle,
0,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
return(Status);
/* Create the 'NlsSectionUnicode' section */ Size = 4096;
RtlInitUnicodeStringFromLiteral(&UnicodeString,
L"NlsSectionUnicode");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
OBJ_PERMANENT,
DirectoryHandle,
NULL);
SectionSize.QuadPart = (Mod1End - Mod1Start) +
(Mod2End - Mod2Start) + (Mod3End - Mod3Start);
DPRINT("NlsSectionUnicode size: 0x%I64X\n", SectionSize.QuadPart);
DPRINT("Nls section size: 0x%lx\n", Size);
/* Create the nls section */
SectionSize.QuadPart = (ULONGLONG)Size;
Status = NtCreateSection(&SectionHandle, Status = NtCreateSection(&SectionHandle,
SECTION_ALL_ACCESS, SECTION_ALL_ACCESS,
&ObjectAttributes, NULL,
&SectionSize, &SectionSize,
PAGE_READWRITE, PAGE_READWRITE,
0, SEC_COMMIT,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); {
DPRINT1("NtCreateSection() failed (Status %lx)\n", Status);
KeBugCheck(0);
/* create and initialize code page table */ return(Status);
}
/* map the nls table into the 'NlsSectionUnicode' section */
/* Get the pointer to the nls section object */
Status = ObReferenceObjectByHandle(SectionHandle,
SECTION_ALL_ACCESS,
MmSectionObjectType,
KernelMode,
(PVOID*)&NlsSection,
NULL);
NtClose(SectionHandle); NtClose(SectionHandle);
NtClose(DirectoryHandle); if (!NT_SUCCESS(Status))
{
DPRINT1("ObReferenceObjectByHandle() failed (Status %lx)\n", Status);
KeBugCheck(0);
return(Status);
}
/* Map the nls section into system address space */
ViewSize = 4096;
Status = MmMapViewInSystemSpace(NlsSection,
(PVOID*)&MappedBuffer,
&ViewSize);
if (!NT_SUCCESS(Status))
{
DPRINT1("MmMapViewInSystemSpace() failed (Status %lx)\n", Status);
KeBugCheck(0);
return(Status);
}
DPRINT1("BaseAddress %p\n", MappedBuffer);
strcpy(MappedBuffer, "This is a teststring!");
/* ... */
DPRINT1("RtlpInitNlsSection() done\n");
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL NTSTATUS STDCALL
RtlCustomCPToUnicodeN(PRTL_NLS_DATA NlsData, RtlCustomCPToUnicodeN(IN PCPTABLEINFO CustomCP,
PWCHAR UnicodeString, PWCHAR UnicodeString,
ULONG UnicodeSize, ULONG UnicodeSize,
PULONG ResultSize, PULONG ResultSize,
@ -231,7 +232,7 @@ RtlCustomCPToUnicodeN(PRTL_NLS_DATA NlsData,
ULONG Size = 0; ULONG Size = 0;
ULONG i; ULONG i;
if (NlsData->DbcsFlag == FALSE) if (CustomCP->DBCSCodePage == 0)
{ {
/* single-byte code page */ /* single-byte code page */
if (CustomSize > (UnicodeSize / sizeof(WCHAR))) if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
@ -244,7 +245,7 @@ RtlCustomCPToUnicodeN(PRTL_NLS_DATA NlsData,
for (i = 0; i < Size; i++) for (i = 0; i < Size; i++)
{ {
*UnicodeString = NlsData->MultiByteToUnicode[(unsigned int)*CustomString]; *UnicodeString = CustomCP->MultiByteTable[(unsigned int)*CustomString];
UnicodeString++; UnicodeString++;
CustomString++; CustomString++;
} }
@ -268,6 +269,24 @@ RtlGetDefaultCodePage(PUSHORT AnsiCodePage,
} }
VOID STDCALL
RtlInitCodePageTable(IN PUSHORT TableBase,
OUT PCPTABLEINFO CodePageTable)
{
UNIMPLEMENTED;
}
VOID STDCALL
RtlInitNlsTables(OUT PNLSTABLEINFO NlsTable,
IN PUSHORT CaseTableBase,
IN PUSHORT OemTableBase,
IN PUSHORT AnsiTableBase)
{
UNIMPLEMENTED;
}
NTSTATUS STDCALL NTSTATUS STDCALL
RtlMultiByteToUnicodeN(PWCHAR UnicodeString, RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
ULONG UnicodeSize, ULONG UnicodeSize,
@ -364,8 +383,15 @@ RtlOemToUnicodeN(PWCHAR UnicodeString,
} }
VOID STDCALL
RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
{
UNIMPLEMENTED;
}
NTSTATUS STDCALL NTSTATUS STDCALL
RtlUnicodeToCustomCPN(PRTL_NLS_DATA NlsData, RtlUnicodeToCustomCPN(IN PCPTABLEINFO CustomCP,
PCHAR CustomString, PCHAR CustomString,
ULONG CustomSize, ULONG CustomSize,
PULONG ResultSize, PULONG ResultSize,
@ -375,7 +401,7 @@ RtlUnicodeToCustomCPN(PRTL_NLS_DATA NlsData,
ULONG Size = 0; ULONG Size = 0;
ULONG i; ULONG i;
if (NlsData->DbcsFlag == 0) if (CustomCP->DBCSCodePage == 0)
{ {
/* single-byte code page */ /* single-byte code page */
if (UnicodeSize > (CustomSize * sizeof(WCHAR))) if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
@ -388,7 +414,7 @@ RtlUnicodeToCustomCPN(PRTL_NLS_DATA NlsData,
for (i = 0; i < Size; i++) for (i = 0; i < Size; i++)
{ {
*CustomString = NlsData->UnicodeToMultiByte[(unsigned int)*UnicodeString]; *CustomString = ((PCHAR)CustomCP->WideCharTable)[(unsigned int)*UnicodeString];
CustomString++; CustomString++;
UnicodeString++; UnicodeString++;
} }
@ -501,7 +527,7 @@ RtlUnicodeToOemN(PCHAR OemString,
NTSTATUS STDCALL NTSTATUS STDCALL
RtlUpcaseUnicodeToCustomCPN(PRTL_NLS_DATA NlsData, RtlUpcaseUnicodeToCustomCPN(IN PCPTABLEINFO CustomCP,
PCHAR CustomString, PCHAR CustomString,
ULONG CustomSize, ULONG CustomSize,
PULONG ResultSize, PULONG ResultSize,
@ -512,7 +538,7 @@ RtlUpcaseUnicodeToCustomCPN(PRTL_NLS_DATA NlsData,
ULONG i; ULONG i;
WCHAR wc; WCHAR wc;
if (NlsData->DbcsFlag == 0) if (CustomCP->DBCSCodePage == 0)
{ {
/* single-byte code page */ /* single-byte code page */
if (UnicodeSize > (CustomSize * sizeof(WCHAR))) if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
@ -526,7 +552,7 @@ RtlUpcaseUnicodeToCustomCPN(PRTL_NLS_DATA NlsData,
for (i = 0; i < Size; i++) for (i = 0; i < Size; i++)
{ {
wc = UnicodeUpcaseTable[(unsigned int)*UnicodeString]; wc = UnicodeUpcaseTable[(unsigned int)*UnicodeString];
*CustomString = NlsData->UnicodeToMultiByte[(unsigned int)wc]; *CustomString = ((PCHAR)CustomCP->WideCharTable)[(unsigned int)wc];
CustomString++; CustomString++;
UnicodeString++; UnicodeString++;
} }