SFX.TXT September 2001 HOW TO CREATE AN EXECUTABLE SELF-EXTRACTING ARJ ARCHIVE: The command "ARJ y -je archive" will create a full featured self-extracting archive from an already built archive. The command "ARJ y -je1 archive" will create a smaller self-extracting archive. Syntax: ARJ y -je archive produces archive.exe ARJ lets users create multiple volume self-extracting archives. Syntax: ARJ y -je archive -v360K produces archive.exe, archive.e01, archive.e02 .... An alternative mode (-ve option) lets you create a multiple volume self-extracting archive where the volumes all end in .EXE. Only the first volume is the extractor module. The other volumes end in .EXE for use on an Internet download website. Netscape and Explorer will properly download .EXE files. Syntax: ARJ y -je archive -ve360K => archive.exe, arch001.exe, arch002.exe .... If the base archive name ends with a number, ARJ will use that number as the base volume number. Syntax: ARJ a name001 -je -ve1440 => name001.exe, name002.exe, name003.exe, .... Versions of ARJ before 2.71 and ARJ32 before 3.04 will not be able to process this alternately named multiple volume self-extractor. Under DOS systems other than 2.11, 3.2, 3.3, 4.0, 5.0, 6.x, and 7.0, you may have to rename the self-extract module to ARJSFX.EXE to do the extraction. More details are below. HOW TO CUSTOMIZE AN EXECUTABLE SELF-EXTRACTING ARJ ARCHIVE: It is possible to customize an ARJ self-extracting archive to execute command line options as if the user typed in the options. Upon execution, an ARJ self-extractor checks its DOS command line for any options that the user might have entered (ARJSFX -t). If the self-extractor does not find any options, it will look for the self-extractor archive comment. If the first line of the comment begins with two right parentheses, the self-extractor will execute any command options following the two right parentheses. More details are below. SELF-EXTRACTING ARJ ARCHIVE INFORMATION: The "-je" option causes ARJ/ARJ32 to create a self-extracting .EXE file instead of an .ARJ file. NOTE: A distribution license is required to distribute ARJ and ARJ32 self-extracting archives. A standard registration is not sufficient. ARJ has three self-extracting modules: ARJSFXJR, ARJSFX, ARJSFXV. ARJ32 has only one self-extracting module: ARJSFX32. The ARJSFX32 module is the Win32 equivalent of the ARJSFXV module. The ARJ modules differ in size and functionality. They also use different command syntax. Be careful not to mix up the commands for the different modules. The ARJSFXJR module is the smallest in size and is created with the "-je1" option. The ARJSFX module is larger and has more functionality. It is created with the "-je" option. The ARJSFXV and ARJSFX32 modules are the largest and support multiple volume self-extractors. The "-je -v" options are used to create an ARJSFXV self-extractor. The "-je" option is used to create an ARJSFX32 self-extractor. Examples: ARJ a archive c:\dir\*.* -je1 ARJ a archive file1 file2 file3 -je ARJ a a:archive -v1440 -je c:\dir\*.* ARJ32 a archive c:\dir\*.* -r -je The ARJSFX32 module will only extract on Win95/98/NT/2000 (Win32) operating systems. It will not function in single user DOS or in Windows 3.1. Therefore, it is highly recommended that all self-extracting archives created with ARJ32 be setup with the ANSI codepage ("-hy" option). ARJSFXJR, ARJSFX, ARJSFXV, ARJSFX32: This section contains information applicable to all of the SFX modules. The default SFX command is "-x" extract files with pathnames. All SFX modules have an identification string located in the first 1000 characters of the executable. The identification string is "aRJsfX" without the quotes and in the exact case. The SFX modules do not support compression method 4. The self-extractors uses the "-" character before all commands and switches. This allows extraction of files named e, l, etc. ARJ can create a self-extracting module without an intermediate archive file. The SFX modules will by default extract to relative/absolute path specs if the archive contains relative/absolute path specs. The options "-e", "-jf", and "-jf1" are used to build archives that have no paths or absolute paths. As of ARJ 2.10, the SFX executable modules except for ARJSFX32 are pre-compressed using LZEXE. This may cause false indications with EXE scanning programs showing that an ARJ SFX archive is a LZEXE compressed file. Only the executable header module is LZEXE compressed. The actual archive is ARJ compressed, of course. The LZEXE header is modified to avoid extraction by UNLZEXE type programs. UNLZEXE may truncate an ARJ self-extractor of its archive. ARJSFX32 is pre-compressed using UPX. See the ACKNOWLEDGEMENTS section for details. ARJSFXJR: This section contains information applicable only to the ARJSFXJR module. At SFX startup, the self-extracting archive will display any archive header comment followed the extraction of files. There are no user permission prompts. The ARJSFXJR module does not support text mode "-t1", garbled "-g" archives, ARJ-SECURITY, long filenames, embedded command options, or post extraction command execution. ARJSFXJR will automatically create directories as needed during extraction. It will not prompt for permission to create directories. It will NOT overwrite existing files unless the "-o" option is specified by the user. Without the "-o" option, this self-extractor will SKIP the extraction of files that already exist. Please note that using ARJ.EXE to convert an archive created by ARJ32.EXE may run into long filename and other related issues. ARJSFX, ARJSFXV: This section contains information applicable only to the ARJSFX and ARJSFXV modules. An option "-+" is provided to force ARJSFX/ARJSFXV to install longname files to a Windows 2000 and XP system. This does not work for a Windows NT system. ARJSFX, ARJSFXV, ARJSFX32: This section contains information applicable to the ARJSFX, ARJSFXV, and ARJSFX32 modules. At SFX startup, the self-extracting archive will display any archive header comment followed by a query to "Continue extraction?". This query can be suppressed by specifying the appropriate option ("-w" for ARJSFX and "-zm" for ARJSFXV/32). These modules support garbled archives "-g". The ARJSFX module does not support the use of the "-hg" option for stronger encryption. When extracting files with pathnames, these modules will prompt for permission to create new directories unless the "ok to create directory" option is specified. When extracting to already existing files, these modules will prompt for permission to overwrite the files unless the "ok to overwrite" option is specified. These modules support using the "-t" option along with an extraction command to provide a verify before extract feature. The ARJSFX, ARJSFXV, and ARJSFX32 modules support the ARJ-SECURITY envelope feature. The ARJ-SECURITY feature is only available as an add-on option. It is intended as a option for software developers. There is an option to skip the test for ARJ-SECURITY. The ARJSFX, ARJSFXV, and ARJSFX32 self-extractors now perform a simple virus damage check before extracting the self-extractor's archive. If damage is detected, the self-extractor will abort with an error message indicating possible damage. The same option to skip the ARJ-SECURITY check is used to skip the virus check. IMPORTANT: When executing an ARJSFX module on a system with the CONSOLE device set to RAW mode, the ARJSFX module will abort on user input to avoid hanging the system. Use of the "-y" switch on the command line will avoid the problem. ARJSFXV, ARJSFX32: This section contains information applicable only to the ARJSFXV and the ARJSFX32 modules. Garbled ARJSFXV and ARJSFX32 modules will automatically prompt the user for the needed password. Only these modules support archives garbled with the "-hg" and "-hg!" options for stronger encryption. Only these modules support multiple volume archives. These modules also support building a self-extracting multiple volume archive where all the volumes are .EXE files. Only the first volume is the extraction module. The other volumes are just plain ARJ archives. This can be helpful for generating archives to be placed on an Internet website. ARJ a -e -je -vea A:INSTALL c:\product\*.* It is strongly recommended that multiple volume self-extracting archives NOT be built by modifying an existing multiple volume archive. ARJSFX32: Only the ARJSFX32 module supports extracting archives that are setup for ANSI codepage extraction. ARJ32 a -hy -je INSTALL c:\product\*.* ANSI codepage extraction may be required to extraction files on systems with filenames that are not composed entirely of standard ALPHANUMERIC characters. It is STRONGLY RECOMMENDED that ARJSFX32 archives be set to ANSI codpage mode for compatibility with all Win32 operating systems. This may be become a required option for a future release. CUSTOMIZING SELF-EXTRACTOR BEHAVIOR (OPTIONS) (NOT ARJSFXJR): With this new release, users can control the behavior of a self-extracting archive by embedding command line options within the self-extracting archive. This allows the builder to make self-extracting archives that create directories by default or overwrite existing files and so on. The user may bypass the embedded command line by specifying any command line options at the DOS command prompt. Please note that if the user of the self-extracting archive specifies any command line options, the embedded options are ignored and the user specified options are executed. To implement this feature, you would insert the required command line as the first line of the ARJ archive comment. The beginning of the command line must be preceded by the two characters "))". Only the first 80 characters of the embedded command line will be processed. ARJ a INSTALL \PRODUCT\*.* -r -zCOMMENT.TXT Sample COMMENT.TXT comment file: )) C:\DIR\ -o -b To the user of this self-extracting archive, this installation will overwrite any existing files in your previous version of this software, you should make sure that you have backed up any data files before proceeding with this installation. The above text file sets the ARJSFX self-extractor to install to the C:\DIR directory and to overwrite any existing files. Please note that the specific switch letters may differ for the different ARJ self-extracting modules. Refer to the SFX command syntax summaries below. EXECUTE COMMAND AFTER SELF-EXTRACTION (NOT ARJSFXJR): The ARJSFX, ARJSFXV, and ARJSFX32 modules support post-extraction execution. The "-!" option allows the user to build a self-extractor which will execute a command after its files are successfully extracted. This option is best used with the embedded command line feature described in the previous section. The post extraction command MUST NOT contain any blanks if it is used in the embedded command line. If an extraction target directory is specified, the target directory will be prepended to the command. Example: )) C:\DIR\ -!SETUP.EXE The above example will cause the command "C:\DIR\SETUP.EXE" to be executed. Please note that the user will always be prompted by the self-extractor for permission to execute this command. This prompt is disabled for ARJ-SECURED self-extracting archives. CREATING ENCRYPTED SELF-EXTRACTING ARCHIVES The ARJSFX, ARJSFXV, and ARJSFX32 modules support extraction of encrypted/garbled archives. The ARJSFX module only supports the simple XOR encryption specified by the "-g" option without the "-hg" option. The ARJSFXV and ARJSFX32 modules support all of the ARJ garble/encryption options. However, to use the most secure encryption option "-g -hg", the ARJCRYPT.COM/ARJ32_C.DLL GOST encryption module is needed. It should be included in the encrypted archive. ARJSFXV needs the ARJCRYPT.COM module. ARJSFX32 needs the ARJ32_C.DLL module. The order of the files in the encrypted archive is important. The GOST encryption module must be unencrypted and must precede any encrypted files. The GOST module should NOT be in a subdirectory in the archive. ARJSFX example : ARJ a SFX FILE1 FILE2 -je -gabcde ARJSFXV examples: ARJ a SFX ARJCRYPT.COM ARJ a SFX FILE1 FILE2 -gabcde -hg ARJ y SFX -je -v ARJ a SFX FILE1 FILE2 -je -gabcde -hg! ARJSFX32 examples: ARJ32 a SFX ARJ32_C.DLL ARJ32 a SFX FILE1 FILE2 -gabcde -hg ARJ32 y SFX -je ARJ32 a SFX FILE1 FILE2 -je -gabcde -hg! It is important to use the "y" command to convert an existing archive to a self-extractor. Using the "a" command with the "-je" option will NOT convert an existing archive. The second ARJSFXV and ARJSFX32 examples illustrate the use of the 40 bit GOST encryption specified with the "-hg!" option. No additional module is required to use this moderate strength encryption option. Please note that the -v option is required to force use of the ARJSFXV module instead of the ARJSFX module. TABLE OF SUPPORTED FEATURES: FEATURE ARJSFXJR ARJSFX ARJSFXV ARJSFX32 --------------------------- -------- -------- -------- -------- Single User DOS support X X X Windows 9x/Me long names X X X Windows NT/2000/XP long names X Windows 2000/XP long names "-+" X X X Restore file DTC and DTA X X X Restore directory dates NT/2K X Compression mode "-m4" Chapters ARJ data damage protection ANSI style archive comments X X X Text mode supported X X X Prompt to continue? X X X Prompt to overwrite? X X X Prompt to create directory? X X X Prompt for password? X X Garble mode "-g" X X X Moderate encryption "-hg!" X X Strong encryption "-hg" X X Customized command options X X X ARJ-SECURITY X X X Multiple volumes X X ANSI codepage X ARJSFXJR COMMAND SYNTAX: The current commands ARJSFXJR supports are: Usage: ARCHIVE [-switch(es)] [drive:][directory\] Switches: n: set ARJSFXJR to NOT count as an error the skipping of files o: set ARJSFXJR to overwrite existing files *: suppress all display messages You can specify a target_directory or drive or both. However, you must specify the ending "\" or ":" symbol. ARCHIVE -o C:\SOFT\ -> self-extract into directory "C:\SOFT\" in overwrite mode. ARJSFX COMMAND SYNTAX: The current commands ARJSFX supports are: Usage: ARCHIVE [-command] [-switch(s)] [directory\] [file(s)] Commands: e: Extract files v: Verbosely list contents l: List contents x: eXtract files with pathname (default) t: Test contents Switches: a: show ANSI comments m: Make directories b: prompt for directory n: only New files c: skip time stamp Check o: Overwrite files d: display program option p: match with Pathname f: Freshen existing files s: skip Security check g: unGarble with password u: Update files i: no progress Indicator w: skip extract prompt k: long extract messages y: assume Yes on queries *: suppress all messages !: execute command option +: force longnames in Win2K/XP The "-b" option prompts the installing user for the name of the install directory. If a target directory is specified on the command line, it is used as the default install directory which the installing user may change. Note that the target directory must end in "\"; otherwise, it will be interpreted as a filename spec. Example: ARCHIVE C:\INST_DIR\ -b ARJSFXV AND ARJSFX32 COMMAND SYNTAX: The current commands that ARJSFXV and ARJSFX32 support are as follows (there is one exception for ARJSFX32): Usage: ARCHIVE [-command] [-switch(s)] [directory\] [file(s)] Commands: e: Extract files v: Verbosely list contents l: List contents x: eXtract files with paths (default) t: Test contents Switches: a: skip security check r: set Recover mode b: prompt for directory s: enable file Share mode c: skip time stamp Check u: Update files d: check Disk space w: Write to filename f: Freshen existing files y: assume Yes on all queries g: unGarble with password z: assume yes for the following queries h: display this screen a: append file, c: create dir i: no progress Indicator k: disk space check, m: ok to extract j: process Win9x archive n: new name prompt, o: overwrite file k: skip preset options r: erase type-ahead, v,w: go to next vol m: overwrite readonly #: start install at disk N n: only New files $: extract volume label o: set encryption module @: display program option p: match with Pathname !: execute command option +: force longname processing in Win2K For ARJSFX32, the "-j" option forces ANSI codepage mode extraction. This option is used when extracting an OEM codepage mode self-extracting archive to a system using foreign symbols in filenames. The "-k" option lets a user skip the embedded options without specifying any other options. The "-z" options are used as "-za", "-zk", or "-zak". The "-zw" option inhibits volume prompts when the archive is not on removable media. The "-zv" option inhibits all volume prompts. The "-#" option assumes that the first diskette is number ONE. The "-b" option prompts the installing user for the name of the install directory. If a target directory is specified on the command line, it is used as the default install directory which the installing user may change. Note that the target directory must end in "\"; otherwise, it will be interpreted as a filename spec. Example: ARCHIVE C:\INST_DIR\ -b USAGE EXAMPLES: Build an SFX module with absolute pathnames for extraction to the absolute pathnames: ARJ a -r -je -jf DISTRIB c:\product\*.* The user need only type "DISTRIB -y" to recreate automatically the "product" directory at the root directory of the C: drive. If the drive letter is not specified as below: ARJ a -r -je -jf DISTRIB \product\*.* The user need only type "DISTRIB -y" to recreate automatically the "product" directory at the root directory of the current drive. Build an SFX module with relative pathnames for extraction to relative pathnames: ARJ a -r -je DISTRIB \product\*.* The user need only type "DISTRIB -y" to recreate automatically the "product" subdirectory in the current directory. The user can recreate the "product" subdirectory in another directory by typing the command "DISTRIB -y directory_name\". Build an SFX module with relative pathnames for extraction to relative pathnames excluding the base directory: ARJ a -r -e1 -je DISTRIB \product\ *.* The user need only type "DISTRIB -y" to recreate automatically the files and subdirectories of the "product" directory in the current directory. Build an SFXJR module with filenames (no path specs). ARJ a -e -je1 DISTRIB \product\*.* The user need only type "DISTRIB" to extract automatically the entire contents of "DISTRIB.EXE" to the current directory. If you want to make a self-extracting module from an ARJ archive, use the "y" command. ARJ y software -je Build a self-extractor with a comment file. ARJ a INSTALL \product\*.* -r -zCOMMENT.TXT ACKNOWLEDGEMENTS: We wish to thank Fabrice BELLARD for LZEXE which is used to squish the ARJSFX, ARJSFXJR, and ARJSFXV modules. We also wish to credit the following authors for providing UPX which was used to compress the ARJSFX32 module. The Ultimate Packer for eXecutables Copyright (c) 1996-1999 Markus Oberhumer & Laszlo Molnar http://wildsau.idv.uni-linz.ac.at/mfx/upx.html http://www.nexus.hu/upx UPX is a portable, extendable, high-performance executable packer for several different executable formats. end of document