FileSize doesn't work in WinCE
Original Reporter info from Mantis: sekelsenmat
-
Reporter name: Felipe Monteiro de Carvalho
Original Reporter info from Mantis: sekelsenmat
- Reporter name: Felipe Monteiro de Carvalho
Description:
The following code:
procedure TForm1.Button2Click(Sender: TObject);
begin
if FileExists('\Storage Card\wince\gdb.exe') then Caption := 'Exists';
Edit1.Text := IntToStr(FileSize('\Storage Card\wince\gdb.exe'));
end;
Shows that the file exists, but the result for FileSize is -1
Probably FindFirstFile doesnt return a correct size. The following code works:
var
AHandle: THANDLE;
Str: widestring;
begin
Str := '\Storage Card\wince\gdb.exe';
AHandle := Windows.CreateFileW(PWideChar(Str),
GENERIC_READ, FILE_SHARE_DELETE or FILE_SHARE_READ or FILE_SHARE_WRITE,
nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
Edit1.Text := IntToStr(Windows.GetFileSize(AHandle, nil));
Mantis conversion info:
- Mantis ID: 14360
- OS: Microsoft Windows
- OS Build: XP
- Platform: Intel Pentium 4
- Fixed in version: 0.9.27 (SVN)
- Fixed in revision: 21243 (#deead462)
- Target version: 0.9.28