RtlUnicodeStringValidateEx function (ntstrsafe.h)

The RtlUnicodeStringValidateEx function validates the contents of a UNICODE_STRING structure.

Syntax

NTSTRSAFEDDI RtlUnicodeStringValidateEx(
  [in] PCUNICODE_STRING SourceString,
  [in] DWORD            dwFlags
);

Parameters

[in] SourceString

Optional. A pointer to a UNICODE_STRING structure to be validated. This pointer can be NULL, but only if STRSAFE_IGNORE_NULLS is set in dwFlags.

[in] dwFlags

The following flag is defined:

STRSAFE_IGNORE_NULLS

If this flag is set, the source pointer can be NULL. RtlUnicodeStringValidateEx treats NULL source buffer pointers like empty strings (TEXT("")).

Return value

RtlUnicodeStringValidateEx 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.
 

If STRSAFE_IGNORE_NULLS is not set in dwFlags, RtlUnicodeStringValidateEx 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.
  • An invalid flag is specified for dwFlags.
For information about how to test NTSTATUS values, see Using NTSTATUS Values.

Remarks

The SourceString pointer cannot be NULL unless the STRSAFE_IGNORE_NULLS flag is set.

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 Any if strings being manipulated are always resident in memory, otherwise PASSIVE_LEVEL

See also

RtlUnicodeStringValidate

UNICODE_STRING