Results 1 to 5 of 5

Thread: How to edit internal data in a executable

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to edit internal data in a executable

    Hello!

    I pretend to something but I'm not sure if it will work. The idea is the following:

    I developed a software that should read texts from a .txt file but thoose text may be expanded by the user. For the time being, I insert the .txt files in a Resource File and always when I need to uptade the files everything that I do is to update the file in the resource and recompile.

    But imagine that I want it to be a final product and I want to use only the executable, so the data will be in it. How could I change thoose texts without having to create a way for the software to consult an external folder? Is there such a way or, in case of needing to do such updates, I will have to compile it with a code pointing to a external folder (external to the .exe)?

    I hope you understood my point. Any case, just ask.

    Thanks,

    Momergil

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to edit internal data in a executable

    Any data embedded in your application via Qt resource system is essentially read-only. If you reserved enough space in embedded file you might be able to write back changes to the binary but that would be rather complicated because most operating systems frown upon this practice (besides I seem to remember that resources can be stored in a compressed form which could make "space reservation difficult).

    The generally accepted way of storing read/write application data is to place it in the filesystem, either in a location relative to the executable or in some (platform-specific) absolute location dedicated to that purpose (e.g /usr/share on Unix).
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to edit internal data in a executable

    Even if you could edit the executable on-the-fly, which is what you are asking for, the operating system will block most attempts because of file permissions and anti-virus/anti-trojan software will probably block any remaining attempts.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to edit internal data in a executable

    Moreover resources in the binary are in a compressed form (unless you explicitly disable compression) thus it would practically be impossible to append something to the compressed stream.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to edit internal data in a executable

    Windows only ->. Read about Exe-holes/Exe-dens on reverse engineering forums. Take a look at how "Installer programs" works, they have a exe and at the end of the that normal exe they append data.

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 19:06
  2. QTableView with QSqlTableModel - change widget for edit data
    By elektrrrus in forum Qt Programming
    Replies: 3
    Last Post: 24th February 2011, 15:51
  3. Replies: 1
    Last Post: 3rd April 2010, 15:47
  4. Data from TableModel and into Text Edit
    By Nefastious in forum Newbie
    Replies: 1
    Last Post: 16th September 2009, 02:36
  5. Replies: 1
    Last Post: 1st March 2006, 11:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.