home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bedit23.zip / BEDIT.DOC next >
Text File  |  1993-02-09  |  23KB  |  509 lines

  1.                                     BEDIT
  2.                               Binary File Editor
  3.                                  USER'S GUIDE
  4.  
  5.                   Copyright 1990, 1993 by Gary C. Crider and
  6.                                Parity Solutions
  7.                                
  8.  
  9.  
  10. TABLE OF CONTENTS:
  11.  
  12.         What is BEDIT? ................................... 1.0
  13.         The BEDIT command line ........................... 2.0
  14.         Operational notes ................................ 3.0
  15.         The Keyboard and Display ......................... 4.0
  16.         Modifying Data ................................... 5.0
  17.         Deleting Data .................................... 6.0  
  18.         Inserting Data ................................... 7.0  
  19.         Locating Data .................................... 8.0
  20.           Go to a Position in the File ................... 8.1
  21.           Search for Data ................................ 8.2
  22.         Print the File ................................... 9.0
  23.         Save the File .................................... 10.0
  24.         Help ............................................. 11.0
  25.         A Useful Example - 
  26.           Modification of DOS 5's EDIT ................... 12.0
  27.         Installation ..................................... Appendix A
  28.         Disclaimer ....................................... Appendix B
  29.         Support .......................................... Appendix C
  30.         Registration ..................................... Appendix D
  31.  
  32.  
  33. 1.0 What Is BEDIT?
  34.  
  35.    One thing most of us learned early on after working on our first PC
  36. was that EDLIN, while useful, stank (stunk?) as an editor of text files.
  37. Soon there were hundreds of full screen text editors available everywhere.
  38. Even Microsoft finally came around and included EDIT in DOS 5 to get us
  39. away from EDLIN.
  40.  
  41.    An early lesson that most who aspire to be power users learn is that not
  42. all changes we desire to make are in text files.  Sooner or later we end
  43. up patching an executable program, database, or strange format file that
  44. text editors will not handle.  Enter DEBUG.  Just as EDLIN was a pain for
  45. editing text files, DEBUG is a pain for editing binary files.  Strangely,
  46. few people have jumped out with binary editors and the few I have seen are 
  47. not much better than DEBUG.  Even Microsoft is making us stick with DEBUG,
  48. and as a bonus, have taken the documentation for DEBUG out of the DOS
  49. documentation.  I guess they feel it is too dangerous for ordinary mortals.
  50. My feeling is, it's my file and I'll corrupt it if I want to.
  51.  
  52.    BEDIT is a very easy-to-use full screen editor for binary (or text) 
  53. files.  You simply type over the hex or ASCII data much as you would with
  54. any text editor.  BEDIT ensures that you enter hex characters (0-9 and A-F)
  55. while you are in hex entry mode.  You will be able to see the hex and ASCII
  56. representations at all times whether you are editing in hex or ASCII.  
  57.  
  58.    Using BEDIT is so intuitive, I don't know why I'm writing this documen-
  59. tation or why you are reading it.  Perhaps we both like to move cautiously.
  60.  
  61.    You see a full screen of data at all times, not just a few bytes.  Paging
  62. through the file is as easy as hitting PgUp and PgDn, you don't have to
  63. enter hex displacements to get to the next page.
  64.  
  65.    I think you'll find, as we have at a Fortune 100 company (my day job),
  66. that BEDIT becomes one of the handiest tools you have.  You will use it
  67. much more than you now expect that you will.
  68.  
  69.    BEDIT automatically detects and uses any available LIM 4.0 EMS expanded
  70. memory.  This allows very large files to be edited.
  71.  
  72.  
  73.  
  74. 2.0 The BEDIT Command Line
  75.  
  76.    Format: BEDIT [path]filename [/N]
  77.  
  78.    The filename is the file name of the file that you want to edit.  BEDIT 
  79. does not make an automatic backup, so back it up if you think there could    
  80. be problems.  The path is required if the file is not in the current 
  81. directory.  Specify /N if you do not want BEDIT to use EMS memory.
  82.  
  83.    
  84.  
  85. 3.0 Operational Notes   
  86.  
  87.    It bears repeating at this point that BEDIT DOES NOT MAKE AN AUTOMATIC
  88. BACKUP of the edited file.  Since much of the usefulness of BEDIT is to just
  89. view or print the contents of a binary file, I did not want BEDIT cluttering
  90. up my directories with backup files. 
  91.  
  92.    If you intend to modify a file with BEDIT, I highly recommend making
  93. a backup file first for obvious reasons.  Since BEDIT will allow you to 
  94. change any file in any way, it is obviously a very dangerous weapon in the
  95. hands of the unskilled as well as a very powerful tool in the hands of the
  96. skilled.  Please be careful!
  97.  
  98.    BEDIT reads the entire file into memory before any edits are performed.
  99. All changes are made only to the copy in memory until a SAVE is done.  If
  100. you have LIM 4.0 compatible EMS memory, you are limited in editable file size
  101. to the amount of free expanded memory.  If you have no expanded memory, or
  102. use the /N parameter, the file is loaded into conventional memory.  Depending
  103. on your memory configuration, you should be able to load a file of 400-500 
  104. Kbytes without the use of expanded memory.  If your available expanded
  105. memory is less than your available conventional memory, use the /N option
  106. to load larger files.  Usually there is more expanded memory than conven-
  107. tional, so excluding the /N option allows larger files to load.
  108.  
  109.  
  110.  
  111. 4.0 The Keyboard and Display
  112.  
  113.    There are two modes of editing in BEDIT.  When you first load a file, the
  114. screen appears with both hex data and its ASCII representation displayed in 
  115. separate sections of the screen.  The cursor is initially placed in the hex 
  116. portion of the screen for editing in hex.  The character (represented by two 
  117. hex digits) at the cursor location appears red on color monitors.  The same 
  118. character on the ASCII (right) side will be light cyan.  All other data 
  119. characters are yellow.  As the cursor moves, you will see the light cyan 
  120. highlighting on the ASCII display move with the cursor and red letters of the 
  121. hex display.  Pressing TAB places the cursor in the ASCII portion and the 
  122. display at the cursor becomes red.  The corresponding position in the hex 
  123. data becomes light cyan.  TAB toggles the cursor back and forth between the 
  124. two editing areas.
  125.  
  126.    The ASCII display does not display every displayable character, but only
  127. letters and numbers and the more common punctuation symbols that are common
  128. to most printers.  You can only enter these characters on the ASCII side.  To
  129. enter exotic characters you must use the hex representation on the hex side.
  130. Periods are placed in the ASCII display for all non-displayable characters. 
  131. If a blank appears, it is because there is a true blank (hex 20) at that
  132. position.
  133.  
  134.    The following keys function as shown during editing:
  135.  
  136.    Page Down    - Display the next page of data.
  137.    Page Up      - Display the previous page of data.
  138.    Home         - Position the cursor at the start of the file.
  139.    End          - Position the cursor at the end of the file.
  140.    Down Arrow   - Move the cursor down one line.
  141.    Up Arrow     - Move the cursor up one line.
  142.    Right Arrow  - Move the cursor right one byte.  If at the end of a line, 
  143.                   move to the first byte of next line.
  144.    Left Arrow   - Move the cursor left one byte.  If at the start of a line,
  145.                   move to the last byte of the previous line.
  146.    Enter        - Same as right arrow.
  147.    Tab          - Swap the edit cursor between hex and ASCII modes.
  148.    Back Tab     - Clears the byte.  You must then type something in the byte
  149.                   before the cursor can be moved.
  150.    Insert       - Insert one byte.  Everything beyond this byte is shifted one 
  151.                   position and a hex 00 byte is inserted at the cursor.
  152.    Delete       - Delete one byte at the cursor.
  153.  
  154.    Function keys:
  155.  
  156.    F1     - Display the help screen.
  157.    F2     - Save any changes to the file on disk.
  158.    F3     - Insert a specified number of bytes at cursor.
  159.    F4     - Delete a specified number of bytes at cursor.
  160.    F5     - Move the cursor to a specified address within the file.
  161.    F6     - Print the file to LPT1:.  It appears in basically the same format
  162.             as displayed.
  163.    F7     - Toggle case-sensitivity for ASCII string searches.
  164.    F8     - Specify a search argument and locate the first occurrence of it in
  165.             the file.
  166.    F9     - Locate the next occurrence of the search argument.
  167.    ESCAPE - Exit BEDIT.
  168.  
  169.  
  170.  
  171. 5.0 Modifying Data
  172.  
  173.    Modifying data is very simple, just type over it.  Use the TAB key to 
  174. select the hex or ASCII area.  When typing in the hex area, only valid hex
  175. characters, 0-9 and A-F are allowed and upper case is forced.  When entering
  176. data in the ASCII portion, only common printable characters are allowed and 
  177. upper or lower case may be used.
  178.  
  179.  
  180.  
  181. 6.0 Deleting Data
  182.  
  183.    First place the cursor on the first byte of the data that you want to 
  184. delete.  Pressing the DELETE key deletes one byte of data at this position.
  185. Press DELETE repeatedly to delete several bytes.  If a large block needs to
  186. be deleted, press the F4 key and reply to the prompt with the number of bytes 
  187. you want to delete starting with the byte at the cursor.
  188.  
  189.  
  190.  
  191. 7.0 Inserting Data
  192.  
  193.    BEDIT, rather than using an insert mode, lets you insert bytes of binary 
  194. zeros, hex 00, into the file.  You can then type over the inserted bytes with 
  195. the data that you require.
  196.  
  197.    Place the cursor at the byte where you want the data inserted.  The data
  198. is inserted BEFORE the byte at the cursor.  Pressing the INSERT key inserts 
  199. one byte at a time.  If a large block needs to be inserted, press F3 and 
  200. specify the number of bytes you want inserted.  Once the null bytes appear,
  201. type over them if necessary.
  202.  
  203.    In order to add bytes to the end of the file, press END to go to the last
  204. byte of the file then press the right arrow.  Each press of the right arrow
  205. adds a byte to the file.  To enter a large block at the end of the file,
  206. press the right arrow once, then press F3 and specify the number of bytes
  207. needed less one (since you already added one when you pressed the right
  208. arrow).
  209.  
  210.  
  211.  
  212. 8.0 Locating Data
  213.  
  214.    There are basically three ways to move the cursor to an area you want
  215. to edit.
  216.  
  217.    First you can use Page Down and Page Up to visually look for that area you
  218. want.  Primitive, but effective.
  219.  
  220.    Second, if you know the offset into the program of the area you want to 
  221. modify, press F5 and type the offset in hex.  
  222.  
  223.    The third method is to let the computer search for a known byte config-
  224. uration.
  225.  
  226.  
  227.  
  228. 8.1 Go to a Position in the File
  229.  
  230.    An offset or displacement is measured from the start of the file.  The
  231. first byte is offset 0, the second is 1, etc.  When you press F5, you are
  232. prompted for an offset which you provide in hex.  The cursor is then placed 
  233. at that address and display is updated to show the data at the cursor.
  234.  
  235.    This method is often used in applying documented patches supplied by a 
  236. software vendor.
  237.  
  238.  
  239.  
  240. 8.2 Search for Data
  241.  
  242.    Pressing F8 pops up a dialogue box that requests entry of a search argument.
  243. After supplying this argument, the cursor is positioned to the first 
  244. occurrence of that value in the file.  If it is not found, the cursor will 
  245. appear on the last byte of the file.  If a first occurrence is found, pressing
  246. F9 searches for the next occurrence.  If a second is found, pressing F9 again
  247. searches for the third occurrence, and so on.
  248.  
  249.    If the cursor is in the hex editing area, you will be prompted for up to
  250. 16 hex bytes of search argument (32 hex digits).  When the cursor is in
  251. the ASCII editing area, you may enter up to 32 ASCII characters for a search
  252. argument.  Admittedly the search arguments are small, but I have found that
  253. when editing binary files, you are generally not looking for long strings.
  254.  
  255.    Hex data is normally entered in sets of two hex digits (nibbles) since it
  256. takes two hex digits to represent one byte.  If you enter an odd number of hex 
  257. digits, a zero nibble is prepended to the argument.  For example, if you
  258. enter 18A, the resulting two bytes that are located are 01 8A.  
  259.  
  260.   No byte swapping is ever done to accommodate the PC's low-high storage 
  261. scheme of integer data.  So if you are looking for an integer value of 
  262. 1000 (decimal), hex 3E8, which is stored as hex E8 03, the search argument 
  263. you would provide is E803.  If you don't have a clue what this means, you 
  264. probably don't need to be concerned about using BEDIT in this manner.
  265.  
  266.   The F7 key is used to enable or disable case-sensitive searches when in
  267. ASCII character mode.  The current state is shown on the top line of the 
  268. display.  If ON, upper/lower case letters must match exactly.  If OFF,
  269. upper and lower case letters are equivalent.  The CASE mode has no effect
  270. on hex mode searches.
  271.  
  272.  
  273.  
  274. 9.0 Print the File
  275.  
  276.    Printing the file is easy.  You just press F6 and the output is sent to
  277. standard print (PRN).  The format is side-by-side hex/ASCII like that dis-
  278. played on the screen with offset addresses (displacements) at the start of 
  279. each line.  896 (hex 380) bytes are printed on each page.  The pages are 
  280. numbered and the file name appears at the beginning of each page.
  281.  
  282.    
  283.  
  284. 10.0 Saving the File
  285.  
  286.    Prior to pressing F2 to save the file, all modifications are only done in 
  287. memory.  F2 writes the image in memory over the file that was originally 
  288. loaded, and the changes become permanent.
  289.  
  290.  
  291.  
  292. 11.0 Help
  293.  
  294.    Pressing F1 pops up a help screen describing the editing and function keys.
  295. Pressing ESCAPE (or any key when last page is displayed) removes the help
  296. window and returns you to the editor.  Page Down and Page Up can be used to 
  297. move between help pages.
  298.  
  299.  
  300.  
  301. 12.0 A Useful Example - Modification of DOS 5's EDIT
  302.  
  303.    I prefer DOS 5's EDIT command by leaps and bounds over the EDLIN of
  304. previous DOSes, but there is one thing I especially don't like about it.
  305. When you select File/Open, it comes up with a default file list specification
  306. of *.TXT, like that is the only extension ever used for ASCII text files.  I
  307. would prefer *.* and let me choose from all of my files.  After reviewing
  308. all of the options, it appeared to me that there was no way to set this
  309. value to *.*.
  310.  
  311.    My next thought is that since there doesn't appear to be any type of
  312. configuration file for EDIT, the *.TXT string must be in the program, so
  313. I'll just pull out my trusty BEDIT and zap it to *.*.  Let's do it.
  314.  
  315.    Go to your directory where you keep DOS (usually C:\DOS).  Type BEDIT
  316. EDIT.COM.  Since we know we are looking for an ASCII string of *.TXT, press
  317. TAB to swap the cursor to the ASCII area and press F8 to search.  Enter
  318. *.TXT and press ENTER.  You now find that your cursor is positioned on the 
  319. last byte of the file.  This means it didn't find the string we were
  320. looking for.  Strange.
  321.  
  322.    But look! Right above our cursor are some messages that EDIT.COM displays.
  323. One of them reads, "Can not find file QBASIC.EXE."  Oh yeah, I read somewhere
  324. that the EDIT editor with DOS 5 was a version of the QBASIC editor.  Let's
  325. press ESCAPE, answer 'Y' and get back to the DOS prompt.  Now let's enter
  326. BEDIT QBASIC.EXE.
  327.  
  328.    Again let's go the ASCII area with TAB and search for *.TXT with F8.  
  329. Bingo! We found it.  If you are faint-of-heart (wise) you can exit at this
  330. point and make a backup of QBASIC.EXE by copying it to QBASIC.BKP or some 
  331. such file name.  The go back in BEDIT of QBASIC.EXE, and repeat the
  332. search to get back to where we were before.
  333.  
  334.    In my copy of DOS 5.0's QBASIC.EXE, I am now at a displacement of hex 
  335. 3BCCA into the program and the cursor is positioned on the * of string *.TXT.  
  336. Hit the right arrow twice to position the cursor on the first T.  Type an 
  337. asterisk (*).  The string now shows *.*XT and the cursor is on the X.
  338. Lets change the X and T to hex 00s, which in most languages is used to 
  339. terminate a string.  Since we can't enter a binary zero field in the ASCII
  340. area, press TAB to switch the cursor back to the hex area.  Now type
  341. four 0s.  As you can see you have now changed the XT characters from
  342. hex 54 58 (the hex representation of X and T) to hex 00 00.
  343.  
  344.    This is what we wanted to do, so now let's save the file by pressing
  345. F2.  Exit to DOS by pressing ESCAPE and Y.  Now type EDIT and go to the
  346. File/Open screen.  Lo and behold!  It now reads *.* and all of the files 
  347. in the current directory are displayed in the pick list.
  348.  
  349.    If you made a backup, you can go delete it now.
  350.  
  351.  
  352.  
  353. APPENDIX A
  354.  
  355. Installation
  356.  
  357.     BEDIT is distributed in a ZIP file called BEDIT.ZIP.  It contains the
  358. following files:
  359.  
  360.         BEDIT.EXE         The executable file for BEDIT.
  361.         BEDIT.DOC         The documentation file.
  362.         BEDIT.Vnn         Modification descriptions for version nn.
  363.  
  364.     For best results, unzip the file into a directory on your PATH.  If you
  365. don't use a directory in your path, you will have to designate the directory
  366. containing BEDIT.EXE when executing the program.
  367.  
  368.     If you have a utility directory that is on your PATH, this is an excellent
  369. location for BEDIT.  An example installation would be:
  370.  
  371.     C:
  372.     CD \UTIL
  373.     COPY [path]BEDIT.ZIP
  374.     PKUNZIP BEDIT
  375.     DEL BEDIT.ZIP
  376.  
  377.     The PKUNZIP program is by PKWARE, Inc. and is available in many CompuServe
  378. forums under the file name of PKZ110.EXE or PK204E.EXE.  Since you are reading 
  379. this doc file, you have obviously already managed to unzip the distribution 
  380. file.  If it is not currently in your path, simply copy all of the files to a 
  381. directory in your path.  Keep the BEDIT.ZIP file anywhere you like, but give 
  382. plenty of copies, as is, to your friends.  If you register BEDIT, you are not 
  383. licensed to give your serial number to anybody without first removing the 
  384. serialization from your copy.
  385.  
  386.  
  387.  
  388.  
  389. APPENDIX B
  390.  
  391.  
  392. Disclaimer
  393.  
  394. BECAUSE OF THE DIVERSE NATURE OF COMPUTER EQUIPMENT AND EXPERTISE OF USERS,
  395. PARITY SOLUTIONS AND GARY C. CRIDER MAKE NO WARRANTY ON THE BEDIT PROGRAM
  396. WHATSOEVER, EXPRESS OR IMPLIED.  THE USER ASSUMES ALL RISK OF DAMAGE TO DATA 
  397. OR EQUIPMENT RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OR MISUSE OF THIS 
  398. PROGRAM PRODUCT.  THE USER MUST BE AWARE THAT USING BEDIT TO MAKE ALTERATIONS 
  399. TO PROGRAMS OR DATA CAN RENDER THAT PROGRAM OR DATA USELESS.
  400.  
  401. USERS ARE ADVISED TO TEST MODIFICATIONS MADE WITH BEDIT THOROUGHLY ON FILES 
  402. FOR WHICH A BACKUP EXITS.  ANY LIABILITY OF THE AUTHOR OR PARITY SOLUTIONS IS 
  403. LIMITED TO REPLACEMENT OR REFUND OF THE REGISTRATION FEE.
  404.  
  405.  
  406.  
  407.  
  408. APPENDIX C
  409.  
  410.  
  411. Support
  412.  
  413.     I have tried to test the program to the fullest, but I am limited as to
  414. systems and configurations with which to test.  I have been programming for 18
  415. years and the one thing I know for sure is that bug free programs are very few
  416. and far between.  I can only promise to support the program to the best of my
  417. ability and provide fixes as expeditiously as possible.  BEDIT has been used
  418. at my home and work site extensively for several years and has proven to be a
  419. reliable tool.
  420.  
  421.     Anyone can report problems and suggest changes.  Registered users get top
  422. priority in resolving their problems.  There are three ways you can report
  423. problems.  The preferred method is to contact me through CIS mail (not forum
  424. messages).  My CIS ID is 71760,3413.  You can also write me at:
  425.  
  426.    Gary C. Crider
  427.    Parity Solutions
  428.    1105 Burgess Court
  429.    Arlington, TX 76015
  430.  
  431.     The last method is to phone (817) 467-7818.  Since I am the sole technical
  432. support and the line is also used for my network consulting business, it is
  433. often hard to get through to me.  Please call and leave a message between 7:30
  434. am and 5:30 pm Central time.
  435.  
  436.     No matter which method you use, please give a brief description of your
  437. problem, your registration serial number if you are registered, and your phone
  438. number.  If I need more information, I will contact you as soon as I can.
  439. When I have a solution, I will contact you however you prefer.
  440.  
  441.     I work full time, have a consulting business to run in my spare time and
  442. write programs instead of sleeping.  So please be a little patient with me.
  443.  
  444.  
  445.  
  446.  
  447. APPENDIX D
  448.  
  449.  
  450. Registration
  451.  
  452.  
  453.     I begin with an apology.  I hate programs that in any way inhibit func-
  454. tionality or performance for the shareware version.  But when it came down to
  455. feeding the family and paying the bills, I had a change of heart and inserted
  456. a pesky notice that pops up at the beginning and gets on your nerves.  I
  457. chose this approach above that of limited functionality.  The program's full
  458. capabilities are available for you to evaluate before you invest your hard-
  459. earned money.
  460.  
  461.     Registered users will receive a unique serial number and instructions on
  462. how to serialize the program.  Serialization can be re-applied to updated
  463. versions and in no way hinders your use of the program.  You can compress or
  464. decompress the program with no effect (LZEXE or PKLITE).  I use Fabrice
  465. Bellard's LZEXE program on BEDIT.EXE before distribution.
  466.  
  467.     As a registered user, you will be able to update without re-registration
  468. or additional fees.  You will also be kept on my PRIVATE mailing list to
  469. receive additional information on other Parity Solutions products.  Registered 
  470. users will be entitled to a discount on any present or future Parity Solutions
  471. software.
  472.  
  473.     To register your copy, please send $10 ($45 per file server on LANs) check
  474. or money order (sorry, no credit cards yet) to:
  475.  
  476.    Gary C. Crider
  477.    Parity Solutions
  478.    1105 Burgess Court
  479.    Arlington, TX 76015
  480.  
  481.     Each license gives you or your company a single use permit for BEDIT. It 
  482. is not restricted to a single machine as long as no two users can be simul-
  483. taneously using the program.  As Borland says, "treat it like a book."  As an 
  484. example, if you register BEDIT for your home computer, but during the day you 
  485. use a portable or a computer at work,  you may keep BEDIT on both machines as 
  486. long as no one is at home using it on your home computer.
  487.  
  488.     LAN licenses grant rights to all users of a file server.  If inter-
  489. networking, a license must exist for each file server that contains a copy
  490. of BEDIT.EXE.  If two or more file servers exist on a single LAN strictly for
  491. mirroring data and fault-tolerance, these will be counted as a single file
  492. server for licensing purposes.  If in doubt, contact me.  We can work out
  493. an agreement.
  494.  
  495.     Site licensing is also available on a negotiated price basis.  I guarantee
  496. it will be an economical alternative to buying licenses for each user.
  497.  
  498.     You may freely distribute the original BEDIT.ZIP file in any way you see
  499. fit other than selling it.  Users' groups and shareware distribution services
  500. may charge a reasonable fee for the medium and duplication costs.  Bulletin 
  501. boards may not charge additional fees for downloading this specific program, 
  502. other than normal connect-time and/or membership charges.
  503.  
  504.     You are NOT licensed to give anyone your serial number unless you first
  505. remove all serialization from your computer.  You may then no longer use that
  506. serial number.  Only Parity Solutions has the authority to issue serial
  507. numbers.
  508.  
  509.