Scroll to navigation

PathRelativePathToA(3w) Wine API PathRelativePathToA(3w)


PathRelativePathToA (SHLWAPI.@)


BOOL PathRelativePathToA
LPSTR lpszPath,
LPCSTR lpszFrom,
DWORD dwAttrFrom,
LPCSTR lpszTo,
DWORD dwAttrTo


Create a relative path from one path to another.


lpszPath [Out] Destination for relative path.
lpszFrom [In] Source path.
dwAttrFrom [In] File attribute of source path.
lpszTo [In] Destination path.
dwAttrTo [In] File attributes of destination path.


TRUE If a relative path can be formed. lpszPath contains the new path FALSE If the paths are not relative or any parameters are invalid.


lpszTo should be at least MAX_PATH in length.
Calling this function with relative paths for lpszFrom or lpszTo may give erroneous results.
The Win32 version of this function contains a bug where the lpszTo string may be referenced 1 byte beyond the end of the string. As a result random garbage may be written to the output path, depending on what lies beyond the last byte of the string. This bug occurs because of the behaviour of PathCommonPrefix() (see notes for that function), and no workaround seems possible with Win32.
This bug has been fixed here, so for example the relative path from "\" to "\" is correctly determined as "." in this implementation.


Declared in "shlwapi.h".
Implemented in "dlls/shlwapi/path.c".
Debug channel "shell".
Oct 2012 Wine API