mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[RTL] Fix RtlValidateUnicodeString() regarding the tests and add some SAL annotations.
This commit is contained in:
parent
ae8c9a1fa2
commit
127fa1afc6
1 changed files with 15 additions and 13 deletions
|
@ -2541,22 +2541,24 @@ RtlDuplicateUnicodeString(
|
|||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlValidateUnicodeString(IN ULONG Flags,
|
||||
IN PCUNICODE_STRING UnicodeString)
|
||||
RtlValidateUnicodeString(
|
||||
_In_ ULONG Flags,
|
||||
_In_ PCUNICODE_STRING String)
|
||||
{
|
||||
/* currently no flags are supported! */
|
||||
ASSERT(Flags == 0);
|
||||
/* In Windows <= 2003 no flags are supported yet! */
|
||||
if (Flags != 0)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
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))))
|
||||
/* NOTE: a NULL Unicode string pointer is considered to be a valid one! */
|
||||
if (String == NULL)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else if (!((String->Buffer == NULL) && (String->Length != 0 || String->MaximumLength != 0)) &&
|
||||
(String->Length % sizeof(WCHAR) == 0) &&
|
||||
(String->MaximumLength % sizeof(WCHAR) == 0) &&
|
||||
(String->Length <= String->MaximumLength))
|
||||
{
|
||||
/* a NULL pointer as a unicode string is considered to be a valid unicode
|
||||
string! */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue