[fpc-pascal] Re: Editing resource of executable

Reinier Olislagers reinierolislagers at gmail.com
Thu Aug 30 13:18:44 CEST 2012

On 30-8-2012 10:07, Mark Morgan Lloyd wrote:
> Krzysztof wrote:
> everything is in one file (and must be). My question is, exists any
>> commandline tool which can edit executable file for edit some resource
>> (like ResEdit or Restorator for Windows) which can be used by http
>> server?
> Let's see if we can get this straight. What you're basically looking for
> is something which can take one or more of the environment variables (or
> equivalent) that the web server knows about, and use it to "brand" the
> executable.
> This is probably going to be very much specific to the version of
> Windows that the client is running: it used to be possible to simply
> append data to an executable since there was an unambiguous file length
> in the header, but this obviously won't work if the file is checksummed
> or signed.
For my CheckRide remote control/end user screen sharing program, I
wanted to be able to let admins create a personalized copy that connects
to their own server, so I had the same problem.

Although FPC does provide functions to modify resources on Windows, I
didn't have much luck with it. Perhaps the situation has improved since
I last tried, it - haven't looked.

I turned to what Mark suggested: just slapping on some (zipped) extra
data after the exe. And yes, this messes with signing the executable etc.

If you want to investigate this path, have a look at
CheckRideResourceZipper.lpi (which is used to create the "unbranded",
standard resources in the build process)
CheckRideHelper.lpi (which demonstrates stamping/branding the resources)
CheckRide.lpi (which demonstrates unpacking and using the resources)
they all use the poormansresource.pas file

More information about the fpc-pascal mailing list