Index: lib/rtl/nls.c =================================================================== --- lib/rtl/nls.c (revision 41126) +++ lib/rtl/nls.c (working copy) @@ -33,6 +33,10 @@ PWCHAR NlsDbcsUnicodeToOemTable = NULL; PUSHORT _NlsOemLeadByteInfo = NULL; /* exported */ +CHAR NlsOemDefaultChar = '\0'; /* exported */ +USHORT NlsUnicodeDefualtChar = 0; /* exported */ + + #define NlsOemLeadByteInfo _NlsOemLeadByteInfo #define INIT_FUNCTION @@ -157,6 +161,9 @@ CodePageTable->TransDefaultChar = NlsFileHeader->TransDefaultChar; CodePageTable->TransUniDefaultChar = NlsFileHeader->TransUniDefaultChar; + NlsOemDefaultChar = NlsFileHeader->TransDefaultChar; + NlsUnicodeDefualtChar = NlsFileHeader->TransUniDefaultChar; + RtlCopyMemory(&CodePageTable->LeadByte, &NlsFileHeader->LeadByte, MAXIMUM_LEADBYTES); Index: lib/rtl/unicode.c =================================================================== --- lib/rtl/unicode.c (revision 41126) +++ lib/rtl/unicode.c (working copy) @@ -23,6 +23,9 @@ extern BOOLEAN NlsMbOemCodePageTag; extern PUSHORT NlsLeadByteInfo; +extern CHAR NlsOemDefaultChar; +extern USHORT NlsUnicodeDefualtChar; + /* FUNCTIONS *****************************************************************/ /* @@ -395,7 +398,41 @@ } } + /* + * @implemented + * + * NOTES + * Checks the oem-string to match the uincoded-string. + * Function who convert unicode string to oem string will set a questionmark + * when the character are unkown. So check it against the unicode string + * and return false when the uncode string not contain an questionmark. + */ +BOOLEAN +NTAPI +RtlpDidUnicodeToOemWork(IN PUNICODE_STRING UnicodeString,IN POEM_STRING OemString) +{ + ULONG i; + + if ((OemString != NULL) && (OemString->Buffer != NULL)) + { + i = 0; + while ((OemString->Buffer[i]!=0) && (iLength)) + { + if ((OemString->Buffer[i]==NlsOemDefaultChar) && + (UnicodeString->Buffer[i]!=NlsUnicodeDefualtChar)) + { + return FALSE; + } + i++; + } + return TRUE; + } + + return FALSE; +} + +/* * @unimplemented */ BOOLEAN @@ -1534,8 +1571,14 @@ UniSource->Buffer, UniSource->Length); - /* FIXME: Check if everything mapped correctly and - * return STATUS_UNMAPPABLE_CHARACTER */ + if (NT_SUCCESS(Status)) + { + /* check for unmapped character */ + if (RtlpDidUnicodeToOemWork(UniSource,OemDest) == FALSE) + { + Status = STATUS_UNMAPPABLE_CHARACTER; + } + } if (!NT_SUCCESS(Status) && AllocateDestinationString) { @@ -1763,7 +1806,14 @@ UniSource->Buffer, UniSource->Length); - /* FIXME: Special check needed and return STATUS_UNMAPPABLE_CHARACTER */ + if (NT_SUCCESS(Status)) + { + /* check for unmapped character */ + if (RtlpDidUnicodeToOemWork((PUNICODE_STRING)UniSource,OemDest) == FALSE) + { + Status = STATUS_UNMAPPABLE_CHARACTER; + } + } if (!NT_SUCCESS(Status) && AllocateDestinationString) { @@ -1816,7 +1866,14 @@ UniSource->Buffer, UniSource->Length); - /* FIXME: Special check needed and return STATUS_UNMAPPABLE_CHARACTER */ + if (NT_SUCCESS(Status)) + { + /* check for unmapped character */ + if (RtlpDidUnicodeToOemWork((PUNICODE_STRING)UniSource,OemDest) == FALSE) + { + Status = STATUS_UNMAPPABLE_CHARACTER; + } + } if (!NT_SUCCESS(Status) && AllocateDestinationString) {