Recent

Author Topic: Is there a way to modify resources of other application with lazarus on linux?  (Read 2786 times)

njlgg

  • Newbie
  • Posts: 6
lazarus provides "{$R *.res}" to compile resources into our application ,and we use TresourceStream.Create(HInstance,your_resource_flag,your_resource_type) to
retrieve resources.
On windows,we can use win32 API updateResource to modify resources of other application.On linux,the win32 API UpdateResource surely wouldn't work.So is there a way to modify resources of other application with lazarus on linux?

sash

  • Sr. Member
  • ****
  • Posts: 366
Formally no, because there's no such thing as "resource" in Linux, although ELF format allows arbitrary data sections, but those used by FPC is very FPC-specific.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
To complete what sash wrote:

It is possible to change resources in Windows because Windows' resources are added to the EXE file as "extra data".  They're not part of the actual program.

On Linux though resources are "translated" to constant data, as if you added a big CONST section to your sources, so they're part of the program itself.  If you need to change them you may need to recompile the program as pointers and sizes may change, and will specially if the program was compiled using any optimization.
« Last Edit: December 21, 2017, 09:38:18 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018