home *** CD-ROM | disk | FTP | other *** search
/ Freesoft 1999 February / Freesoft_1999-02_cd.bin / Recenz / Kompres / rar250.exe / rar / SFX.TXT < prev    next >
Text File  |  1999-01-10  |  24KB  |  639 lines

  1.  
  2.  ██████╗   █████╗  ██████╗      RAR version 2.50
  3.  ██╔══██╗ ██╔══██╗ ██╔══██╗     ~~~~~~~~~~~~~~~~
  4.  ██████╔╝ ███████║ ██████╔╝     Multifunctional Integrated Archive Manager
  5.  ██╔══██╗ ██╔══██║ ██╔══██╗     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6.  ██║  ██║ ██║  ██║ ██║  ██║     The Installation SFX for DOS User's Manual
  7.  ╚═╝  ╚═╝ ╚═╝  ╚═╝ ╚═╝  ╚═╝     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8.  
  9.  
  10.    1. SFX functionality overview.
  11.  
  12.    The SFX (SelF-eXtracting module) is the archive module used to extract
  13.    files when executed. It is in the form of a normal executable file.
  14.  
  15.    The RAR Archiver offers SFX-functionality which is significantly
  16.    enhanced over common SFX, as well as the possibility to create an SFX
  17.    archive, with an alternate SFX module from an external file.
  18.  
  19.    The alternate SFX module can be created by using the switch
  20.    '-sfx[<sfxfile>]' or the command 's[<sfxfile>]' when, in the optional
  21.    parameter <sfxfile>, you indicate the required SFX executable module.
  22.  
  23.    Several RAR SFX executable modules are currently available:
  24.       - the common SFX for DOS (default in the DOS version, file dos.sfx);
  25.       - the Installation SFX for DOS (file idos.sfx);
  26.       - the common SFX for OS/2 (default in the OS/2 version, file os2.sfx).
  27.  
  28.    In fact you may add your own RAR SFX executable module using unRAR
  29.    sources (e.g. for your particular OS or special needs).
  30.  
  31.  
  32.    2. The Installation SFX.
  33.  
  34.    As an alternative to the default SFX you may build an Installation
  35.    SFX which uses a powerful script language, providing original features:
  36.  
  37.      - fully configurable, friendly, menu-driven interface;
  38.      - check for free disk space before installation;
  39.      - request destination path to which to install files;
  40.      - installation status - file extraction progress bar,
  41.        completed percentage and other features.
  42.  
  43.    The Installation Script is a plain ASCII text file, which may be prepared
  44.    using your favorite text editor.  The script is placed in the SFX 
  45.    archive comment to be processed by the Installation SFX module when it 
  46.    is executed.  For example, you may use the following command line to
  47.    create such an SFX archive: 
  48.  
  49.      rar a -sfxidos.sfx -zmyinst.s minstall
  50.  
  51.    Where 'idos.sfx' is the pathname of Installation SFX module and the file
  52.    myinst.s is the text file containing your installation script.
  53.  
  54.    The Installation SFX contains build-in interpreter of the Script
  55.    Language.
  56.  
  57.  
  58.    2.1 Installation Script Language
  59.  
  60.    As a program language the script contains the following objects:
  61.  
  62.      Command    statement initiating an action;
  63.  
  64.      Procedure  commands defined apparently to be called from the main
  65.                 script code;
  66.  
  67.      Function   built-in procedure which returns a value;
  68.  
  69.      Constant   character string or a numeric value (4 bytes length);
  70.  
  71.      Variable   name defining a storage place for a value.
  72.  
  73.    Variables may be assigned a numeric value or a character string.
  74.    All variables are global, meaning once defined the variable is the
  75.    same within the main code and all procedures.
  76.  
  77.    Variable and procedure names are case-sensitive.
  78.    Command statements are case-insensitive.
  79.  
  80.    Command and built-in procedures may be called with parameters -
  81.    constants and variables.  Expressions may not be used as parameters.
  82.  
  83.  
  84.    2.1.1. Control commands
  85.  
  86.    CALL        Initiate a procedure call:
  87.  
  88.                CALL <ProcName>
  89.  
  90.                <ProcName> is the procedure name (defined with PROC).
  91.  
  92.  
  93.    DELAY       Suspend script execution:
  94.  
  95.                DELAY [<ms>]
  96.  
  97.                <ms> is the delay interval (milliseconds).  If the interval
  98.                is ommitted, an infinite interval will be set.  Execution
  99.                continues following a key press or mouse click.
  100.  
  101.  
  102.    EXCLUDE     Define the list of files NOT to be extracted from the archive
  103.                while installing:
  104.  
  105.                EXCLUDE [ <File1> [, <File2>..] ]
  106.  
  107.                <File1>, <File2>.. are variables or character strings
  108.                containing the names of files to be excluded.  Wildcards are
  109.                permitted.
  110.  
  111.                The initial value of this file list is "", meaning "no files
  112.                to exclude".  EXCLUDE without any parameters would restore the
  113.                initial value of the file list.
  114.  
  115.  
  116.    EXIT        Terminate the Installation SFX:
  117.  
  118.                EXIT <Code>
  119.  
  120.                SFX exits with errorlevel = <Code>.
  121.  
  122.  
  123.    GOTO        Transfer control to a string in the script, identified
  124.                by a label:
  125.  
  126.                GOTO <Label>
  127.  
  128.                <Label> is the name in the script followed by a colon ':'
  129.                character.  For example:
  130.  
  131.                GOTO Menu
  132.                ...
  133.                Menu:
  134.  
  135.  
  136.    IF          Conditionally execute commands:
  137.  
  138.                IF <Var> <?> <Value>
  139.                      <commands>
  140.                      ...
  141.                ENDIF
  142.  
  143.                Control flow statement that defines conditional execution of
  144.                the statements within the block IF...ENDIF structure.  <Var>
  145.                is a variable to be compared with the <Value> using a single
  146.                comparison operator, if the result of the comparison is TRUE
  147.                then the statements within the IF...ENDIF are executed.
  148.  
  149.                Comparison operators are:-
  150.  
  151.                '=='  ..  EQUAL TO
  152.                '!='  ..  NOT EQUAL TO
  153.                '>'   ..  GREATER THAN
  154.                '>='  ..  GREATER THAN OR EQUAL TO
  155.                '<'   ..  LESS THAN
  156.                '<='  ..  LESS THAN OR EQUAL TO
  157.  
  158.                <Value> is a constant or variable.
  159.                Character values may be compared using only the '==' or '!='
  160.                comparison operations.
  161.  
  162.  
  163.    IFEXIST     Conditional execution where condition is a file existence.
  164.  
  165.                IFEXIST <file name>
  166.                      <commands>
  167.                      ...
  168.                ENDIF
  169.  
  170.                where <file name> is a file name.
  171.  
  172.  
  173.    INCLUDE     Define the list of files to be extracted from the archive
  174.                while installing:
  175.  
  176.                INCLUDE [ <File1> [, <File2>..] ]
  177.  
  178.                <File1>, <File2>.. are variables or character strings
  179.                containing the names of files to be extracted. Wildcards 
  180.                permitted.
  181.  
  182.                The initial value of this file list is "*.*" meaning
  183.                "all files in the archive".  The first INCLUDE defined will
  184.                replace the default value with the specified value.  All 
  185.                further INCLUDE's will add file names to the list without 
  186.                removing previous values.
  187.                To clear all the file names in the INCLUDE list, give the 
  188.                INCLUDE statement without parameters.
  189.  
  190.  
  191.    INSTALL     Begin installation.  If no INSTALL statement is given,
  192.                installation will begin when the end of main script code
  193.                is reached.
  194.  
  195.  
  196.    OVERWRITE   Set overwrite mode when extracting archived files:
  197.  
  198.                OVERWRITE { ON | OFF | FRESH | UPDATE }
  199.  
  200.                ON      always overwrite existing files
  201.                OFF     never overwrite existing files
  202.                FRESH   only overwrite files which exist in the destination
  203.                        directory and are newer in the archive
  204.                UPDATE  As for FRESH but also extract files which do not 
  205.                        exist in the destination directory
  206.  
  207.  
  208.    PROC        Define a procedure:
  209.  
  210.                PROC <ProcName>
  211.                     <commands here>
  212.                     ...
  213.                ENDP
  214.  
  215.                <ProcName> is the procedure name.  May be called with the
  216.                CALL statement - commands between PROC and ENDP would be
  217.                processed.
  218.  
  219.  
  220.    SOUND       Produce sounds on the PC speaker:
  221.  
  222.                SOUND <F1>, <D1> [, <F2>, <D2>...]
  223.  
  224.                <F1> is frequency and <D1> - duration in milliseconds of
  225.                produced beep. You may produce as many notes as required
  226.  
  227.  
  228.    SYSTEM      Issue an OS command:
  229.  
  230.                SYSTEM <Arg1> [, <Arg2>..]
  231.  
  232.                The command line merged from parameters <Arg1>, <Arg2>...
  233.                is executed.
  234.  
  235.    ;           The script strings starting with a semicolon ';' character
  236.                are comments and are ignored when processing.
  237.  
  238.    =           To set a variable value, the following command may be used:
  239.  
  240.                <Var>=<Expression>
  241.  
  242.                <Var> is the variable name and <Expression> may be a
  243.                constant, numeric expression or a function call.
  244.  
  245.                Numeric expression is the combination of the pattern "A # B".
  246.                Where A and B could be numeric constants and/or variables,
  247.                '#' is one of the mathematical operators: '+', '-', '*',
  248.                '/', '%'.
  249.  
  250.  
  251.    2.1.2. Screen commands
  252.  
  253.    All output is directed to the current text window (see the WINDOW command
  254.    description).
  255.  
  256.    Foreground and background colors in all related commands are
  257.    designated with keywords defining the corresponding color:
  258.  
  259.    BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY,
  260.    LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE.
  261.  
  262.    Alternatively you may use the numeric attribute value from 0 to 15 as a
  263.    color code.
  264.  
  265.    If a command does not have a foreground/background pair as a parameter,
  266.    the current color is used for output (see the SETCOLOR command).
  267.  
  268.  
  269.    BOX         Draw a box:
  270.  
  271.                BOX <X1>, <Y1>, <X2>, <Y2>, <Col>, <Bck>, SINGLE | DOUBLE
  272.  
  273.                <X1>, <Y1> - the left and top point of the box;
  274.                <X2>, <Y2> - the right and bottom point;
  275.                <Col>, <Bck> - the foreground and background colors;
  276.                SINGLE or DOUBLE - Border type, one or two lines.
  277.  
  278.  
  279.    CLRSCR      Clear the current window (with an optional symbol):
  280.  
  281.                CLRSCR [ <Symbol> ]
  282.  
  283.                The current color is used for clearing.  Optionally a 
  284.                symbol may be given which will be used to fill
  285.                the window.  The symbol should be defined with a 
  286.                character value (in quotation marks - "") or a
  287.                numeric code.
  288.  
  289.  
  290.    CTEXT       Write text centered on the current line:
  291.  
  292.                CTEXT <P1> [, <P2>..]
  293.  
  294.                <P1>, <P2>.. are variables or character constants.
  295.  
  296.  
  297.    GOTOXY      Position the cursor in the current window:
  298.  
  299.                GOTOXY <X>, <Y>
  300.  
  301.                <X>, <Y> - the point to which the cursor should be 
  302.                positioned.
  303.  
  304.    DEFBAR      Define the file progress bar:
  305.  
  306.                DEFBAR <Col>, <Bck>, <BarCol1>, <BarCol2>, <X>, <Y>, <Length>
  307.  
  308.                <Col>, <Bck> - foreground and background colors;
  309.                <BarCol1>, <BarCol2> - colors for 'non-filled' and 'filled'
  310.                parts of the progress bar;
  311.                <X>, <Y> - left and top point of the bar window;
  312.                <Length> - length of the bar.
  313.  
  314.                You may disable the file bar by a using a special form of the
  315.                DEFBAR command:
  316.  
  317.                DEFBAR OFF
  318.  
  319.  
  320.    MESSAGE     Write text in a box:
  321.  
  322.                MESSAGE <Col>, <Bck>, <Title>, <Str1> [, <Str2>..]
  323.  
  324.                <Col>, <Bck> - foreground and background colors;
  325.                <Title> - Box header text;
  326.                <Str1>, <Str2>.. strings containing the text to be displayed
  327.  
  328.  
  329.    OUTTEXT     Start/end a plain/ANSI text:
  330.  
  331.                OUTTEXT [ANSI] ON | OFF
  332.  
  333.                Defines the beginning (ON) and the end (OFF) of a text
  334.                section.  The optional keyword ANSI indicates that the text
  335.                contains ANSI esc-sequences which are to be processed while 
  336.                writing to the screen.
  337.  
  338.                Example:
  339.  
  340.                OUTTEXT ON
  341.  
  342.                   Installation instructions.
  343.  
  344.                   You should install this program according to
  345.                   the following procedure:
  346.                     ...
  347.  
  348.  
  349.                OUTTEXT OFF
  350.  
  351.  
  352.    RESTSCR     Restore a screen saved with SAVESCR:
  353.  
  354.                RESTSCR <NumScr>
  355.  
  356.                <NumScr> - the identifier of the screen previously saved
  357.                with the SAVESCR statement.  The cursor position, current 
  358.                window setting as well as the foreground and background
  359.                colors are restored.
  360.  
  361.  
  362.    SAVESCR     Save screen:
  363.  
  364.                SAVESCR <NumScr>
  365.  
  366.                <NumScr> - A numeric value from 1 to 16 identifying the
  367.                storage place for the saved screen data.  Stored data 
  368.                includes the screen data, the cursor position, current 
  369.                window setting as well as the foreground and background
  370.                colors.  Saved screens may be restored using the RESTSCR
  371.                statement.  
  372.  
  373.                <NumScr> must be numeric value from 1 to 16.
  374.  
  375.  
  376.    SETCOLOR    Set the default foreground and background color:
  377.  
  378.                SETCOLOR <Col>, <Bck>
  379.  
  380.                <Col> is the foreground and <Bck> is the background color.
  381.                After setting this default all commands, which use but do 
  382.                not contain a color specification, will be output using 
  383.                this color.
  384.  
  385.  
  386.    TEXT        Write text:
  387.  
  388.                TEXT <P1> [, <P2>..]
  389.  
  390.                <P1>, <P2>.. are variables or character constants containing
  391.                the text to be written.
  392.  
  393.  
  394.    WINDOW      Set the current window:
  395.  
  396.                WINDOW <X1>, <Y1>, <X2>, <Y2>
  397.  
  398.                <X1>, <Y1> - the left and top point of the window;
  399.                <X2>, <Y2> - the right and bottom point;
  400.                All output, written after this command has been issued,
  401.                will be within the specified window range if else not
  402.                stated in command description.
  403.  
  404.  
  405.    2.1.3. Functions
  406.  
  407.    Function provides built-in procedure call, which returns a value.
  408.                                           
  409.  
  410.    EXEC        Issue an OS command and return exit code:
  411.  
  412.                <Var>=EXEC <Arg1> [, Arg2.. ]
  413.  
  414.                <Arg1>, <Arg2>.. - parameters of which the command line
  415.                merged prior to be executed. If you need spaces - add it
  416.                accordingly into <Arg1>, <Arg2>..
  417.                <Var> - the variable to receive the returned errorlevel
  418.                after the command line execution.
  419.  
  420.              
  421.    GETDFREE    Get disk free space:
  422.  
  423.                <Var>=GETDFREE [<DiskNo>]
  424.  
  425.                <Var> - variable to hold the returned value.
  426.                Available disk space in bytes is assigned to the variable.
  427.  
  428.                <DiskNo> - the optional number of disk to get available
  429.                space (0 means A:, 1 - B:, 2 - C: etc). If this parameter
  430.                not indicated the available space will be reported for
  431.                destination disk (see DestDir variable description). If
  432.                the disk matched does not exist, -1 will be returned.
  433.  
  434.  
  435.    GETKEY      Return pressed key code:
  436.  
  437.                <Var>=GETKEY
  438.  
  439.                The function waits for a key depression and returns it's
  440.                code to <Var>.  Special keys produce extended scan codes
  441.                in which the first byte is zero and the second contains
  442.                the extended code.  In this case the key code is returned
  443.                as a value of the second byte plus 256.
  444.  
  445.   
  446.    INPUT       Perform input:
  447.  
  448.                <Res>=INPUT <Col>, <Bck>, <Var>, <IniValue>, <MaxLen>
  449.  
  450.                <Col>, <Bck> - the foreground and background color of the
  451.                input field;
  452.                <Var> - the variable to receive the input value;
  453.                <IniValue> - the initial value (variable or a constant);
  454.                <MaxLen> - the input field (maximum) length.
  455.                <Res> - A flag indicating the success of the transaction.
  456.  
  457.                If the <Esc> key is pressed during input then a value of
  458.                zero is returned in <Res> and <Var> is undefined.  If a
  459.                value is successfully entered, <Res> is assigned a value 
  460.                of 1 and <Var> is assigned the input value.
  461.  
  462.  
  463.    MENU        Initiate a menu:
  464.  
  465.                <Var>=MENU <X>, <Y>, <Col>, <Bck>, <Position>, <Title>,
  466.                           <Item1> [, <Item2>..]
  467.  
  468.                <X>, <Y> - the left and top point of the menu;
  469.                <Col>, <Bck> - the foreground and background color;
  470.                <Position> - initial menu pointer position (number);
  471.                <Title> - text of the title;
  472.                <Item1>, <Item2>.. - character strings - menu items;
  473.                <Var> - the variable to receive the returned value.
  474.  
  475.                Upon successful choice, the function returns the number of
  476.                the menu item (1-n).  If the <Esc> key was pressed, a value 
  477.                of zero is returned. 
  478.  
  479.  
  480.    2.1.4. Pre-defined procedures
  481.  
  482.    Procedures with reserved names which are called from the SFX internal
  483.    code upon special conditions.  Prior to such call SFX sets the parameter
  484.    variables Par1 and Par2.  The pre-defined procedures are optional and
  485.    should be written to particular need by the script programmer using
  486.    the PROC statement.
  487.  
  488.    ArcDone     Called upon successful completion of extraction.
  489.  
  490.                No parameter is used.  When ArcDone is executed,
  491.                the archive file is closed and may be erased by
  492.                issuing the command: SYSTEM "DEL ",ArcName
  493.  
  494.    ChangeVol   Called when the archive volume needs to be changed.
  495.  
  496.                Par1 is assigned the volume number (0 for the first volume
  497.                change), Par2 is assigned the volume status: If Par2 is 0,
  498.                the volume needs to be installed, (user should be asked to
  499.                load it). This procedure will be called with Par2==0 until
  500.                the requested volume is not found. You may change the
  501.                requested volume name by an assignment to the variable
  502.                ArcName. In the case of non zero value of Par2 the volume is
  503.                successfully installed and no user action is required.
  504.  
  505.                If the ChangeVol procedure is not defined then the prompt
  506.                "Insert disk with <volume name>" will be displayed by SFX 
  507.                when the next volume is required.
  508.  
  509.    Error       Called when an error occured.
  510.  
  511.                Par1 is assigned the error code:
  512.  
  513.                   1 - Fatal error
  514.                   2 - CRC error, broken archive
  515.                   3 - Write error
  516.                   4 - File create error
  517.                   5 - Read error
  518.                   6 - File close error
  519.                   7 - File open error
  520.                   8 - Not enough memory
  521.  
  522.                When Error procedure ends, SFX processing terminates.
  523.                This procedure is not called when an incorrect AV code is
  524.                detected.
  525.  
  526.                If no Error procedure is defined, SFX prompts the user with 
  527.                a standard error message and terminates.
  528.  
  529.    FileDone    Called upon successful extraction of a file or a directory.
  530.  
  531.                Par1 variable is assigned the file number in the archive.
  532.                Filename contains the file name.
  533.  
  534.    OnKey       Called when a key is pressed.
  535.  
  536.                May be used to implement context sensitive help message
  537.                display as well as break processing.  Par1 is assigned the
  538.                key code of the pressed key.  If the key operation is 
  539.                processed within the OnKey procedure, you should set Par1
  540.                to -1, to inhibit double processing of the key by SFX.
  541.                Recursive calls of OnKey are prevented by SFX itself.  When
  542.                OnKey is called, the current window, color setting and cursor
  543.                position are automatically saved and restored upon exit of 
  544.                the procedure.  Note that screen saving is not performed -
  545.                use SAVESCR and RESTSCR commands if so desired but be sure
  546.                that you save and restore screen with an identifier which
  547.                is not used in the script).
  548.  
  549.  
  550.    2.1.5. Pre-defined variables
  551.  
  552.  
  553.     Archive variables:
  554.  
  555.    ArcName       The archive name
  556.  
  557.    AVPresent     If authenticity verification (AV) is present, the variable
  558.                  value is 1, else - 0.  In the case of invalid AV information
  559.                  the value is -1.
  560.  
  561.    AVArcName     The archive name stored in AV
  562.  
  563.    AVDate        The archive date stored in AV
  564.  
  565.    AVUserName    The archive creator (AV registration string)
  566.  
  567.  
  568.     Extraction dependent variables:
  569.  
  570.    FileName      The name of the file extracted from the archive (no
  571.                  destination path)
  572.  
  573.    DestFileName  The full path name of the file extracted from the
  574.                  archive (destination path included)
  575.  
  576.  
  577.     User-definable variables (to be assigned by INPUT or = operation):
  578.  
  579.    DestDir       Destination directory to install files from the archive.
  580.                  If the destination directory does not exist, it will be
  581.                  created. If the last character of the destination
  582.                  directory entered not '\' or ':', then the string will
  583.                  be automatically complemented with final '\' character.
  584.  
  585.    Password      The password to facilitate decryption of the archive files.
  586.  
  587.  
  588.    2.1.6. Script notes
  589.  
  590.    Character strings should be entered using C-language rules.
  591.    For example, use "\\" to enter a single symbol "\".
  592.    Special characters (format operators) such as "\n", "\r" may be used.
  593.  
  594.    The script text is stored as the archive comment in the SFX module. You
  595.    should place an <EOF> character (ASCII code 26) at the start of the
  596.    script in order to prevent displaying the script as the archive comment
  597.    if the SFX would be handled with RAR itself.
  598.  
  599.    See the example of the installation script in the file standard.s. It may
  600.    be used to create any installation package.
  601.  
  602.    Also you may extract the RAR Installation script from the RAR package. In
  603.    order to do this you may run the "extract comment" command on the RAR SFX
  604.    package:
  605.  
  606.        rar cw rar155.exe rarinst.s
  607.  
  608.    You will then have the RAR Installation script in the file rarinst.s
  609.  
  610.    An external install program can be placed into SFX archive to be called
  611.    after successful completion of unpacking (e.g. from PROC ArcDone) with
  612.    using EXEC function:
  613.  
  614.      PROC ArcDone
  615.  
  616.           EXEC DestDir, "Install.Exe"
  617.      ENDP
  618.  
  619.    2.1.7. Technical limitations:
  620.  
  621.         Maximum script line length.............1023 bytes
  622.  
  623.         Maximum script length....................62 Kb
  624.  
  625.         Maximum parameters in command............16
  626.  
  627.         Maximum parameter length................255 bytes
  628.  
  629.         Maximum identifier (variable name,
  630.         label) length............................31 bytes
  631.  
  632.         Maximum variable value length...........127 bytes
  633.  
  634.    In general, variables can contain numeric (4 bytes length) values or
  635.    strings of up to 127 characters in length.
  636.  
  637.  
  638.  
  639.