Export (0) Print
Expand All

PathAllocCombine function

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.

Note  This function, PathCchCombine, or PathCchCombineEx, should be used in place of PathCombine.

Syntax


HRESULT PathAllocCombine(
  _In_opt_  PCWSTR pszPathIn,
  _In_opt_  PCWSTR pszMore,
  _In_      unsigned long dwFlags,
  _Out_     PWSTR *ppszPathOut
);

Parameters

pszPathIn [in, optional]

A pointer to the first path string.

pszMore [in, optional]

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 qualfied, it is copied directly to the output buffer without being combined with the other path.

dwFlags [in]

Either 0 or the following flag:

ValueMeaning
PATHCCH_ALLOW_LONG_PATHS
0x00000001

Allow the construction of \\?\ paths longer than MAX_PATH.

 

ppszPathOut [out]

The address of a pointer to a buffer that, when this function returns successfully, receives the combined path string. This can point to the same buffer as pszPathIn or pszMore. 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

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Pathcch.h

Library

Pathcch.lib

See also

PathCchCombine
PathCchCombineEx

 

 

Community Additions

ADD
Show:
© 2014 Microsoft