Re: [fpc-pascal] Re: creating a standalone executable (eg: application installation file)

2010-01-12 Thread Andreas Schneider
I think if digital signing is required, using Windows Resources would be the 
better way. Now that I think about it, with FPC 2.4 that should even be 
possible on Linux (and other platforms). Many roads lead to rome :D


Am Dienstag 12 Januar 2010 14:17:21 schrieb Milan Marusinec:
> Andreas Schneider wrote:
> > Hi,
> >
> > that works the same as in Windows and can probably be done with every
> > executable format. Simply append the data to the end of the file and
> > store the offset or length of that data at the end. All you have to do
> > then is to let the program open "itself" (ParamStr(0)), seek to the end -
> > SizeOf(Integer), read that integer to know the offset of the data, seek
> > to that position, and read all you need from there. So essentially your
> > file looks like: 
> 
> Andreas,
> 
> Will this method work when the exe is digitally
> signed afterwards (or before) ?
> 
> (tough, for linux it doesn't matter)
> 
> Milan
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: creating a standalone executable (eg: application installation file)

2010-01-12 Thread Milan Marusinec

Andreas Schneider wrote:

Hi,

that works the same as in Windows and can probably be done with every 
executable format. Simply append the data to the end of the file and store the 
offset or length of that data at the end. All you have to do then is to let 
the program open "itself" (ParamStr(0)), seek to the end - SizeOf(Integer), 
read that integer to know the offset of the data, seek to that position, and 
read all you need from there. So essentially your file looks like:




Andreas,

Will this method work when the exe is digitally
signed afterwards (or before) ?

(tough, for linux it doesn't matter)

Milan

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: creating a standalone executable (eg: application installation file)

2010-01-12 Thread Milan Marusinec

Graeme Geldenhuys wrote:

* How does one create such a standalone application?
* How do you include the application executable and other resources
(text, image, sound files etc) inside such an installation executable?


Hello Graeme,

I did this on Windows in Delphi, but the principle is pretty
the same for linux app.

1. Create your own file structure archive format or
   pack all installation files inside one .zip
   (later you should be able to extract files in
memory from that .zip or own format file).

2. Use bin2obj.exe utility, to convert that .zip (or own)
   archive file into the pascal source code "Const statement".
   (eg. Const inst_arch : Array[0..xx] of byte = (0,1,2,...);).

3. Embed converted inst_arch constant into your app source code.
   (If you use is as {$I my_istall_file.inc}, you can rebuild
installation data file from outside the installer app src code).

4. On RunTime, map inst_arch (you know its size) to TStream
   and use it as the source memory file with all your installation
   stuff inside (text, image, sound files etc).

The whole installer is in fact just an ordinary app with embedded
data block through const statement.

If you want to see this kind of installer (on windows),
have a look at: http://www.crossgl.com/CrossGL-SnapDraw-Installer.exe

Milan


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal