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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlValidateUnicodeString(IN ULONG Flags,
|
RtlValidateUnicodeString(
|
||||||
IN PCUNICODE_STRING UnicodeString)
|
_In_ ULONG Flags,
|
||||||
|
_In_ PCUNICODE_STRING String)
|
||||||
{
|
{
|
||||||
/* currently no flags are supported! */
|
/* In Windows <= 2003 no flags are supported yet! */
|
||||||
ASSERT(Flags == 0);
|
if (Flags != 0)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if ((Flags == 0) &&
|
/* NOTE: a NULL Unicode string pointer is considered to be a valid one! */
|
||||||
((UnicodeString == NULL) ||
|
if (String == NULL)
|
||||||
((UnicodeString->Length != 0) &&
|
{
|
||||||
(UnicodeString->Buffer != NULL) &&
|
return STATUS_SUCCESS;
|
||||||
((UnicodeString->Length % sizeof(WCHAR)) == 0) &&
|
}
|
||||||
((UnicodeString->MaximumLength % sizeof(WCHAR)) == 0) &&
|
else if (!((String->Buffer == NULL) && (String->Length != 0 || String->MaximumLength != 0)) &&
|
||||||
(UnicodeString->MaximumLength >= UnicodeString->Length))))
|
(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;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue