The RtlUnalignedStringCbLengthW function is a version of the RtlStringCbLength function that accepts an unaligned pointer to a string of Unicode characters.
NTSTATUS RtlUnalignedStringCbLengthW( _In_ STRSAFE_PCUNZWCH psz, _In_ size_t cbMax, _Out_opt_ size_t *pcbLength );
Supplies a pointer to a buffer that contains a null-terminated string whose length RtlUnalignedStringCbLengthW will check.
Supplies the maximum number of bytes that are allowed in the buffer that psz points to, including the terminating NULL character. This value cannot exceed NTSTRSAFE_MAX_CCH * sizeof(WCHAR).
Optional. If the caller supplies a non-NULL address pointer, the function loads the address with the length, in bytes, of the string that is contained in the buffer that psz points to. The length does not include the string's terminating NULL character.
RtlUnalignedStringCbLengthW returns one of the following NTSTATUS values.
||This success status means the string that the psz parameter specified was not NULL, and the length of the string (including the terminating NULL character) was less than or equal to cbMax bytes.|
||This error status means the value in psz is NULL, cbMax is larger than NTSTRSAFE_MAX_CCH * sizeof(WCHAR, or psz is longer than cbMax.|
For information about how to test NTSTATUS values, see Using NTSTATUS Values.
The RtlUnalignedStringCbLengthW function is available for processor architectures, such as Itanium-based and x64-based, that cause alignment exceptions when software attempts to access unaligned data. On those processors, you can use RtlUnalignedStringCbLengthW instead of the RtlStringCbLength function to avoid alignment exceptions. (For processors that do not cause alignment exceptions, RtlUnalignedStringCbLengthW is equivalent to RtlStringCbLength.)
For more information about the safe string functions, see Using Safe String Functions.
|Windows version||Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows. Available in Windows XP with Service Pack 1 (SP1) and later versions of Windows.|
|Header||ntstrsafe.h (include Ntstrsafe.h)|