Convert a short path in a long one in delphi

// Convert a short path in a long one

// declaration
function GetLongPathName(lpszShortPath: PChar; lpszLongPath: PChar;
cchBuffer: DWORD): DWORD; stdcall;

//implementation
function GetLongPathName; external kernel32 Name ‘GetLongPathNameA’;

// —————————————————————————–

function WinAPI_GetLongPathName(const ShortName: string): string;
begin
SetLength(Result, MAX_PATH);
SetLength(Result, GetLongPathName(PChar(ShortName), PChar(Result), MAX_PATH));
end;