PathCommonPrefixA.3w

Langue: en

Version: Jun 2009 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

PathCommonPrefixA (SHLWAPI.@)

SYNOPSIS

int PathCommonPrefixA
 (
  LPCSTR lpszFile1,
  LPCSTR lpszFile2,
  LPSTR  achPath
 )

DESCRIPTION

Determine the length of the common prefix between two paths.

PARAMS

lpszFile1 [In] First path for comparison.

lpszFile2 [In] Second path for comparison.

achPath [Out] Destination for common prefix string.

RETURNS

The length of the common prefix. This is 0 if there is no common prefix between the paths or if any parameters are invalid. If the prefix is non-zero and achPath is not NULL, achPath is filled with the common part of the prefix and NUL terminated.

NOTES

A common prefix of 2 is always returned as 3. It is thus possible for the length returned to be invalid (i.e. Longer than one or both of the strings given as parameters). This Win32 behaviour has been implemented here, and cannot be changed (fixed?) without breaking other SHLWAPI calls. To work around this when using this function, always check that the byte at [common_prefix_len-1] is not a NUL. If it is, deduct 1 from the prefix.

IMPLEMENTATION

Defined in "shlwapi.h".

Implemented in "dlls/shlwapi/path.c".

Debug channel "shell".