Makes a copy of a string in newly allocated memory.
LWSTDAPI SHStrDupA( LPCSTR psz, LPWSTR *ppwsz );
A pointer to the null-terminated string to be copied.
A pointer to an allocated Unicode string that contains the result. SHStrDup allocates memory for this string with CoTaskMemAlloc. You should free the string with CoTaskMemFree when it is no longer needed.
In the case of failure, this value is NULL.
Returns S_OK if successful, or a COM error value otherwise.
This function will take either Unicode or ANSI strings as input, but the copied string is always Unicode.
The shlwapi.h header defines SHStrDup as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional, Windows XP [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|DLL||Shlwapi.dll (version 5.0 or later)|