[Lazarus] Extracting a resource from an exe file & adding it back in

waldo kitty wkitty42 at windstream.net
Mon Oct 17 17:07:03 CEST 2011


On 10/17/2011 10:58, Sven Barth wrote:
> Am 17.10.2011 16:28, schrieb waldo kitty:
>> On 10/15/2011 10:48, Hans-Peter Diettrich wrote:
>>> Reinier Olislagers schrieb:
>>>> I want to give users an editor to edit a text file inside helped.zip &
>>>> save the changes back to the executable.
>>>
>>> You'll run into a couple of problems:
>>>
>>> - An executable cannot update itself (at runtime).
>>
>> why not? i have several projects that are in line to be ported to
>> FPC/Lazarus... they store certain config values within them which are
>> read and altered on each execution... why can we not do this now? what
>> is missing??
>
> On Linux there should be no problem (don't know about other POSIX systems), but
> on Windows there is the problematic point that the binary is opened as "share
> deny write" from Windows (that's why Lazarus generates a "lazarus.new.exe" when
> compiling itself). It could be though that you can open the executable within
> itself as writeable, I have never tried this, so it should work.

i'll have to take a look at that (very) old code and see how it does it... it 
may very well open the exe and hunt thru it (from back to front) looking for the 
data section in question...

>
> In sum: the problem is not on FPC side, but on OS side.

ahhh... ok... i was thinking that it was maybe something in the (new to me) 
executable format... what has been being used has been able to be done 
specifically due to the way and location that TP/BP stores constants in the exe ;)





More information about the Lazarus mailing list