mirror of
https://github.com/reactos/reactos.git
synced 2024-08-07 11:48:03 +00:00
Implemented RtlIsTextUnicode().
svn path=/trunk/; revision=4434
This commit is contained in:
parent
52dfe36e11
commit
6748410167
|
@ -1924,23 +1924,6 @@ extern "C" {
|
|||
/* InitializeSecurityDescriptor */
|
||||
#define SECURITY_DESCRIPTOR_REVISION (1)
|
||||
|
||||
/* IsTextUnicode */
|
||||
#define IS_TEXT_UNICODE_ASCII16 (1)
|
||||
#define IS_TEXT_UNICODE_REVERSE_ASCII16 (16)
|
||||
#define IS_TEXT_UNICODE_STATISTICS (2)
|
||||
#define IS_TEXT_UNICODE_REVERSE_STATISTICS (32)
|
||||
#define IS_TEXT_UNICODE_CONTROLS (4)
|
||||
#define IS_TEXT_UNICODE_REVERSE_CONTROLS (64)
|
||||
#define IS_TEXT_UNICODE_SIGNATURE (8)
|
||||
#define IS_TEXT_UNICODE_REVERSE_SIGNATURE (128)
|
||||
#define IS_TEXT_UNICODE_ILLEGAL_CHARS (256)
|
||||
#define IS_TEXT_UNICODE_ODD_LENGTH (512)
|
||||
#define IS_TEXT_UNICODE_NULL_BYTES (4096)
|
||||
#define IS_TEXT_UNICODE_UNICODE_MASK (15)
|
||||
#define IS_TEXT_UNICODE_REVERSE_MASK (240)
|
||||
#define IS_TEXT_UNICODE_NOT_UNICODE_MASK (3840)
|
||||
#define IS_TEXT_UNICODE_NOT_ASCII_MASK (61440)
|
||||
|
||||
/* JournalPlaybackProc, KeyboardProc */
|
||||
#define HC_GETNEXT (1)
|
||||
#define HC_SKIP (2)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtl.h,v 1.5 2003/02/12 00:39:30 hyperion Exp $
|
||||
/* $Id: rtl.h,v 1.6 2003/03/26 15:10:29 ekohl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -28,6 +28,26 @@
|
|||
#define RTL_QUERY_REGISTRY_DIRECT (0x00000020)
|
||||
#define RTL_QUERY_REGISTRY_DELETE (0x00000040)
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Flags used by RtlIsTextUnicode and IsTextUnicode
|
||||
*/
|
||||
#define IS_TEXT_UNICODE_ASCII16 (0x00000001)
|
||||
#define IS_TEXT_UNICODE_REVERSE_ASCII16 (0x00000010)
|
||||
#define IS_TEXT_UNICODE_STATISTICS (0x00000002)
|
||||
#define IS_TEXT_UNICODE_REVERSE_STATISTICS (0x00000020)
|
||||
#define IS_TEXT_UNICODE_CONTROLS (0x00000004)
|
||||
#define IS_TEXT_UNICODE_REVERSE_CONTROLS (0x00000040)
|
||||
#define IS_TEXT_UNICODE_SIGNATURE (0x00000008)
|
||||
#define IS_TEXT_UNICODE_REVERSE_SIGNATURE (0x00000080)
|
||||
#define IS_TEXT_UNICODE_ILLEGAL_CHARS (0x00000100)
|
||||
#define IS_TEXT_UNICODE_ODD_LENGTH (0x00000200)
|
||||
#define IS_TEXT_UNICODE_NULL_BYTES (0x00001000)
|
||||
#define IS_TEXT_UNICODE_UNICODE_MASK (0x0000000F)
|
||||
#define IS_TEXT_UNICODE_REVERSE_MASK (0x000000F0)
|
||||
#define IS_TEXT_UNICODE_NOT_UNICODE_MASK (0x00000F00)
|
||||
#define IS_TEXT_UNICODE_NOT_ASCII_MASK (0x0000F000)
|
||||
|
||||
/*
|
||||
* VOID
|
||||
* InitializeObjectAttributes (
|
||||
|
@ -1267,6 +1287,11 @@ RtlIsNameLegalDOS8Dot3(IN PUNICODE_STRING UnicodeName,
|
|||
IN PANSI_STRING AnsiName,
|
||||
OUT PBOOLEAN SpacesFound);
|
||||
|
||||
ULONG STDCALL
|
||||
RtlIsTextUnicode (PVOID Buffer,
|
||||
ULONG Length,
|
||||
ULONG *Flags);
|
||||
|
||||
LARGE_INTEGER
|
||||
STDCALL
|
||||
RtlLargeIntegerAdd (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.def,v 1.93 2003/03/16 14:16:54 chorns Exp $
|
||||
; $Id: ntdll.def,v 1.94 2003/03/26 15:19:28 ekohl Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -457,7 +457,7 @@ RtlIntegerToUnicodeString@12
|
|||
RtlIsDosDeviceName_U@4
|
||||
;RtlIsGenericTableEmpty
|
||||
RtlIsNameLegalDOS8Dot3@12
|
||||
;RtlIsTextUnicode
|
||||
RtlIsTextUnicode@12
|
||||
RtlIsValidHandle@8
|
||||
RtlIsValidIndexHandle@12
|
||||
RtlLargeIntegerAdd@16
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.edf,v 1.82 2003/03/16 14:16:54 chorns Exp $
|
||||
; $Id: ntdll.edf,v 1.83 2003/03/26 15:19:28 ekohl Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -456,7 +456,7 @@ RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
|
|||
RtlIsDosDeviceName_U=RtlIsDosDeviceName_U@4
|
||||
;RtlIsGenericTableEmpty
|
||||
RtlIsNameLegalDOS8Dot3=RtlIsNameLegalDOS8Dot3@12
|
||||
;RtlIsTextUnicode
|
||||
RtlIsTextUnicode=RtlIsTextUnicode@12
|
||||
RtlIsValidHandle=RtlIsValidHandle@8
|
||||
RtlIsValidIndexHandle=RtlIsValidIndexHandle@12
|
||||
RtlLargeIntegerAdd=RtlLargeIntegerAdd@16
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: unicode.c,v 1.25 2002/12/08 15:57:39 robd Exp $
|
||||
/* $Id: unicode.c,v 1.26 2003/03/26 15:16:50 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -873,6 +873,61 @@ RtlIntegerToUnicodeString(
|
|||
}
|
||||
|
||||
|
||||
#define ITU_IMPLEMENTED_TESTS (IS_TEXT_UNICODE_ODD_LENGTH|IS_TEXT_UNICODE_SIGNATURE)
|
||||
|
||||
ULONG STDCALL
|
||||
RtlIsTextUnicode (PVOID Buffer,
|
||||
ULONG Length,
|
||||
ULONG *Flags)
|
||||
{
|
||||
PWSTR s = Buffer;
|
||||
ULONG in_flags = (ULONG)-1;
|
||||
ULONG out_flags = 0;
|
||||
|
||||
if (Length == 0)
|
||||
goto done;
|
||||
|
||||
if (Flags != 0)
|
||||
in_flags = *Flags;
|
||||
|
||||
/*
|
||||
* Apply various tests to the text string. According to the
|
||||
* docs, each test "passed" sets the corresponding flag in
|
||||
* the output flags. But some of the tests are mutually
|
||||
* exclusive, so I don't see how you could pass all tests ...
|
||||
*/
|
||||
|
||||
/* Check for an odd length ... pass if even. */
|
||||
if (!(Length & 1))
|
||||
out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
|
||||
|
||||
/* Check for the BOM (byte order mark). */
|
||||
if (*s == 0xFEFF)
|
||||
out_flags |= IS_TEXT_UNICODE_SIGNATURE;
|
||||
|
||||
#if 0
|
||||
/* Check for the reverse BOM (byte order mark). */
|
||||
if (*s == 0xFFFE)
|
||||
out_flags |= IS_TEXT_UNICODE_REVERSE_SIGNATURE;
|
||||
#endif
|
||||
|
||||
/* FIXME: Add more tests */
|
||||
|
||||
/*
|
||||
* Check whether the string passed all of the tests.
|
||||
*/
|
||||
in_flags &= ITU_IMPLEMENTED_TESTS;
|
||||
if ((out_flags & in_flags) != in_flags)
|
||||
Length = 0;
|
||||
|
||||
done:
|
||||
if (Flags != 0)
|
||||
*Flags = out_flags;
|
||||
|
||||
return Length;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlLargeIntegerToChar(
|
||||
|
|
Loading…
Reference in a new issue