start partial binary
David Wilson
dw at botanicus.net
Wed Mar 12 17:45:21 PDT 2008
On Wed, Mar 12, 2008 at 11:59 PM, Moritz Warning
<moritzwarning at _nospam_web.de> wrote:
> On Wed, 12 Mar 2008 19:33:29 -0400, Adam D. Ruppe wrote:
>
> > On Wed, Mar 12, 2008 at 11:21:27PM +0000, Moritz Warning wrote:
>
> >> Is that possible with D?
> >
>
> > I'm pretty sure this is an operating system thing. I don't think it can
> > be done on Linux, but on Windows, you might be able to do it with
> > resources embedded in the executable, just like you would with C
> > programs.
>
> Would be a neat feature if it would be possible (on Linux).
> The problem is to load only a part of the binary without the data payload.
> Loading data from the binary into RAM would be less of a problem.
>
One way is to simply concatenate the data onto the end of the binary,
and write a function to open a standard stream on the file and seek to
the start of the data. For example:
my.exe:
- <PE data>
- <ZIP file>
- <uint32 offset to first byte of zip file>
All a function needs to do is open and read the last 4 bytes, seek to
that position, and test for a zip signature. I'm pretty sure this
works for both PE and ELF, it's the way the Winzip self extractor
works, and some equivalent tools on Linux (I think info-zip provides
something similar).
More information about the Digitalmars-d
mailing list