Recent

Author Topic: How to include additional information into version info file?  (Read 14147 times)

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?

After managing to get the version info code in http://melander.dk/articles/versioninfo/ I'd like to know if its possible to get additional strings into the version file.

I tried adding additional strings to the StringFileInfo block in the application's .rc file but it always get's overwritten by the compile process.

If it wasn't overwritten would the custom strings added be present in the compiled program?

Is the format of that file a standard Microsoft format, or customized for Free Pascal?

Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

eny

  • Hero Member
  • *****
  • Posts: 1583
Re: How to include additional information into version info file?
« Reply #1 on: March 24, 2010, 04:01:21 pm »
Isn't it possible to create your own resource file and include it in the program?

(Brief explanation in the wiki.)
All posts based on: Win10 (Win64); Lazarus 1.8.0 'stable' (#56594 win64) unless specified otherwise...

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: How to include additional information into version info file?
« Reply #2 on: March 24, 2010, 04:09:41 pm »
I am not quite sure if it is the right one. I am looking to add some more strings to the .rc file as that is the one associated with version information. Are the contents of the .rc file combined with another file that I can edit?

Isn't it possible to create your own resource file and include it in the program?

(Brief explanation in the wiki.)
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

eny

  • Hero Member
  • *****
  • Posts: 1583
Re: How to include additional information into version info file?
« Reply #3 on: March 24, 2010, 04:58:18 pm »
A workaround that (to my big surprise) seems to work:
1. Enable version information in your project;
2. Check the contents of the generated project rc file and copy that to a different file
   and name that file for example 'myversioninfo.rc'
3. Disable version information in your project.
4. Include your custom resourcefile in the application's main sourcefile
5. Build the project with the newly created resourcefile.

I've tested it with this in my custom resource file (note the 3rd line that says ENY EXtra info):
Code: [Select]
1 VERSIONINFO
FILEVERSION 1,2,2,4
PRODUCTVERSION 1,2,2,4
{
 BLOCK "StringFileInfo"
 {
  BLOCK "040904E4"
  {
   VALUE "Comments", "Extra comments\000"
   VALUE "CompanyName", "Extra company\000"
   VALUE "ENY Extra Info", "Lazarus Info Demo\000"
   VALUE "FileDescription", "Description\000"
   VALUE "FileVersion", "1.2.2.4\000"
   VALUE "InternalName", "Extra internal names\000"
   VALUE "LegalCopyright", "COpyright\000"
   VALUE "LegalTrademarks", "Extra legal trademarks\000"
   VALUE "OriginalFilename", "Extra Original filename\000"
   VALUE "ProductName", "Extra product name\000"
   VALUE "ProductVersion", "1.2.2.4\000"
  }
 }
 BLOCK "VarFileInfo"
 {
  VALUE "Translation", 0x0409, 0x04E4
 }
}
« Last Edit: March 24, 2010, 05:00:19 pm by eny »
All posts based on: Win10 (Win64); Lazarus 1.8.0 'stable' (#56594 win64) unless specified otherwise...

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: How to include additional information into version info file?
« Reply #4 on: March 24, 2010, 07:22:45 pm »
I tried your approach and it worked.
Very nifty.

A few more replies like this and I will be a Lazarus uber guru ;D

A workaround that (to my big surprise) seems to work:
1. Enable version information in your project;
2. Check the contents of the generated project rc file and copy that to a different file
   and name that file for example 'myversioninfo.rc'
3. Disable version information in your project.
4. Include your custom resourcefile in the application's main sourcefile
5. Build the project with the newly created resourcefile.

I've tested it with this in my custom resource file (note the 3rd line that says ENY EXtra info):
Code: [Select]
1 VERSIONINFO
FILEVERSION 1,2,2,4
PRODUCTVERSION 1,2,2,4
{
 BLOCK "StringFileInfo"
 {
  BLOCK "040904E4"
  {
   VALUE "Comments", "Extra comments\000"
   VALUE "CompanyName", "Extra company\000"
   VALUE "ENY Extra Info", "Lazarus Info Demo\000"
   VALUE "FileDescription", "Description\000"
   VALUE "FileVersion", "1.2.2.4\000"
    .....
  }
 }
 BLOCK "VarFileInfo"
 {
  VALUE "Translation", 0x0409, 0x04E4
 }
}
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

vfclists

  • Hero Member
  • *****
  • Posts: 823
    • HowTos Considered Harmful?
Re: How to include additional information into version info file?
« Reply #5 on: March 30, 2010, 05:13:11 am »
I have posted the source for the finished code on my blog, hopefully it will be of some use to others, if there are no bugs lurking in it ;D.

http://devblog.brahmancreations.com/content/free-pascal-win32-versioninfopas.
Windows - Lazarus 1.0.8/FPC 2.6.0
Linux - Lazarus 1.4.4 /FPC 2.6.4

DonaldShimoda

  • Jr. Member
  • **
  • Posts: 75
    • Parallel Pascal Worlds
Re: How to include additional information into version info file?
« Reply #6 on: June 06, 2010, 10:54:12 pm »
I have posted the source for the finished code on my blog, hopefully it will be of some use to others, if there are no bugs lurking in it ;D.

http://devblog.brahmancreations.com/content/free-pascal-win32-versioninfopas.

I need some like this working on linux. I know i know linux files dont hold version info, and this is the reason for i still need it. :)