ntdll: Avoid setting IS_TEXT_UNICODE_NUL_BYTES for the last byte of an ANSI string.
This commit is contained in:
parent
323f09b022
commit
370b881fcd
|
@ -1610,6 +1610,9 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
|
|||
/* Check for an odd length ... pass if even. */
|
||||
if (len & 1) out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
|
||||
|
||||
if (((char *)buf)[len - 1] == 0)
|
||||
len--; /* Windows seems to do something like that to avoid e.g. false IS_TEXT_UNICODE_NULL_BYTES */
|
||||
|
||||
len /= sizeof(WCHAR);
|
||||
/* Windows only checks the first 256 characters */
|
||||
if (len > 256) len = 256;
|
||||
|
|
|
@ -1677,7 +1677,7 @@ static void test_RtlIsTextUnicode(void)
|
|||
int flags;
|
||||
int i;
|
||||
|
||||
todo_wine ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n");
|
||||
ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n");
|
||||
|
||||
ok(pRtlIsTextUnicode(unicode, sizeof(unicode), NULL), "Text should be Unicode\n");
|
||||
ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, NULL), "Text should be Unicode\n");
|
||||
|
|
Loading…
Reference in New Issue