unit PathGetLongName_Unit;
interface
uses
Windows, SysUtils;
function PathGetLongName(const ShortPath: String): String;
implementation
type
TGetLongPathName = function(lpszShortPath, lpszLongPath: PChar;
cchBuffer: DWORD): DWORD; stdcall;
// -----------------------------------------------------------------------------
function PathGetLongName(const ShortPath: String): String;
var
GetLongPathName: TGetLongPathName;
hKernel32: THandle;
begin
hKernel32 := LoadLibrary(kernel32);
try
GetLongPathName := GetProcAddress(hKernel32, 'GetLongPathNameA');
if not Assigned(GetLongPathName) then
RaiseLastWin32Error;
SetLength(Result, GetLongPathName(PChar(ShortPath), nil, 0));
SetLength(Result, GetLongPathName(PChar(ShortPath), PChar(Result),
Length(Result)));
finally
FreeLibrary(hKernel32);
end; {end try/finally}
end; {end function}
// -----------------------------------------------------------------------------
end.