RtlUnicodeStringValidateEx function

The RtlUnicodeStringValidateEx function validates the contents of a UNICODE_STRING structure.

Syntax


NTSTATUS RtlUnicodeStringValidateEx(
  _In_ PCUNICODE_STRING SourceString,
  _In_ DWORD            dwFlags
);

Parameters

SourceString [in]

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.

dwFlags [in]

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 codeDescription
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

Target platform

Desktop

Version

Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows.

Header

Ntstrsafe.h (include Ntstrsafe.h)

Library

Ntstrsafe.lib

IRQL

PASSIVE_LEVEL

See also

RtlUnicodeStringValidate
UNICODE_STRING

 

 

Send comments about this topic to Microsoft

Show: