Export (0) Print
Expand All

PathCchFindExtension function

Searches a path to find its file name extension, such as ".exe" or ".ini". This function does not search for a specific extension; it searches for the presence of any extension.

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

Note  This function should be used in place of PathFindExtension to prevent the possibility of a buffer overrun.

Syntax


HRESULT PathCchFindExtension(
  _In_   PCWSTR pszPath,
  _In_   size_t cchPath,
  _Out_  PCWSTR *ppszExt
);

Parameters

pszPath [in]

A pointer to the path to search.

cchPath [in]

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

ppszExt [out]

The address of a pointer that, when this function returns successfully, points to the "." character that precedes the extension within pszPath. If no extension is found, it points to the string's terminating null character.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Pathcch.h

Library

Pathcch.lib

 

 

Community Additions

ADD
Show:
© 2014 Microsoft