LCL: FileSize function

fixed compilation for wince
fixed handle leak for all windows platforms

git-svn-id: trunk@16768 -
This commit is contained in:
vincents 2008-09-27 12:29:45 +00:00
parent 8541afd7f9
commit b1927940a7

View File

@ -839,13 +839,18 @@ begin
exit(-1);
Result:=st.st_size;
{$ELSE}
{$IFDEF WINCE}
FileInfo.Name:=UTF8Decode(Filename);
{$ELSE}
FileInfo.Name:=UTF8ToSys(Filename);
FileInfo.FindHandle:=Windows.FindFirstFile(PChar(FileInfo.Name),FileInfo.FindData);
{$ENDIF}
FileInfo.FindHandle:=Windows.FindFirstFile(Windows.LPTSTR(FileInfo.Name),FileInfo.FindData);
if FileInfo.FindHandle=Windows.Invalid_Handle_value then begin
Result:=-1;
exit;
end;
Result:=(int64(FileInfo.FindData.nFileSizeHigh) shl 32)+FileInfo.FindData.nFileSizeLow;
Windows.FindClose(FileInfo.FindHandle);
{$ENDIF}
end;