- Implement RtlIsValidOemCharacter function

* Fixes all new tests for this function

svn path=/trunk/; revision=72580
This commit is contained in:
Dmitry Chapyshev 2016-09-04 22:57:44 +00:00
parent 1a8c432587
commit 468c2342d6
2 changed files with 40 additions and 4 deletions

View file

@ -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 */

View file

@ -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;
return FALSE;
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;
}
/*