PathAllocCombine function (pathcch.h)
Concatenates two path fragments into a single path. This function also canonicalizes any relative path elements, replacing path elements such as "." and "..".
This function differs from PathCchCombine and PathCchCombineEx in that it returns the result on the heap. This means that the caller does not have to declare the size of the returned string and reduces stack use.
This function differs from PathCombine in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.
<Syntax
WINPATHCCHAPI HRESULT PathAllocCombine(
[in] PCWSTR pszPathIn,
[in] PCWSTR pszMore,
[in] ULONG dwFlags,
[out] PWSTR *ppszPathOut
);
Parameters
[in] pszPathIn
A pointer to the first path string.
[in] pszMore
A pointer to the second path string. If this path begins with a single backslash, it is combined with only the root of the path pointed to by pszPathIn. If this path is fully qualified, it is copied directly to the output buffer without being combined with the other path.
[in] dwFlags
One or more of the following flags:
[out] ppszPathOut
The address of a pointer to a buffer that, when this function returns successfully, receives the combined path string. It is the responsibility of the caller to free this resource, when it is no longer needed, by calling the LocalFree function. This value cannot be NULL.
Return value
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
While either pszPathIn or pszMore can NULL, they cannot both be NULL.
This function supports these alternate path forms:
- \\?\
- \\?\\UNC\
- \\?\Volume{guid}\
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2012 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | pathcch.h |
Library | Pathcch.lib |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for