Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

PathCchAppendEx function

Appends one path to the end of another.

This function differs from PathCchAppend in that it allows for a longer final path to be constructed.

This function differs from PathAppend in that it accepts paths with "\\", "\\?\" and "\\?\UNC\" prefixes.

Note  This function, or PathCchAppend, should be used in place of PathAppend to prevent the possibility of a buffer overrun.

Syntax


HRESULT PathCchAppendEx(
  _Inout_   PWSTR pszPath,
  _In_      size_t cchPath,
  _In_opt_  PCWSTR pszMore,
  _In_      unsigned long dwFlags
);

Parameters

pszPath [in, out]

A pointer to a buffer that, on entry, contains the original path. When this function returns successfully, the buffer contains the original path plus the appended path.

cchPath [in]

The size of the buffer pointed to by pszPath, in characters.

pszMore [in, optional]

A pointer the path to append to the end of the path pointed to by pszPath. UNC paths and paths that begin with the sequence \\?\ are accepted and recognized as fully-qualified paths. These paths replace the string pointed to by pszPath instead of being appended to it.

dwFlags [in]

The following flag is recognized; otherwise, set this value to 0.

ValueMeaning
PATHCCH_ALLOW_LONG_PATHS
0x00000001

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

 

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT code, including the following.

Return codeDescription
E_INVALIDARG

Either pszPath or pszMore is NULL, cchPath is 0, or cchPath is greater than PATHCCH_MAX_CCH.

PATHCCH_E_FILENAME_TOO_LONG

The resulting string would exceed PATHCCH_MAX_CCH.

E_OUTOFMEMORY

The function could not allocate a buffer of the neccessary size.

 

Remarks

This function inserts a backslash between the two strings, if one is not already present.

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

PathCchAppend

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.