Results 1 to 15 of 15

Thread: Question regarding the final .exe

  1. #1
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Question regarding the final .exe

    Ok, so I have a program which make use of resources like images , big pdf files (through poppler) etc. etc. Now, when I compile the program in release mode, I get a single .exe file as the end-result. This is understandable since all files I mentioned above (images, pdfs) are part of the resource and thus gets embedded into the final .exe upon compilation. However, I'm looking to do something else. What I want is :

    -> I want the final .exe and resource files to be separate. However, it should be in such a manner that the image and pdf files cannot be readable by the user(it should be in some binary form etc.)..

    Possible?

    Any assistance would be appreciated.

    Regards.

  2. #2
    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: Question regarding the final .exe

    You can have the files encrypted, for example in a SQLite database. You can look in our wiki how to use encrypted SQLite databases. Just be aware that if you store the encryption key in your program, someone could extract it and decrypt the database.
    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.


  3. #3
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by wysota View Post
    You can have the files encrypted, for example in a SQLite database. You can look in our wiki how to use encrypted SQLite databases. Just be aware that if you store the encryption key in your program, someone could extract it and decrypt the database.
    Thanks for the quick response.

    I think encrypting them would be fine because I'm not actually looking for a high level security measure. What I want is that my files should be not so easily readable (easy as in going to the main folder of the program and retrieving all the .pdf and images just like that)...

    [BTW, just so you might be curious why I want to do something like this, my program is a mini encyclopedia about underwater animals. It will have A LOT of .mp3, pdf , images files. I do not want them to all be compiled into single .exe.]

    However, if you have any other alternative, please feel free to post.

    Regards.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Is there any particular reason why you don't want them compiled into the EXE? This would indeed be the easiest way of doing it and it would protect people from just using the files themselves. The data wouldn't be encrypted, but there would be no filenames, so you would not be able to extract them easily.

    Note that only the required resources are loaded at runtime, the others are loaded as and when necessary, so your file can easily be 100MB+ without worry

    Other alternatives would be archive formats like ZIP - you could encrypt the archive and only your program knows the password (but anyone with enough time can figure out the password from your exe). Going further, you could name all your files 0000, 0001, etc, and have a DB which maps the file you want to the file number.

  5. The following user says thank you to squidge for this useful post:

    el33t (14th August 2011)

  6. #5
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by squidge View Post
    Note that only the required resources are loaded at runtime, the others are loaded as and when necessary, so your file can easily be 100MB+ without worry
    Ok, now that clear things up for me. I was in the misunderstanding that all the files get loaded up during run-time...

    Ok, so suppose I have ~ 1 GB of mixed resources(pdf, image, mp3, vid etc...) , once I release my program, will I get a single .exe of ~ 1 GB? Is that right?

  7. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Yes, but I wouldn't create an executable file of 1GB. If you really need that more storage then a better way would be a seperate file.

    Otherwise, every time you adjust your executable, the linker has to deal with ~1GB of resource data.

  8. #7
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by squidge View Post
    If you really need that more storage then a better way would be a seperate file.
    Hmmm.... So if I decide to separate my exe and resource files, which is the easiest method you recommend?

  9. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Easiest? Probably a password protected ZIP file. Quite easy to find the password however as you'll be passing it plain text through libraries.
    Most secure? Your own archive format (no prewritten software for unpacking it then, anyone wishing to have the data has to write their own)

  10. #9
    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: Question regarding the final .exe

    I think there is a way to have an external resource file and attach it to your exe during runtime. Have a look at External Binary Resources section in the docs.
    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.


  11. The following user says thank you to wysota for this useful post:

    el33t (14th August 2011)

  12. #10
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Nice wysota. That would give a sort of transparent ZIP functionality. I don't think you can encrypt such resources though, so you'll have to do it yourself once the appropriate file has been loaded?

  13. #11
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by wysota View Post
    I think there is a way to have an external resource file and attach it to your exe during runtime. Have a look at External Binary Resources section in the docs.
    I'll give it a look. Thanks.

  14. #12
    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: Question regarding the final .exe

    Quote Originally Posted by squidge View Post
    Nice wysota. That would give a sort of transparent ZIP functionality. I don't think you can encrypt such resources though, so you'll have to do it yourself once the appropriate file has been loaded?
    I think the OP doesn't really want encryption but rather a blob-like solution where he can throws all his files into and prevent (l)users from messing around with them too easily. If you want encryption then you either need to encrypt the contents of each file separately before placing it in the resource or encrypt the whole resource file and decrypt it on the fly (which has an obvious drawback that anyone can access the decrypted version of the file).
    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.


  15. #13
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by wysota View Post
    I think the OP doesn't really want encryption but rather a blob-like solution where he can throws all his files into and prevent (l)users from messing around with them too easily. If you want encryption then you either need to encrypt the contents of each file separately before placing it in the resource or encrypt the whole resource file and decrypt it on the fly (which has an obvious drawback that anyone can access the decrypted version of the file).
    Yes, this is what I want. Nothing much fancy like encryption.

    Ok, so I used external binary resources by following the instructions in the official documentation but here's the problem. The program compiled fine and all the resources worked fine in-program. However what I was expecting was to get a single file (maybe a .dat or a .bin or something like that...) containing all the resources mentioned in my .qrc file. If something like this was possible, then I could just pack the main .exe along with this .dat/.bin file whatever and off coarse the other qt .dlls like qtcore.dll etc...

    The reason I'm doing all this is because I don't want my .exe to be something like 1-2GB (Since I'll be using a lot of heavy resources like videos and audios). And on the other hand, I don't want people to leech my resources from the main folder just like that...

  16. #14
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Don't you get an RCC file containing all your resources? So you just have EXE + RCC ?

  17. The following user says thank you to squidge for this useful post:

    el33t (20th August 2011)

  18. #15
    Join Date
    Jul 2010
    Posts
    34
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question regarding the final .exe

    Quote Originally Posted by squidge View Post
    Don't you get an RCC file containing all your resources? So you just have EXE + RCC ?
    Yes, you are right...... My problem is now solved. And sorry for the extremely late reply....

    THANKS A LOT ALL THOSE ABOVE WHO TOOK THEIR PRECIOUS TIME TO ASSIST ME WITH MY PROBLEM. REGARDS

Similar Threads

  1. final version can't open jpeg
    By 93interactive in forum Installation and Deployment
    Replies: 4
    Last Post: 6th August 2009, 22:10
  2. How to see the final request from QNetworkRequest
    By krippy2k in forum Qt Programming
    Replies: 13
    Last Post: 7th June 2009, 21:37

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.