PathCchAddExtension function (pathcch.h)
Adds a file name extension to a path string.
This function differs from PathAddExtension in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.
WINPATHCCHAPI HRESULT PathCchAddExtension( PWSTR pszPath, size_t cchPath, PCWSTR pszExt );
A pointer to the path string. When this function returns successfully, the buffer contains the string with the appended extension. This value should not be NULL.
The size of the buffer pointed to by pszPath, in characters.
A pointer to the file name extension string. This string can be given either with or without a preceding period (".ext" or "ext").
This function returns an HRESULT code, including the following.
||The function succeeded. Note that this also includes the case of an empty extension, such as a period with no characters following it. In that case, the original string is returned unaltered.|
||This value can be caused by several things, such as the pszPath param being set to NULL, the cchPath being set to 0 or a value greater than PATHCCH_MAX_CCH, or the extension string containing illegal characters or otherwise not being a valid extension.|
||The original string already has an extension.|
||The buffer is too small to hold the returned string.|
|Minimum supported client||Windows 8 [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2012 [desktop apps | UWP apps]|