diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index e392a1dabd0..f7eb95269ef 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -671,6 +671,7 @@ RtlValidSecurityDescriptor@4 RtlValidSid@4 RtlValidateHeap@12 RtlValidateProcessHeaps@0 +RtlValidateUnicodeString@8 ;RtlWalkHeap RtlWriteRegistryValue@24 ;RtlZeroHeap diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index 9905fc9e6f4..f1c8d73400c 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -2671,4 +2671,33 @@ RtlpDuplicateUnicodeString( return STATUS_SUCCESS; } + +/* + * @implemented + */ +NTSTATUS STDCALL +RtlValidateUnicodeString(IN ULONG Flags, + IN PUNICODE_STRING UnicodeString) +{ + /* currently no flags are supported! */ + ASSERT(Flags == 0); + + if ((Flags == 0) && + ((UnicodeString == NULL) || + ((UnicodeString->Length != 0) && + (UnicodeString->Buffer != NULL) && + ((UnicodeString->Length % sizeof(WCHAR)) == 0) && + ((UnicodeString->MaximumLength % sizeof(WCHAR)) == 0) && + (UnicodeString->MaximumLength >= UnicodeString->Length)))) + { + /* a NULL pointer as a unicode string is considered to be a valid unicode + string! */ + return STATUS_SUCCESS; + } + else + { + return STATUS_INVALID_PARAMETER; + } +} + /* EOF */