Menu

#128 Writable space in wrapper for custom data

Future
open
nobody
None
5
2018-10-25
2018-10-18
Craig
No

Hi there... Thanks for a really useful program.

I'd appreciate it if you could provide a way for me to write a block of data into the executable after compilation time, without destroying the integrity of the executable. I'd use the data space to write customisation/configuration data into the executable, so that my primary users could redistribute it to their client base with the config data already included.

According to some threads I have read, it is possible to append data to the end of a Windows executable, and the data is (usually) simply ignored... I tried this with my Launch4j exe file and got a message saying the jar was invalid - you must perform some check of the length of the file?

I have actually managed to write data to the splash bmp file, and it works well without interfering with the application. The exe can even write to itself while it is running, probably because it is actually the java application writing on the launcher/wrapper, not the wrapper writing directly on itself. The only problem with this approach is that the bmp is aesthetically compromised (a few rows of dark pixels). I don't actually need a splash image - my own program could draw a splash window - so the splash bmp would be a fine place to write if no one sw it. I tried setting the splash display time to zero seconds, but Launch4j objected to that.

Is there some way to add an arbitrarily large string or data chunk to the xml file and have that put into the exe? Failing that, can I keep the splash bmp but have it displayed for zero seconds?

I know config data is usually placed ina separate file, but the whole point of my program is that it can be run from a single exe without any complicated installation or uninstall process.

Regards,

Arcuate.

Related

Feature Requests: #128

Discussion

  • Grzegorz Kowal

    Grzegorz Kowal - 2018-10-23

    Hi,

    The output exe is still a zip (jar) file, so I'd recommend that you try manipulating it as a zip archive and update a file there instead of changing the exe.

    Best regards,
    Grzegorz

     
    • Craig

      Craig - 2018-10-24

      Hi there,

      I guess that could work, but I already have a solution writing to the
      splash bmp, which is relatively easy because the bmp is not compressed. You
      are proposing unzipping the exe, unzipping the jar, writing to something
      within the jar, and then trying to put it all back together. That's not all
      that different from writing my own Launch4j. Also, it may not be possible
      to write to the jar while it is running.

      I just need to be able to set the splash screen to show for zero seconds.
      There seems to be no reason to disallow this within Launch4j. The simplest
      solution for me might be to reverse compile Launch4j and change the
      requirement for the splash time to be >0. It is probably only one line of
      code.

      Regards,

      Craig.

      On Wed, Oct 24, 2018 at 7:09 AM Grzegorz Kowal grzegok@users.sourceforge.net wrote:

      Hi,

      The output exe is still a zip (jar) file, so I'd recommend that you try
      manipulating it as a zip archive and update a file there instead of
      changing the exe.

      Best regards,
      Grzegorz


      Status: open
      Group: Future
      Created: Thu Oct 18, 2018 11:43 AM UTC by Craig
      Last Updated: Thu Oct 18, 2018 11:43 AM UTC
      Owner: nobody

      Hi there... Thanks for a really useful program.

      I'd appreciate it if you could provide a way for me to write a block of
      data into the executable after compilation time, without destroying the
      integrity of the executable. I'd use the data space to write
      customisation/configuration data into the executable, so that my primary
      users could redistribute it to their client base with the config data
      already included.

      According to some threads I have read, it is possible to append data to
      the end of a Windows executable, and the data is (usually) simply
      ignored... I tried this with my Launch4j exe file and got a message saying
      the jar was invalid - you must perform some check of the length of the file?

      I have actually managed to write data to the splash bmp file, and it works
      well without interfering with the application. The exe can even write to
      itself while it is running, probably because it is actually the java
      application writing on the launcher/wrapper, not the wrapper writing
      directly on itself. The only problem with this approach is that the bmp is
      aesthetically compromised (a few rows of dark pixels). I don't actually
      need a splash image - my own program could draw a splash window - so the
      splash bmp would be a fine place to write if no one sw it. I tried setting
      the splash display time to zero seconds, but Launch4j objected to that.

      Is there some way to add an arbitrarily large string or data chunk to the
      xml file and have that put into the exe? Failing that, can I keep the
      splash bmp but have it displayed for zero seconds?

      I know config data is usually placed ina separate file, but the whole
      point of my program is that it can be run from a single exe without any
      complicated installation or uninstall process.

      Regards,

      Arcuate.

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/launch4j/feature-requests/128/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Feature Requests: #128

  • Craig

    Craig - 2018-10-24

    Hi there,

    I guess that could work, but I already have a solution writing to the splash bmp, which is relatively easy because the bmp is not compressed. You are proposing unzipping the exe, unzipping the jar, writing to something within the jar, and then trying to put it all back together. That's not all that different from writing my own Launch4j. Also, it may not be possible to write to the jar while it is running.

    I just need to be able to set the splash screen to show for zero seconds. There seems to be no reason to disallow this within Launch4j. The simplest solution for me might be to reverse compile Launch4j and change the requirement for the splash time to be >0. It is probably only one line of code.

    Regards,

    Craig.

     
  • Craig

    Craig - 2018-10-24

    As the first step in looking into the feasibility of unzipping the exe, I tried changing the exe extension to zip... The result was not a usable zip file.

     
  • Craig

    Craig - 2018-10-24

    Okay, I unzipped the exe using 7zip and found the contents of my jar file, but no sign of the Launch4j content, including the splash bitmap. Am I just not looking in the right place, or is your content ignored/discarded by the unzipper? In some ways, that would be ideal for me, because the licensing information in the exe wrapper cannot be overwritten without some fairly high-level skills.

    If you're not in a position to provide a writable space, I will look at modifying Launch4j myself (or starting from scratch, though it seems a shame to reproduce your efforts.) Is the source code available?

    Regards,

    Arcuate.

     
  • Craig

    Craig - 2018-10-25

    I got this working by decompiling and adding a second bitmap. You can close the ticket, thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.