Recent

Author Topic: [SOLVED]Lazarus trunk: I can't use TFileVersionInfo  (Read 3667 times)

zoltanleo

  • Hero Member
  • *****
  • Posts: 512
[SOLVED]Lazarus trunk: I can't use TFileVersionInfo
« on: December 06, 2017, 08:07:46 am »
Hi friends

This code
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   info:TFileVersionInfo;
  4. begin
  5.   try
  6.     info:= TFileVersionInfo.Create(Application);
  7.     info.fileName:= Application.ExeName;
  8.     info.ReadFileInfo;// <== error here
  9.     Self.Caption:= Format('%s v.%s',
  10.     [info.VersionStrings.Values['ProductName'],info.VersionStrings.Values['ProductVersion']]);
  11.   finally
  12.     FreeAndNil(info);
  13.   end;
  14. end;

for fpc r.37610 I have ceased to display correctly Values ['ProductVersion'], and after updating to fpc r.37671 gives such error message
Code: Pascal  [Select][+][-]
  1. Project project1 raised exception class 'EReadError' with message:
  2. Stream read error
  3.  
  4.  At address 4338C9

For lazarus 1.8 RC5 this project is started correctly.

Somebody will be able to answer me, what has happened?
« Last Edit: December 06, 2017, 04:46:41 pm by zoltanleo »
Win10 LTSC x64/Deb 12 amd64(gtk2)/Kubuntu(qt5)/Darwin Cocoa x86_64 (Sequoia):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 3.0.11; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

Thaddy

  • Hero Member
  • *****
  • Posts: 18765
  • To Europe: simply sell USA bonds: dollar collapses
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #1 on: December 06, 2017, 08:39:36 am »
I can reproduce half of it with trunk under linux the ProductVersion  can not be read. Productname is read correctly.
On arm-linux it does not crash however, but does not give the ProductVersion at all.
Please file a bug report.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #2 on: December 06, 2017, 08:58:24 am »
This is already reported in the bugtracker : https://bugs.freepascal.org/view.php?id=32603

Thaddy

  • Hero Member
  • *****
  • Posts: 18765
  • To Europe: simply sell USA bonds: dollar collapses
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #3 on: December 06, 2017, 09:09:19 am »
Yes, I just found it. After reverting r37490 it indeed works again.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #4 on: December 06, 2017, 10:31:50 am »
fixed in r37685
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

Thaddy

  • Hero Member
  • *****
  • Posts: 18765
  • To Europe: simply sell USA bonds: dollar collapses
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #5 on: December 06, 2017, 10:56:25 am »
Tnx Maciej

One remark: can it be done outside the loop?
« Last Edit: December 06, 2017, 10:58:25 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #6 on: December 06, 2017, 11:02:07 am »
hm. Only #32603 is fixed. The presented problem is different. I will look into.
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: Lazarus trunk: I can't use TFileVersionInfo
« Reply #7 on: December 06, 2017, 11:23:28 am »
The second problem fixed in r37687. Loop is rather needed for big endian platforms and length of string can't be determined by "toread" value and must be discovered by looking for #0.
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

 

TinyPortal © 2005-2018