Zac Brown wrote:
Implement setting of IS_TEXT_UNICODE_CONTROLS and IS_TEXT_UNICODE_REVERSE_CONTROLS when control characters are present in RtlIsTextUnicode.
-Zac Brown
dlls/ntdll/rtlstr.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/tests/rtlstr.c | 2 - 2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index deec931..ead8974 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -1591,6 +1591,23 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString( */ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf ) {
- /*
* Enum for possible control characters.* BR = byte reversed, for use in byte reversed strings.*/- enum control_chars {
TAB = '\t',BR_TAB = 0x0900,CRET = '\r',BR_CRET = 0x0d00,NEWLINE = '\n',BR_NEWLINE = 0x0a00,SPACE = ' ',BR_SPACE = 0x2000,CJKSPACE = 0x3000,BR_CJKSPACE = 0x0030- };
- const WCHAR *s = buf; int i; unsigned int flags = ~0U, out_flags = 0;
@@ -1650,6 +1667,46 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf ) } }
- /* Check for control characters in string. */
- if (flags & IS_TEXT_UNICODE_CONTROLS)
- {
for (i = 0; i < len; i++){switch (s[i]){case TAB:case CRET:case NEWLINE:case SPACE:case CJKSPACE:out_flags |= IS_TEXT_UNICODE_CONTROLS;break;default:continue;}}- }
- /* Check for control characters in byte reversed string. */
- if ((flags & IS_TEXT_UNICODE_REVERSE_CONTROLS) && (out_flags & IS_TEXT_UNICODE_REVERSE_SIGNATURE))
- {
for (i = 0; i < len; i++){switch (s[i]){case BR_TAB:case BR_CRET:case BR_NEWLINE:case BR_SPACE:case BR_CJKSPACE:out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;break;default:continue;}}- }
- if (pf) { out_flags &= *pf;
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index aa4a391..5d77f9a 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c @@ -1689,7 +1689,6 @@ static void test_RtlIsTextUnicode(void)
flags = IS_TEXT_UNICODE_UNICODE_MASK; ok(pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Text should not pass a Unicode\n");
- todo_wine ok(flags == (IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_CONTROLS), "Expected flags 0x6, obtained %x\n", flags);
@@ -1718,7 +1717,6 @@ static void test_RtlIsTextUnicode(void)
flags = IS_TEXT_UNICODE_REVERSE_MASK; ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, &flags), "Reverse endian should be Unicode\n");
- todo_wine ok(flags == (IS_TEXT_UNICODE_REVERSE_CONTROLS | IS_TEXT_UNICODE_REVERSE_SIGNATURE), "Expected flags 0xc0, obtained %x\n", flags); HeapFree(GetProcessHeap(), 0, be_unicode);
One more time... ignore this patch. Will send update later.
-Zac