* fixed findfirst,getfattr,setfattr.

git-svn-id: trunk@4109 -
This commit is contained in:
yury 2006-07-06 19:03:24 +00:00
parent 451063e187
commit 2ee656c1ad

View File

@ -347,6 +347,11 @@ procedure findfirst(const path : pathstr;attr : word;var f : searchRec);
var var
buf: array[0..MaxPathLen] of WideChar; buf: array[0..MaxPathLen] of WideChar;
begin begin
if path = ''then
begin
DosError:=3;
exit;
end;
fillchar(f,sizeof(f),0); fillchar(f,sizeof(f),0);
{ no error } { no error }
doserror:=0; doserror:=0;
@ -479,19 +484,27 @@ end;
procedure getfattr(var f;var attr : word); procedure getfattr(var f;var attr : word);
var var
l : longint; l : cardinal;
buf: array[0..MaxPathLen] of WideChar; buf: array[0..MaxPathLen] of WideChar;
begin begin
if filerec(f).name[1] = #0 then
begin
doserror:=3;
attr:=0;
end
else
begin
doserror:=0; doserror:=0;
AnsiToWideBuf(@filerec(f).name, -1, buf, SizeOf(buf)); AnsiToWideBuf(@filerec(f).name, -1, buf, SizeOf(buf));
l:=GetFileAttributes(buf); l:=GetFileAttributes(buf);
if l=longint($ffffffff) then if l = $ffffffff then
begin begin
doserror:=Last2DosError(GetLastError); doserror:=Last2DosError(GetLastError);
attr:=0; attr:=0;
end end
else else
attr:=l and $ffff; attr:=l and $ffff;
end;
end; end;
@ -503,11 +516,13 @@ begin
if (attr and VolumeID)<>0 then if (attr and VolumeID)<>0 then
doserror:=5 doserror:=5
else else
begin
AnsiToWideBuf(@filerec(f).name, -1, buf, SizeOf(buf)); AnsiToWideBuf(@filerec(f).name, -1, buf, SizeOf(buf));
if SetFileAttributes(buf,attr) then if SetFileAttributes(buf,attr) then
doserror:=0 doserror:=0
else else
doserror:=Last2DosError(GetLastError); doserror:=Last2DosError(GetLastError);
end;
end; end;
{****************************************************************************** {******************************************************************************