StrCpyW function (shlwapi.h)

Copies one string to another.

Note  Do not use. See Remarks for alternative functions.
 

Syntax

PWSTR StrCpyW(
  [out] PWSTR  psz1,
  [in]  PCWSTR psz2
);

Parameters

[out] psz1

Type: PTSTR

A pointer to a buffer that, when this function returns successfully, receives the copied string. This string is not guaranteed to be null-terminated.

[in] psz2

Type: PCTSTR

A pointer to the null-terminated source string.

Return value

Type: PTSTR

Returns a pointer to psz1.

Remarks

Security Warning:  Using this function incorrectly can compromise the security of your application. The first argument, psz1, must be large enough to hold psz2 and the closing '\0', otherwise a buffer overrun may occur. Buffer overruns may lead to a denial of service attack against the application if an access violation occurs. In the worst case, a buffer overrun may allow an attacker to inject executable code into your process, especially if psz1 is a stack-based buffer. Consider using one of the following alternatives: StringCbCopy, StringCbCopyEx, StringCbCopyN, StringCbCopyNEx, StringCchCopy, StringCchCopyEx, StringCchCopyN, or StringCchCopyNEx. You should review Security Considerations: Microsoft Windows Shell before continuing.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)