ADD: Overlong path support in several functions

This commit is contained in:
Alexander Koblov 2016-08-19 22:19:57 +00:00
commit bb1bdcbab2
2 changed files with 9 additions and 9 deletions

View file

@ -232,7 +232,7 @@ uses
fConfirmCommandLine, uLog, DCConvertEncoding, LazUTF8
{$IF DEFINED(MSWINDOWS)}
, JwaWinCon, Windows, uNTFSLinks, uMyWindows, JwaWinNetWk,
uShlObjAdditional, shlobj
uShlObjAdditional, shlobj, DCWindows
{$ENDIF}
{$IF DEFINED(UNIX)}
, BaseUnix, Unix, uMyUnix, dl
@ -494,10 +494,10 @@ begin
end;
{$ELSE}
var
wPath: WideString;
wPath: UnicodeString;
begin
wPath:= UTF8Decode(Path);
Result:= GetDiskFreeSpaceExW(PWChar(wPath), FreeSize, TotalSize, nil);
wPath:= UTF16LongName(Path);
Result:= GetDiskFreeSpaceExW(PWideChar(wPath), FreeSize, TotalSize, nil);
end;
{$ENDIF}

View file

@ -392,16 +392,16 @@ var
cchBuffer: DWORD;
begin
Result:= False;
wsLongPath:= UTF8Decode(sLongPath);
wsLongPath:= UTF16LongName(sLongPath);
cchBuffer:= GetShortPathNameW(PWideChar(wsLongPath), nil, 0);
if cchBuffer = 0 then Exit;
SetLength(wsShortPath, cchBuffer);
cchBuffer:= GetShortPathNameW(PWideChar(wsLongPath), PWideChar(wsShortPath), cchBuffer);
if cchBuffer <> 0 then
begin
sShortPath:= AnsiString(wsShortPath);
Result:= True;
end;
begin
sShortPath:= AnsiString(wsShortPath);
Result:= True;
end;
end;
function GetFileOwner(const sPath: String; out sUser, sGroup: String): Boolean;