Skip to content

Latest commit

 

History

History
144 lines (109 loc) · 5.17 KB

nf-ntstrsafe-rtlstringcbcopyunicodestring.md

File metadata and controls

144 lines (109 loc) · 5.17 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:ntstrsafe.RtlStringCbCopyUnicodeString
RtlStringCbCopyUnicodeString function (ntstrsafe.h)
The RtlStringCbCopyUnicodeString function copies the contents of a UNICODE_STRING structure to a specified destination.
kernel\rtlstringcbcopyunicodestring.htm
kernel
04/30/2018
RtlStringCbCopyUnicodeString function
RtlStringCbCopyUnicodeString, RtlStringCbCopyUnicodeString function [Kernel-Mode Driver Architecture], kernel.rtlstringcbcopyunicodestring, ntstrsafe/RtlStringCbCopyUnicodeString, safestrings_1c916f4b-b084-4587-a867-998b789bd2fa.xml
ntstrsafe.h
Ntstrsafe.h
Desktop
Available starting with Windows XP with Service Pack 1 (SP1).
Ntstrsafe.lib
Any if strings being manipulated are always resident in memory, otherwise PASSIVE_LEVEL
Windows
RtlStringCbCopyUnicodeString
ntstrsafe/RtlStringCbCopyUnicodeString
APIRef
kbSyntax
LibDef
Ntstrsafe.lib
Ntstrsafe.dll
RtlStringCbCopyUnicodeString

RtlStringCbCopyUnicodeString function

-description

The RtlStringCbCopyUnicodeString function copies the contents of a UNICODE_STRING structure to a specified destination.

-parameters

-param pszDest [out]

A pointer to a buffer that receives the copied string. The string that the SourceString parameter's UNICODE_STRING structure points to is copied to the buffer at pszDest and terminated with a null character.

-param cbDest [in]

The size, in bytes, of the destination buffer that pszDest points to. The buffer must be large enough to contain the string and the terminating null character. The maximum number of bytes in the buffer is NTSTRSAFE_UNICODE_STRING_MAX_CCH * sizeof(WCHAR).

-param SourceString [in]

A pointer to a UNICODE_STRING structure that contains the string to be copied. The maximum number of bytes in the string is NTSTRSAFE_UNICODE_STRING_MAX_CCH * sizeof(WCHAR).

-returns

RtlStringCbCopyUnicodeString returns one of the following NTSTATUS values.

Return code Description
STATUS_SUCCESS
This success status means that source data was present, the string was copied without truncation, and the resultant destination buffer is null-terminated.
STATUS_BUFFER_OVERFLOW
This warning status means that the copy operation did not complete because of insufficient buffer space. The destination buffer contains a truncated, null-terminated version of the intended result.
STATUS_INVALID_PARAMETER
This error status means that the function received an invalid input parameter. For more information, see the following list.
 

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

  • The contents of the UNICODE_STRING structure are invalid.
  • The value in cbDest is larger than the maximum buffer size.
  • The destination buffer (which pszDest points to) is already full.
  • A buffer pointer is NULL.
  • The destination buffer's length is zero, but a nonzero length source string is present.
For information about how to test NTSTATUS values, see Using NTSTATUS Values.

-remarks

The RtlStringCbCopyUnicodeString function uses the destination buffer's size (which the cbDest parameter specifies) to ensure that the copy operation does not write past the end of the buffer.

If the source and destination strings overlap, the behavior of the function is undefined.

The SourceString and pszDest pointers cannot be NULL. If you need to handle NULL pointer values, use the RtlStringCbCopyUnicodeStringEx function.

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

-see-also

RtlStringCbCopyUnicodeStringEx

RtlStringCchCopyUnicodeString

UNICODE_STRING