Lazarus
Home
Forum
Help
TinyPortal
Search
Login
Register
Lazarus
»
Programming
»
General
»
[SOLVED] Full handling of text files integrated in exe file
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
FAQ
Wiki
Bugtracker
Packages
IRC channel
Developer Blog
Follow us on Twitter
Latest SVN
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
Search
Advanced search
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Full handling of text files integrated in exe file (Read 2535 times)
yurkad
Full Member
Posts: 107
[SOLVED] Full handling of text files integrated in exe file
«
on:
May 17, 2017, 05:01:45 pm »
The first part of this problem is integrate any files to exe file. This is solved here:
https://www.thoughtco.com/inside-the-delphi-exe-1058211
Second part of this problem is get some text file from exe file and put it in disc or in memory for edit.
Third part of this problem is insert edited text file back in exe file.
One variant of this can be simple: concatenate all files into exe file. But after this is necesary know point of begin for each file. This point will be change each time.
So is necesary have several variables from exe, which can be changed and saving in exe file after runtime.
Each operation (integration and getting text files and editing them) will make same app from exe file.
So, please, how can be solve this problem?
«
Last Edit: June 09, 2017, 05:20:35 pm by yurkad
»
Logged
sky_khan
Guest
Re: Full handling of text files integrated in exe file
«
Reply #1 on:
May 17, 2017, 05:35:35 pm »
The link you gave does not "concatenate all files". It modifies resources of executable by WinAPI. If you're on Windows you can read or update any resource by its ID or name individually, again, by WinAPI.
Your question is so generic. Dont be lazy and try to write it yourself first.
I reject to give an answer until I see some of your own code
Logged
yurkad
Full Member
Posts: 107
Re: Full handling of text files integrated in exe file
«
Reply #2 on:
May 17, 2017, 05:42:29 pm »
@SkyKhan, you say, that
Quote
you can read or update any resource by its ID or name individually
If realmente can be update in runtime any resource by its ID, then it is solution.
I will search about "update in runtime resource".
Thanks.
Logged
yurkad
Full Member
Posts: 107
Re: Full handling of text files integrated in exe file
«
Reply #3 on:
May 17, 2017, 05:54:35 pm »
It seems it can not be update resource in runtime.
Logged
Handoko
Hero Member
Posts: 2156
My goal: build my own game engine using Lazarus
Re: Full handling of text files integrated in exe file
«
Reply #4 on:
May 17, 2017, 06:09:26 pm »
This is an interesting topic. So I googled the web. They said it can.
http://stackoverflow.com/questions/13218777/can-i-edit-resource-file-at-runtime
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648049%28v=vs.85%29.aspx
I will be happy if it can also be used on Linux. I ever had similar case, which I solved using a not-so-good trick:
http://forum.lazarus.freepascal.org/index.php/topic,36674.msg244647.html#msg244647
Logged
sky_khan
Guest
Re: Full handling of text files integrated in exe file
«
Reply #5 on:
May 17, 2017, 08:45:36 pm »
On windows, you can read or update any resource by its ID or name individually of an executable...
but not while it is running. At least without using dirty hacks.
Besides, if you install your self-modifying application in "Program Files" your users will not have write permission for it.
So if you want to write an application like an IDE or like a compiler which creates/modifies executables other than itself you can use WinAPI to do it.
Otherwise you really should store your settings/texts elsewhere like in a normal data file in User or AppData directory.
Logged
yurkad
Full Member
Posts: 107
Re: Full handling of text files integrated in exe file
«
Reply #6 on:
May 17, 2017, 10:19:14 pm »
@Handoko, @SkyKhan, thanks.
I will try to make something in Lazarus pure.
Logged
marcov
Global Moderator
Hero Member
Posts: 6099
Re: Full handling of text files integrated in exe file
«
Reply #7 on:
May 17, 2017, 10:35:48 pm »
you might want to have a look at FPC's fcl-res package.
Logged
yurkad
Full Member
Posts: 107
Re: Full handling of text files integrated in exe file
«
Reply #8 on:
May 18, 2017, 12:09:33 am »
@marcov, thank for advice.
Logged
sky_khan
Guest
Re: Full handling of text files integrated in exe file
«
Reply #9 on:
June 07, 2017, 09:33:34 pm »
Well, now you can use this
http://forum.lazarus.freepascal.org/index.php/topic,37142.msg248630.html#msg248630
Logged
yurkad
Full Member
Posts: 107
Re: Full handling of text files integrated in exe file
«
Reply #10 on:
June 09, 2017, 04:57:01 pm »
@sky_khan, thank you very much. I hope that this will close my question.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Programming
»
General
»
[SOLVED] Full handling of text files integrated in exe file
Recent
free pascal (none-lazarus...
by
pielago
[
Today
at 03:02:20 am]
different selections to i...
by
jamie
[
Today
at 02:53:23 am]
Visual Pascal Community E...
by
valdir.marcos
[
Today
at 02:03:05 am]
How do I get the PLAN fro...
by
RedOctober
[
Today
at 01:39:22 am]
Import excel to dbgird
by
wp
[
Today
at 01:13:02 am]
[SOLVED] What am I doing ...
by
cpicanco
[
Today
at 01:12:43 am]
What does this TGtk2Widge...
by
cpicanco
[
Today
at 01:00:28 am]
Material Design
by
lainz
[
Today
at 12:43:01 am]
New version of BGRABitmap
by
lainz
[
Today
at 12:41:47 am]
Blogs
by
RAW
[
Today
at 12:21:17 am]