ntdll: Implement RtlInitCodePageTable().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-11-26 17:29:41 +01:00
parent f5c4a89cf2
commit 9ae5717ba6
4 changed files with 84 additions and 2 deletions

View File

@ -40,6 +40,30 @@
WINE_DEFAULT_DEBUG_CHANNEL(nls);
/* NLS file format:
*
* header:
* WORD offset to cp2uni table in words
* WORD CodePage
* WORD MaximumCharacterSize
* BYTE[2] DefaultChar
* WORD UniDefaultChar
* WORD TransDefaultChar
* WORD TransUniDefaultChar
* BYTE[12] LeadByte
* cp2uni table:
* WORD offset to uni2cp table in words
* WORD[256] cp2uni table
* WORD glyph table size
* WORD[glyph_table_size] glyph table
* WORD number of lead byte ranges
* WORD[256] lead byte offsets in words
* WORD[leadbytes][256] cp2uni table for lead bytes
* uni2cp table:
* WORD 0 / 4
* BYTE[65536] / WORD[65536] uni2cp table
*/
enum nls_section_type
{
NLS_SECTION_CASEMAP = 10,
@ -594,6 +618,40 @@ done:
}
/******************************************************************
* RtlInitCodePageTable (NTDLL.@)
*/
void WINAPI RtlInitCodePageTable( USHORT *ptr, CPTABLEINFO *info )
{
USHORT hdr_size = ptr[0];
info->CodePage = ptr[1];
info->MaximumCharacterSize = ptr[2];
info->DefaultChar = ptr[3];
info->UniDefaultChar = ptr[4];
info->TransDefaultChar = ptr[5];
info->TransUniDefaultChar = ptr[6];
memcpy( info->LeadByte, ptr + 7, sizeof(info->LeadByte) );
ptr += hdr_size;
info->WideCharTable = ptr + ptr[0] + 1;
info->MultiByteTable = ++ptr;
ptr += 256;
if (*ptr++) ptr += 256; /* glyph table */
info->DBCSRanges = ptr;
if (*ptr) /* dbcs ranges */
{
info->DBCSCodePage = 1;
info->DBCSOffsets = ptr + 1;
}
else
{
info->DBCSCodePage = 0;
info->DBCSOffsets = NULL;
}
}
/******************************************************************
* RtlLocaleNameToLcid (NTDLL.@)
*/

View File

@ -729,7 +729,7 @@
@ stdcall RtlImpersonateSelf(long)
@ stdcall RtlInitAnsiString(ptr str)
@ stdcall RtlInitAnsiStringEx(ptr str)
@ stub RtlInitCodePageTable
@ stdcall RtlInitCodePageTable(ptr ptr)
# @ stub RtlInitMemoryStream
@ stub RtlInitNlsTables
# @ stub RtlInitOutOfProcessMemoryStream

View File

@ -1079,7 +1079,7 @@
@ stdcall RtlImageDirectoryEntryToData(long long long ptr)
@ stdcall RtlImageNtHeader(long)
@ stdcall RtlInitAnsiString(ptr str)
@ stub RtlInitCodePageTable
@ stdcall RtlInitCodePageTable(ptr ptr) ntdll.RtlInitCodePageTable
@ stdcall RtlInitString(ptr str)
@ stdcall RtlInitUnicodeString(ptr wstr)
@ stdcall RtlInitializeBitMap(ptr ptr long)

View File

@ -2203,6 +2203,29 @@ typedef enum _SYSDBG_COMMAND {
SysDbgWriteBusData
} SYSDBG_COMMAND, *PSYSDBG_COMMAND;
typedef struct _CPTABLEINFO
{
USHORT CodePage;
USHORT MaximumCharacterSize;
USHORT DefaultChar;
USHORT UniDefaultChar;
USHORT TransDefaultChar;
USHORT TransUniDefaultChar;
USHORT DBCSCodePage;
UCHAR LeadByte[12];
USHORT *MultiByteTable;
void *WideCharTable;
USHORT *DBCSRanges;
USHORT *DBCSOffsets;
} CPTABLEINFO, *PCPTABLEINFO;
typedef struct _NLSTABLEINFO
{
CPTABLEINFO OemTableInfo;
CPTABLEINFO AnsiTableInfo;
USHORT *UpperCaseTable;
USHORT *LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO;
/*************************************************************************
* Loader structures
@ -2758,6 +2781,7 @@ NTSYSAPI NTSTATUS WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
NTSYSAPI void WINAPI RtlInitString(PSTRING,PCSZ);
NTSYSAPI void WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
NTSYSAPI NTSTATUS WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ);
NTSYSAPI void WINAPI RtlInitCodePageTable(USHORT*,CPTABLEINFO*);
NTSYSAPI void WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
NTSYSAPI NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);