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

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

Parameters

pszPath

A pointer to the path to search.

cchPath

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

ppszExt

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 | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header pathcch.h
Library Pathcch.lib