home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / PATCH / PTOOL / HEXED.DOC < prev    next >
Encoding:
Text File  |  1997-05-27  |  14.1 KB  |  262 lines

  1.      
  2.             HexEd, a Hexadecimal Editor for Binary Files,
  3.                       by Anthony F. Stuart, 1990.
  4.      
  5.      
  6.      1.  Description
  7.      
  8.          HexEd is a fast and easy to use editor for binary files. It 
  9.      supports insert and overtype modes, character delete, and search
  10.      and replace. Command line options let you customize it for your
  11.      video hardware and processing preferences. HexEd uses memory
  12.      and disk very efficiently. The executable file itself consumes
  13.      less than 30 kb and it can edit files up to two megabytes in less
  14.      than 100 kb of memory. 
  15.      
  16.          HexEd uses the popular hexadecimal dump display, with address
  17.      on the left, hexadecimal representation in the middle and character
  18.      representation on the right. The current location in the file is
  19.      marked by a pair of cursors, one for the hexadecimal representation
  20.      and one for the character representation. The arrow keys, page up,
  21.      page down, home and end select the current location in the file.
  22.      There is also a goto command to select a specific address.
  23.      
  24.          Text can be inserted or overtyped as either hexadecimal or
  25.      character codes. A single key combination switches between modes. In
  26.      hexadecimal mode the hexadecimal cursor is active and lets you enter
  27.      a one or two digit hex value. In character mode the character cursor
  28.      is active and lets you enter a character. Characters can also be
  29.      entered using decimal code by holding down the Alt key and entering
  30.      the decimal code on the numeric keypad.
  31.          
  32.          HexEd makes an ideal binary file pager. The search and goto
  33.      commands, and current address display field, let you quickly locate
  34.      an address without having to count bytes.
  35.      
  36.      2.  Use
  37.      
  38.          To invoke HexEd with default display and processing options
  39.      just type the command followed by an existing filename:
  40.      
  41.                    hexed file
  42.      
  43.          HexEd will display its header and footer lines and the first page
  44.      of the file. The current location is set to the first byte of the file.
  45.      The header line contains the current address, file size, insert/
  46.      overtype indicator and hex/ascii indicator. The footer line contains
  47.      the file name, time and date last modified and original file size.
  48.      
  49.          Press function key F1 for a help display that summarizes the
  50.      interactive commands. This display is also produced if you enter an
  51.      invalid function or Alt key sequence. The help display is cleared by
  52.      pressing any key.
  53.      
  54.          The cursor positioning keys move the cursor around the file
  55.      in the usual way. The home key selects the beginning of the file and
  56.      the end key selects the end of the file. Page up and page down move
  57.      one page backward or forward.
  58.      
  59.          The delete key deletes the current character, and all following
  60.      characters shift up one. The insert key toggles insert/overtype mode.
  61.      The default mode is overtype mode. In overtype mode each character that
  62.      is entered replaces the character that was previously there. In insert
  63.      mode each character that is entered is inserted at the current location
  64.      and the following characters are shifted down one. The current mode
  65.      is indicated on the header line.
  66.      
  67.          HexEd recognizes a variety of Alt key sequences:
  68.      
  69.          Alt-D (Dos Suspend) suspends the current editing session and
  70.          enters the DOS command processor. Return to HexEd by typing
  71.          exit at the DOS prompt. Caution: while suspended do not delete
  72.          or modify the file you are editing or any "hexedtmp" files.
  73.      
  74.          Alt-G (Goto Address) prompts for an address and makes it the
  75.          new current location. The address can be entered in octal,
  76.          decimal or hexadecimal format. Octal addresses must be preceded
  77.          by a 0 and hexadecimal addresses must be preceded by a 0x. For
  78.          example, the octal address 010770 and the hexadecimal address
  79.          0x11f8 are equivalent to the decimal address 4600.
  80.      
  81.          Alt-H (Toggle Hex/Character Mode) controls which cursor is
  82.          active for inserting or overtyping. In hexadecimal mode the
  83.          hexadecimal cursor is active and you can enter any of the
  84.          digits 0123456789abcdef. In character mode you can enter any
  85.          character that can be typed from the keyboard. Remember that
  86.          text lines in DOS are terminated by a carriage return, line
  87.          feed combination. This can be entered using Ctrl-M, Ctrl-J. Also
  88.          note that most PC BIOS's support decimal entry by holding down
  89.          the Alt key and entering a decimal code on the numeric keypad.
  90.      
  91.          Alt-Q (Quit) exits the editor. First you are prompted for 
  92.          whether you really want to quit or not. Then, if you have made
  93.          changes, you are prompted for whether you want to save them. 
  94.          Note that at this point it is only possible to write the changes
  95.          back to the original file. If you want to write the changes to
  96.          a different file use the Write command before quitting.
  97.      
  98.          Alt-R (Replace) prompts for a search pattern and a replace
  99.          string and then interactively asks you whether you would like
  100.          to replace each occurence of the pattern. A NO response skips to
  101.          the next occurence. A YES response replaces the current occurence.
  102.          An ALL response replaces all remaining occurences (to the end of
  103.          the file). A STOP response terminates the search and replace
  104.          operation. See the search command for a description of patterns.
  105.      
  106.          Alt-S (Search) prompts for a search pattern and locates the
  107.          first occurence of it following the current location. A search
  108.          pattern consists of a sequence of one or more characters, escape
  109.          sequences and/or wildcards. Escape sequences are described below.
  110.          Wildcards consist of the question mark character (?) which
  111.          matches any one character and the asterisk character (*) which
  112.          matches zero or more characters. The asterisk will match the
  113.          shortest string that satisfies the remainder of the pattern. 
  114.          
  115.          Alt-W (Write) writes the current editing session to a file. First
  116.          you are prompted for whether or not you really want to write to
  117.          a file. Then you are prompted for the name of a file. The editing
  118.          session is then written to the file. If you have specified the
  119.          original file as the output file then the time and date modified
  120.          and original file size fields of the footer line will be updated.
  121.      
  122.          As mentioned above, text for the search and replace commands can
  123.      be entered as a sequence of characters and/or escape sequences. The
  124.      escape sequences use the common convention of a backslash followed
  125.      by a mnemonic:
  126.      
  127.          Sequence    Description            ASCII Code or Comment
  128.          --------    -----------            ---------------------
  129.          \a          audible alert          BEL
  130.          \b          backspace              BS
  131.          \f          formfeed               FF
  132.          \n          newline (linefeed)     LF
  133.          \r          carriage return        CR
  134.          \t          horizontal tab         HT
  135.          \v          vertical tab           VT
  136.          \?          question mark          negates wildcard function
  137.          \*          asterisk               negates wildcard function
  138.          \\          backslash              negates escape function
  139.          \0nnn       octal code nnn         e.g. \033 is an ASCII ESC
  140.          \dnnn       decimal code nnn       e.g. \d27 is an ASCII ESC
  141.          \xnn        hexadecimal code nn    e.g. \x1b is an ASCII ESC
  142.          
  143.          The escape sequences can be intermixed with text as long as the
  144.      end of an octal, decimal or hexadecimal sequence is not ambiguous.
  145.      
  146.          When entering text for the search, replace or file commands, use
  147.      the backspace key to delete the previous character and the escape key
  148.      to delete the entire line. You can also cancel any of these commands
  149.      by pressing escape followed by return.
  150.  
  151.      3.  Limits and Error Recovery
  152.      
  153.          HexEd creates a temporary file that is uses to keep track of
  154.      changes you make. The file you are editing is not updated until you
  155.      write the changes back to it or quit and save the changes. In fact,
  156.      the write operation first writes the changes to another temporary file
  157.      and then renames the temporary file to the name you specified. This 
  158.      way if anything goes wrong you will not lose your original file.
  159.      
  160.          Keep in mind that HexEd uses temporary files and that they
  161.      require disk space. A good rule of thumb is to only use HexEd on
  162.      disks that have at least 2-3 times as much free space as the size of the
  163.      file you are editing. Also keep in mind that HexEd should not be used
  164.      to edit files over two megabytes (hex 200000). If you run out of memory
  165.      or disk space for temporary files the editor aborts and your changes
  166.      are lost.
  167.      
  168.      4.  Defaults and Command Line Options
  169.      
  170.          HexEd lets you customize the way it operates by specifying
  171.      command line options. If you want to use certain options every time
  172.      you edit, create a batch file that invokes HexEd with the desired
  173.      options. The following list summarizes the command line options. You
  174.      can get a summary of this list by specifying the HexEd command without
  175.      a filename. Note that command line options should be entered in lower
  176.      case. Also, for options that require a parameter, there should be no
  177.      space between the option and the parameter.
  178.      
  179.          -b     creates a backup file before writing changes. The backup
  180.                 file uses the same base name and a .bak suffix. Caution: the
  181.                 new backup file will replace any existing file with the same
  182.                 name.
  183.      
  184.          -c<c>  specifies the color to use for the cursor and help 
  185.                 display. The method for specifying colors is described
  186.                 below. The default is -ckw for both monochrome and color.
  187.      
  188.          -d<d>  specifies the display character to use for characters
  189.                 outside the printable ASCII character set. This character
  190.                 can be represented using the escape sequence notation
  191.                 described above. If no character is specified then the
  192.                 character from the PC character set is displayed. The
  193.                 default is -d\xfa for the centered dot.
  194.      
  195.          -e<f>  specifies the fill character to use when characters are
  196.                 added beyond the end of the file. The default is -e\x0, i.e.
  197.                 fill from end of file to the current location with zeros.
  198.      
  199.          -f<c>  specifies the color to use for the footer line. The default
  200.                 is -fkw for monochrome and -fyr for color.
  201.      
  202.          -h<c>  specifies the color to use for the header line. The default
  203.                 is -hkw for monochrome and -fyr for color.
  204.      
  205.          -m<c>  specifies the color to use for the message line. The default
  206.                 is -mwk for both monochrome and color.
  207.      
  208.          -s     specifies silent mode. Invalid keys are ignored. The default
  209.                 is to produce a tone when an invalid key is entered.
  210.      
  211.          -t<c>  specifies the color to use for the text area. The default
  212.                 is -twk for monochrome and -tck for color.
  213.      
  214.          -u<n>  specifies the number of memory buffers to use. Specifying
  215.                 a large number makes editing faster but limits editing to
  216.                 smaller files. Specifying a small number slows down editing
  217.                 but lets you edit larger files. The default is -u8. The
  218.                 minimum is -u4.
  219.      
  220.          -v     specifies use of the video BIOS instead of direct video 
  221.                 access. Use this option if you have any problems with the
  222.                 display. The video BIOS is slower than direct access.
  223.      
  224.          Colors are specified as a two character sequence. The first 
  225.      character represents the foreground color. The second character
  226.      represents the background color. Colors are abbreviated:
  227.      
  228.                 b = blue,    g = green,  c = cyan,  r = red,
  229.                 m = magenta, y = yellow, w = white, k = black
  230.      
  231.      For example, to specify a text area of white on black, use -twk.
  232.      
  233.      5.  Distribution
  234.      
  235.          HexEd is not copyrighted. It may be freely copied and
  236.      distributed. All I ask is that you give me credit if you copy and
  237.      distribute it and that you do not distribute copies that have
  238.      been modified in any way or that are missing this documentation.
  239.      
  240.          My objective is to make HexEd the number one binary editor. Please
  241.      distribute it to anyone who can benefit from it.
  242.      
  243.          HexEd is distributed as-is with no warranties, for use at
  244.      your own risk. Every effort has been made to produce a robust and
  245.      reliable program, but there are undoubtedly some bugs left in it. If
  246.      you find a bug, try to reduce it to its simplest case and send me a
  247.      description. I would also like to hear general comments or 
  248.      suggestions for new features. My name and address:
  249.      
  250.                      Anthony F. Stuart
  251.                      21042 Thoreau Court
  252.                      Sterling, VA 22170
  253.      
  254.          The source to HexEd consists of about 3000 lines of 'C' language
  255.      source code. It would make good reading for anyone who would like to
  256.      learn more about editor data structures and file manipulation. If you
  257.      would like a copy of the latest source code for HexEd, on 360 kb
  258.      diskette, send a brief note and $10.00 to the above address. Note that
  259.      the source code to HexEd is copyrighted and may not be redistributed
  260.      in any format. Also note that this offer may withdrawn without notice.
  261.      
  262.