#ifndef _NTSTRSAFE_H_INCLUDED_
#ifndef NTSTRSAFE_LIB_IMPL
#ifndef NTSTRSAFE_NO_UNICODE_STRING_FUNCTIONS
/*++
NTSTATUS
RtlUnicodeStringValidate(
_In_ PCUNICODE_STRING SourceString
);
Routine Description:
The RtlUnicodeStringValidate function checks the counted unicode string to make
sure that is is valid.
This function returns an NTSTATUS value. It returns STATUS_SUCCESS if the
counted unicode string is valid.
Arguments:
SourceString - pointer to the counted unicode string to be checked
Notes:
SourceString should not be NULL. See RtlUnicodeStringValidateEx if you require
the handling of NULL values.
Return Value:
STATUS_SUCCESS - SourceString is a valid counted unicode string
failure - the operation did not succeed
STATUS_INVALID_PARAMETER
- this return value is an indication that SourceString is not a valid
counted unicode string
It is strongly recommended to use the NT_SUCCESS() macro to test the
return value of this function.
--*/
NTSTRSAFEDDI
RtlUnicodeStringValidate(
_In_ PCUNICODE_STRING SourceString)
{
return RtlUnicodeStringValidateWorker(SourceString, NTSTRSAFE_UNICODE_STRING_MAX_CCH, 0);
}
View code on GitHub// ntstrsafe.h
NTSTRSAFEDDI RtlUnicodeStringValidate(
[in] PCUNICODE_STRING SourceString
);
View the official Windows Driver Kit DDI referenceNo description available.
The RtlUnicodeStringValidate function validates the contents of a UNICODE_STRING structure.
SourceString [in]A pointer to a UNICODE_STRING structure to be validated.
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:
For information about how to test NTSTATUS values, see Using NTSTATUS Values.
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.