RtlUnicodeStringValidate function (ntstrsafe.h)

The RtlUnicodeStringValidate function validates the contents of a UNICODE_STRING structure.

Syntax

NTSTRSAFEDDI RtlUnicodeStringValidate(
  [in] PCUNICODE_STRING SourceString
);

Parameters

[in] SourceString

A pointer to a UNICODE_STRING structure to be validated.

Return value

RtlUnicodeStringValidate returns one of the following NTSTATUS values.

Return code Description
STATUS_SUCCESS
This success status means that the function completed successfully.
STATUS_INVALID_PARAMETER
This error status means that the function received an invalid input parameter. For more information, see the following list.
 

RtlUnicodeStringValidate returns the STATUS_INVALID_PARAMETER value when one of the following occurs:

  • SourceString->Length % sizeof(WCHAR) does not equal zero.
  • SourceString->MaximumLength % sizeof(WCHAR) does not equal zero.
  • SourceString->Length is greater than SourceString->MaximumLength.
  • SourceString->MaximumLength is greater than NTSTRSAFE_UNICODE_STRING_MAX_CCH * sizeof(WCHAR).
  • SourceString->Buffer equals NULL but SourceString->Length or SourceString->MaximumLength does not equal zero.
For information about how to test NTSTATUS values, see Using NTSTATUS Values.

Remarks

The SourceString pointer cannot be NULL. If you need to specify a NULL pointer value, use the RtlUnicodeStringValidateEx function.

For more information about the safe string functions, see Using Safe String Functions.

Requirements

Requirement Value
Minimum supported client Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows.
Target Platform Desktop
Header ntstrsafe.h (include Ntstrsafe.h)
Library Ntstrsafe.lib
IRQL PASSIVE_LEVEL

See also

RtlUnicodeStringValidateEx

UNICODE_STRING