mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[RTL]
- Implement RtlIsValidOemCharacter function * Fixes all new tests for this function svn path=/trunk/; revision=72580
This commit is contained in:
parent
1a8c432587
commit
468c2342d6
2 changed files with 40 additions and 4 deletions
|
@ -29,7 +29,7 @@ PUSHORT NlsLeadByteInfo = NULL; /* exported */
|
|||
USHORT NlsOemCodePage = 0;
|
||||
BOOLEAN NlsMbOemCodePageTag = FALSE; /* exported */
|
||||
PWCHAR NlsOemToUnicodeTable = NULL;
|
||||
PCHAR NlsUnicodeToOemTable =NULL;
|
||||
PCHAR NlsUnicodeToOemTable = NULL;
|
||||
PWCHAR NlsDbcsUnicodeToOemTable = NULL;
|
||||
PUSHORT NlsOemLeadByteInfo = NULL; /* exported */
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ extern BOOLEAN NlsMbOemCodePageTag;
|
|||
extern PUSHORT NlsLeadByteInfo;
|
||||
extern USHORT NlsOemDefaultChar;
|
||||
extern USHORT NlsUnicodeDefaultChar;
|
||||
extern PUSHORT NlsOemLeadByteInfo;
|
||||
extern PWCHAR NlsOemToUnicodeTable;
|
||||
extern PCHAR NlsUnicodeToOemTable;
|
||||
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -503,14 +506,47 @@ RtlpDidUnicodeToOemWork(IN PCUNICODE_STRING UnicodeString,
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlIsValidOemCharacter(IN PWCHAR Char)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
WCHAR UnicodeChar;
|
||||
WCHAR OemChar;
|
||||
UCHAR Index;
|
||||
|
||||
/* If multi-byte code page present */
|
||||
if (NlsMbOemCodePageTag)
|
||||
{
|
||||
USHORT Offset = 0;
|
||||
|
||||
OemChar = NlsUnicodeToOemTable[*Char];
|
||||
|
||||
/* If character has Lead Byte */
|
||||
if (NlsOemLeadByteInfo[HIBYTE(OemChar)])
|
||||
Offset = NlsOemLeadByteInfo[HIBYTE(OemChar)];
|
||||
|
||||
Index = LOBYTE(OemChar) + Offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = NlsUnicodeToOemTable[*Char];
|
||||
}
|
||||
|
||||
/* Receive Unicode character from the table */
|
||||
UnicodeChar = RtlUpcaseUnicodeChar(NlsOemToUnicodeTable[Index]);
|
||||
|
||||
/* Receive OEM character from the table */
|
||||
OemChar = NlsUnicodeToOemTable[UnicodeChar];
|
||||
|
||||
/* Not valid character, failed */
|
||||
if (OemChar == NlsOemDefaultChar)
|
||||
return FALSE;
|
||||
|
||||
*Char = UnicodeChar;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue