HexEdit 2.1 ~~~~~~~ ~~~ By Mike Graham. Copyright 1986,1991. April 20th, 1991. 7:26.

Contents 1 2 3 4 5 6 7 8 Introduction . . . . . . . . . Features . . . . . . . . . . . What is Freeware? . . . . . . . What does registration get you? Distributing HexEdit . . . . . Commercial use of HexEdit . . . Unlimited? . . . . . . . . . . Installing HexEdit . . . . . . 8.1 General Installation . . . 8.2 Installing for DESQview . 8.3 Installing for Windows 3.0 9 The Basics . . . . . . . . . . 9.1 Starting up HexEdit . . . 9.2 Once You're Started . . . 10 The Keys . . . . . . . . . . . 10.1 F1: Help . . . . . . . . 10.2 F2: Jump to Byte . . . . 10.3 Shift-F2: Jump to Sector 10.4 F3: Search . . . . . . . 10.5 F4: Search and Replace . 10.6 F8: Mask non-text bytes . 10.7 F9: Mode . . . . . . . . 10.8 Alt-A: ASCII Table . . . 10.9 Alt-B: Base Conversion . 10.10 Alt-C: Configuration . . 10.11 Alt-N: Next Found . . . 10.12 Alt-P: Previous Found . 10.13 Alt-S: Shell to DOS . . 10.14 Alt-T: Text Search . . . 10.15 Alt-U: Undo . . . . . . 10.16 Alt-X: Panic Abort . . . 10.17 Esc:Exit . . . . . . . . 10.18 Backspace . . . . . . . 10.19 Cursor Keys . . . . . . 11 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 3 3 4 4 4 5 5 5 5 6 6 6 7 7 7 8 8 8 8 8 9 9 9 10 10 10 10 10 11 11 11 11 12

12 13 14 15 16 17

Odd Notes . . . . . . Future Enhancements . Revision History . . . Legal Crud . . . . . . Credit where credit is Contacting the Author

. . . . . . . . due . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

12 13 14 18 20 21

i

HexEdit 2.1

By Mike Graham

1

Introduction HexEdit is a programmer's hexadecimal patch editor. "What," you ask, "is a programmer's hexadecimal patch editor?" Well, it's a special editor, similar to a text editor except that it deals with unformatted binary files, rather than nice, clean text. For more info on the uses of patch editors, see the HEXEARL.TXT file. HexEdit has evolved greatly since version 1.0 revision history is near the end of this document. back in '86. The

2

Features Handles files of unlimited size. Records all changes to a file, with an UNDO can selectively UNDO any number of changes. feature wherein you

UNDO log files can be saved to disk before you leave HexEdit, so the next time you edit the file, you will have the same changes available for UNDO. Searches files at a rate of around 10 seconds per megabyte on a high-powered machine. Fast and flexible search / search and replace. You can search with or without case-sensitivity. Searches can be aborted midstream, even when doing a replace, with no problems. High-speed, crisp response; HexEdit can keyboard accelerator I've tried it with. Random access jump to any keep up with every file.

-

-

byte(F2) or sector(SF2) of a

Location can be specified in decimal or hexadecimal format, or you can simply specify top or bottom of file. Searches for character strings or hexadecimal series'. Will store the location of up to 15,000 search matches. Move through file by jumping to locations where in the last search operation. On-line binary. base conversion table including for decimal, quick items were found and weird

hexadecimal, of

Pop-up ASCII characters.

(Alt-A)

reference

Search for random text strings (Alt-T) in binary files.

Page Two.

HexEdit 2.1

By Mike Graham

-

Swapping DOS shell Full colour customization, with all changes stored directly in the executable file, meaning no configuration files to fool around with. Panic abort of edit. If all else fails... PANIC! The file being edited will revert to its original (pre-edited) state, and you will instantly drop back to DOS.

-

3

What is Freeware? We're all familiar with the Shareware concept: you're allowed to use the product for so many days, then if you intend to continue using it you have to send a cheque for so many dollars ere you burn in hell forever. Freeware is different. We're all TOO TOO familiar with Crippleware (an evil, perverted mutation of Shareware) in which you get a product that has all of the nice features disabled. Or it dies and will never run again after a certain number of days. To get one that works, you have to cough up the money. How can you tell if it will do what you need it to DO, if you can't USE IT??? Freeware is better.

With the Freeware concept, I'm not TELLING you to send me money. I'm giving you a completely working product which you can use forever and a day without paying for, if you want. However, if you DO like this product, and you'd like to see new versions of it in the future, then it would likely be in your best interest to register the product and support my programming efforts. There is no preset registration fee (though $20 per copy used is recommended). Send whatever your conscience tells you. All I ask is that you at least cover the cost of mailing out the latest version to you (minimum $10 to cover postage, disk, disk mailer, etc.). Some of the companion products that come with HexEdit (such as HexConvert and KEYLOCK) have actually been released to the public domain. This means that I have basically abandoned all ownership of the programs (though I still reserve the names as copyright) so you can give them to anyone with no registration obligation at all. Feel free to install KEYLOCK on the machine at work, or whatever. 4 What does registration get you? If you register your product, you get the latest version mailed to on whatever size of floppy disk you specify (also specify the version have, so if you already have the latest then I'll wait and send you next one when it's out). Once registered, your name goes on file, you you the and

Page Three.

HexEdit 2.1

By Mike Graham

you will be alerted of the next release by mail (or whatever method is most convenient). At any time you can send me $10 and I'll send you the most recent version. See HEXORDER.FRM for further information regarding registration. Oh yeah, if you send me a good idea regarding alterations to improve HexEdit, or if you send in a good (read 'current and real') bug-alert, you will be automatically registered for the next version (which will include your suggestion or bug-fix). I'm expecting months or so. 5 Distributing HexEdit Feel free to upload any UNMODIFIED copies of HexEdit anywhere you like. You can ADD HexEdit-related files to the HEXEDnn.ZIP, but don't CHANGE or DELETE files. I.e, if you came up with a really amazing help screen or to release new versions of HexEdit roughly every three

icon for HexEdit, you can include it with the zip file to give to someone or distribute, but make sure that the original file remains with its original name. You can add a readme file to promote your addition. BBS Advertisements can be added, but I'd appreciate it if it doesn't appear each time you run HexEdit (i.e. those irritating RUNME.BAT files that some people come up with... I DESPISE title screens!) 6 Commercial use of HexEdit If you represent a company that would like to use HexEdit, but require a special version, detailed technical specs, source code, better documentation, site licensing, or whatever, then drop me a line, and I'll see what I can do. Changes can usually be made in a weekend, but if they're really in-depth and nasty, then it might take a week. Drop me a letter! What do you have to lose? Even if you are a mere human being, and not a company at all... 7 Unlimited? Occasionally throughout this document I will use words and phrases like 'unlimited', 'unending', 'really totally humongous' etc. It should be noted that there are limits to everything, so when I say unlimited I mean limits so huge that you have to be NASA to exceed them. For instance, I mention unlimited file size, when in reality you can only edit files of up to 2.5 gigabytes or so (well, up to almost 5 gigabytes, but I suspect it gets pretty flaky after 2.5 gigabytes.. I haven't exactly been able to test that part...). Of course, it relies on hard drive size as well, which limits most people to files of around 100 megabytes and less. For all intents and purposes, that's big enough that I can get away with saying unlimited.

Page Four.

HexEdit 2.1

By Mike Graham

8 8.1

Installing HexEdit General Installation The only file absolutely required to use HexEdit is the executable file HE.EXE. If this file is put in your path somewhere, then you should have no trouble at all. To use the on-line help, the file HEXEDIT.HLP should be copied into the same directory as HE.EXE. To use HEB.BAT for automatic backups (see subsection "Starting up HexEdit" below) then you will need to copy HEB.BAT and MAKEBAK.EXE to your path (they do not need to be in the same directory as HE.EXE).

8.2

Installing for DESQview HexEdit is a DESQview-aware application. Because of this, it can be run more fluidly under DESQview than a non-aware application could be. To install HexEdit, you should copy the HE-PIF.DVP file into the directory with HE.EXE. Now, simply pop up the DESQview main menu, select the "Open Window" menu, pick "Add a Program", and select "O" for "Other (add program not in list)". In the dialogue box that appears, fill in the directory that you copied HE.EXE and HE-PIF.DVP to. Once you hit enter, you can select to install HexEdit. Note that if you also copied the Windows 3.0 PIF file to the HE.EXE directory, then you will actually have a choice between TWO seemingly identical "HexEdit" applications to install. This is because DESQview partially understands PIF files. Pick the HexEdit in the left-hand column. HexEdit is now installed. Note that the DVP file assumes that the HE.EXE file is in the path. If it isn't, you will have to modify the DVP file slightly.

8.3

Installing for Windows 3.0 HexEdit comes with a Windows 3.0 PIF file, and two icon files. If you want to run HexEdit under Windows, then you should copy at least the PIF file to the HexEdit directory. To install, simply run Windows, select the group you want to add HexEdit to as the current group, and select "New" under the "File" menu. You will now see a dialogue box asking you whether you want to add a new program item or a new group. Make sure the "Program Item" radio button is pressed, and click on "OK". You now see the "Edit Properties" dialogue box. Type in the full path of the HexEdit PIF file (HE.PIF). Once that's typed in, click on "Change Icon", and type in the full path of one of the HexEdit .ICO files. Click on "View Next" to make sure the path is right, and you should see the custom icon. Try changing the icon path to the other icon file (there's "HE.ICO" and "HE2.ICO") and viewing it; each icon has its merit. Once the icon is selected, just click on "OK" a few times, and you're done. It's installed. You will likely have to change the PIF file slightly to specify where you copied HE.EXE, though.

Page Five.

HexEdit 2.1

By Mike Graham

9 9.1

The Basics Starting up HexEdit

Just call up HexEdit with a file name as the first parameter, and an UNDO file as the (optional) second parameter. Additionally, you can add "/MONO" after the last file parameter to force the 'factory default' monochrome colours. For a quick refresher of parameters, you can just run HexEdit with no parameters, and you will get a help screen listing all of the parameter choices. For example: "HE JUNK.DAT JUNK.LOG /MONO" will start HexEdit JUNK.DAT using JUNK.LOG as the UNDO log. The monochrome default' colour set will be used. and load 'factory

If you want HexEdit to make a backup of the file you're editing, then replace "HEB" for "HE" in the above commands. HEB is a batch file that automatically copies whatever file you want to edit to a file with the extension .BAK. If the file you're editing IS a .BAK file, then a file with the extension .BA0 will be created. 9.2 Once You're Started

The file is read in, and you see the first page (256 bytes) of it. It looks sort of like this: �[Editing: C:\UTIL\HE\HE.EXE]������������������������������[HexEdit 2.1]����� Found: 127/290 Changes : 4297 Mask:Off Mode:C Page:1 Current Sector: 39(00000027) Byte: 20360(00004F88) Total Sectors : 127(0000007F) Bytes: 65503(0000FFDF) ����00�01�02�03�04�05�06�07�08�09�0A�0B�0C�0D�0E�0F������0123456789ABCDEF���� 00- 74 69 6F 6E 20 6F 66 20-48 45 58 45 44 49 54 2E -00- tion of HEXEDIT. -00 01- 54 58 54 20 66 6F 72 20-6D 6F 72 65 20 69 6E 66 -01- TXT for more inf -01 02- 6F 72 6D 61 74 69 6F 6E-2E 36 54 68 65 72 65 20 -02- ormation.6There -02 03- 69 73 20 6E 6F 20 64 69-66 66 65 72 65 6E 63 65 -03- is no difference -03 04- 20 62 65 74 77 65 65 6E-20 74 68 65 20 72 65 67 -04- between the reg -04 05- 69 73 74 65 72 65 64 20-61 6E 64 20 6E 6F 6E 2D -05- istered and non- -05 06- 33 72 65 67 69 73 74 65-72 65 64 20 76 65 72 73 -06- 3registered vers -06 07- 69 6F 6E 73 20 28 74 68-69 73 20 69 73 20 4E 4F -07- ions (this is NO -07 08- 54 20 43 72 69 70 70 6C-65 77 61 72 65 21 21 21 -08- T Crippleware!!! -08 09- 21 21 29 2E 0F 20 20 20-20 4D 69 6B 65 20 47 72 -09- !!). Mike Gr -09 0A- 61 68 61 6D 0D 20 20 20-20 42 6F 78 20 36 30 30 -0A- aham Box 600 -0A 0B- 33 36 18 20 20 20 20 55-20 6F 66 20 41 20 50 6F -0B- 36 U of A Po -0B 0C- 73 74 61 6C 20 4F 75 74-6C 65 74 10 20 20 20 20 -0C- stal Outlet -0C 0D- 45 64 6D 6F 6E 74 6F 6E-2C 20 41 42 13 20 20 20 -0D- Edmonton, AB -0D 0E- 20 43 61 6E 61 64 61 20-20 54 36 47 20 32 53 34 -0E- Canada T6G 2S4 -0E 0F- 3C 20 6F 72 20 63 6F 6E-74 61 63 74 20 22 6D 69 -0F- < or contact "mi -0F ����00�01�02�03�04�05�06�07�08�09�0A�0B�0C�0D�0E�0F������0123456789ABCDEF���� F1:Help F2/SF2:Jump F3:Search F4:Srch/Rep F8:Mask F9:Mode ESC:Exit Alt keys: A:Ascii B:Base C:Config S:Shell X:Abort! T:Text U:Undo ����������������������������������������������������������������������������� At the top, you see the name of the file being patched (in this case, HE.EXE) and the version of HexEdit. On the next line you see 'Found: 127/290' which indicates that the last search you did resulted in 290

Page Six.

HexEdit 2.1

By Mike Graham

finds, and you most recently jumped to the location of the 127th found item (think of it as location 127 of 290 locations). In the center of that line you see 'Changes: 4297'. This indicates that 4297 modifications have been made to the file (use UNDO (Alt-U) to restore the file to its original form). To the right is 'Mask:Off'. This is the indicator for the text filter mask. Farther to the right is 'Mode:C'. This indicates that you're currently in character editing mode, so any key you hit (besides arrow keys etc.) will overwrite the character under the cursor. If you were to change to hex mode (F9) then you can edit the hex value of the byte directly (the C will change to an H). Farther to the right is 'Page:1'. This tells you that you're on the second (numbered from 0) 256 byte chunk (or 'page') of the current 512 byte sector. On the next line is the number of the current 512 byte sector within the file (in decimal, with hex in the brackets) and the offset of the current byte (hex in the brackets). The next line is similar to the one above, except that it indicates the maximums for the file, i.e. the number of sectors and bytes in the file. Bytes, pages and sectors are numbered with the first one being zero. Everything else is pretty obvious. A word about nomenclature: a file is divided in to any number of 512 byte sectors, which are in turn divided into two 256 byte pages. At any given time you are looking at ONE PAGE of the CURRENT SECTOR. Any time you specify a sector target, you will jump to the first PAGE of that sector (in other words, you might have to hit page-down once after the jump to get where you want to be if you wanted the second page of a certain sector). 10 10.1 The Keys F1: Help This key will call up the one-page text file 'HEXEDIT.HLP' if it can be found in the same directory as the HexEdit executable file. Feel free to edit this file to your liking. 10.2 F2: Jump to Byte Hitting this key will call up a command line which asks: 'Byte to jump to [dec/$hex/MIN/MAX/F/L/N/P]'. The net effect, is that if you type in a decimal number like '100' or '51231', then you will be instantly transported to that byte (Remember! Bytes are numbered from ZERO, so byte #1 is the second byte in the file). If you type in a hexadecimal string beginning with a dollar sign (i.e. '$F10F') then you will jump to the byte denoted by that value. If you type in MIN, you will jump to the first (minimum) byte, MAX will jump to the last (maximum) byte in the file. F is the first found item, L is the last found item, N is the next and P is the previous found item.

Page Seven.

HexEdit 2.1

By Mike Graham

10.3

Shift-F2: Jump to Sector This works almost exactly the same as F2 except that if you specify a number in decimal or hex, you will be 'jumped' to the first page of that SECTOR, not BYTE. Other than that, the MIN/MAX/F/L/N/P choices work exactly the same. You will find that you will generally use F2, but this function is included for completeness.

10.4

F3: Search This feature works differently depending on whether you CHAR editing mode. If you are in HEX mode, it will prompt a HEX string. If you're in CHAR mode, then it will prompt a character string. After the string is entered you will to whether you want the search case sensitive or not. instead of <ENTER> to terminate input of the search string search to abort. are in HEX or and search for and search for be prompted as Hitting <ESC> will cause the

10.5

F4: Search and Replace Same as search (F3) except after the case sensitivity prompt, you are asked for a string/hex series to replace the search string/hex series with (must be the same length if hex, can be shorter if you're searching for text (string will be padded with space (ASCII 32) characters if shorter). After the replacement string/series is entered, a box pops up asking you if the details are correct (remember: short strings are padded at the right!). If not, you can retype the replace string/series until it IS right (or ESC to abort). After the replace string/series is entered correctly, you are asked whether you want to be prompted for each replace. If you indicate that you do NOT want to be prompted, then everything will happen automatically, and every occurrence of the searchstring/series in the file will be replaced by the replace string/series. If you indicate that you DO want to be prompted, then every time the search string is found, you are prompted whether you want to 'Replace? <Y/N/A/Q>'. 'Y' and 'N' are simply 'yes' and 'no'. If you want to replace this occurrence, then type 'y'. If you don't want to replace this occurrence, then type 'n'. If you type 'A' (for Automatic or All) then all of the remaining occurrences will be replaced automatically. If you type 'Q' (for Quit), then you will be returned to the main HexEdit screen without replacing this, or any subsequent occurrences.

10.6

F8: Mask non-text bytes Hitting this key will toggle the text mask on and off. When active, the text mask causes all bytes that are not text bytes (i.e. ASCII #32-#126) to appear on the screen as periods ('.') rather than as their

actual values. This is convenient when you are looking through a file, and want to view only the textual information (see also Alt-T: Text Search). 10.7 F9: Mode Toggle between character editing mode and hex editing mode. In character editing mode you can replace characters by typing directly with

Page Eight.

HexEdit 2.1

By Mike Graham

the keyboard (the cursor will be on the character array on the right hand side of the screen). In hex mode, you enter the hex codes with the keyboard, and the characters are replaced with the ones represented by that hex code (the cursor will be on the hex grid on the left side of the screen). 10.8 Alt-A: ASCII Table Hitting this key will pop up an ASCII table which has fairly simple commands. All of the standard cursor commands (PGUP, PGDN, ARROWUP, ARROWDN, HOME, and END) do things that make sense, so it shouldn't be a really stressful thing to get the hang of. Hit ESC when you're done with it. 10.9 Alt-B: Base Conversion Hitting Alt-B will pop up a small window in the upper-left corner of the screen. There are three lines in this window. The first line is the value in decimal, the second hexadecimal, the third in binary. On popup, the value displayed will be whatever value was under the cursor when you hit Alt-B. Once in the window, however, you can tab about the lines and change them. A change in one is reflected in them all. Hit ESC to return to HexEdit. 10.10 Alt-C: Configuration Change the default colours. If you're running a monochrome system, you might not want to run this, as I designed default colours that work pretty nicely for monochrome, but it never hurts to check it out. It's REAL easy. After hitting ALT-C, you will be looking at a box with a list of items down the left, and a facsimile of the HexEdit main screen on the right. Just use the cursor keys to pick the item to change. Once you have selected an item, you get the attribute box, which shows you the current foreground/background/blink options for that item. You use the cursor keys to change the colours (note the sample colour swatch at the bottom of the attribute box). When you have the colour set the way you want, just hit enter, and you will return to the main configuration box, and the screen will be updated with the colours you selected. If you

pick some really gross colours, and decide to switch back to the colours you had before you entered the configuration section, just select "RESTORE". Once you have the screen the way you like it, just hit <ESCAPE> and you will be asked whether you want to save the changes to disk or not. If you reply no, then the changes will last for the current editing session only, otherwise they will be saved permanently. Just give it a try and see what happens. Changes are written directly to the HexEdit executable. Note that you can rename 'HE.EXE' with impunity. HexEdit always knows what you've renamed it to. The only thing that needs to be changed if you rename HE.EXE is HEB.BAT. By default, HEB calls "HE %1 %2 %3 %4". If you change the name of HE.EXE, than you should change HEB.BAT accordingly.

Page Nine.

HexEdit 2.1

By Mike Graham

10.11

Alt-N: Next Found This is just a shortcut item on the FOUND list. for F2/N. It will jump you to the next found

10.12

Alt-P: Previous Found This is just a shortcut for F2/P. found item on the FOUND list. It will jump you to the previous

10.13

Alt-S: Shell to DOS Use this function to quickly drop to DOS to copy files etc. Just type "EXIT" at the DOS command line to return to HexEdit. A note regarding swapping to DOS: don't delete any of the files that are in use by HexEdit while swapped to DOS! I.e. don't delete the file you're editing, or the HEXEDIT.LOG file, or the HEXEDIT.SWP file!. Changing directories is okay, but you DON'T want to delete any files that are currently open. If you DO delete any of the really important files (even if they have a 0 file size) then bad things could happen, and you will likely have to run a CHKDSK/F to clean things up.

10.14

Alt-T: Text Search Search for random strings of text (ASCII characters 32 to 126) of a certain minimum length. For instance, you're patching COMMAND.COM, and you want to change the name of the batch file that's executed on start-up (i.e. instead of AUTOEXEC.BAT, make it RUNME.BAT). After you've done this with a quick search and replace (F4), you suddenly wonder to yourself "Gee, I wonder what ELSE I can change?". Rather than using

PGUP/PGDN to crawl around the file looking for text, you can simply do a text search for strings with a length of 12 or so. This will find all the interesting (changeable) parts of the file. Give it a try. It's hard to explain, but you'll like it. 10.15 Alt-U: Undo You can undo an unlimited number of changes made to the file currently being edited. After you hit Alt-U, you will be prompted for the number of changes to undo (the default is 1, or whatever number you undid the previous time). You can either type in a number (decimal only.. why bother with hex in this instance?) or either of the keywords 'ALL' or 'PURGE'. Entering 'ALL' will undo all of the changes, just as if you had typed in the number of changes that had actually been done (saves you from typing weird numbers all of the time). If you enter the keyword 'PURGE' instead of a number, then you will be prompted for the number of changes to retain. For instance, say you had done a rather huge search and replace and had replaced 100 20 character strings (resulting in 2000 changes). Perhaps you don't want all 2000 changes in your logfile. If you don't, you can hit Alt-U to pop up the UNDO prompt, enter 'PURGE', then enter 20 or something somewhat smaller to reduce the size of your purge file. You don't HAVE to do this... the undo file can grow to any size that your hard drive will permit, but sometimes it's nice the prune the sucker down. Remember that when you UNDO something, that UNDO action

Page Ten.

HexEdit 2.1

By Mike Graham

is added to the UNDO log... the net effect is that if you keep UNDOing one action, you will just toggle between two values and keep adding to the UNDO log. For instance, if you change a 'b' to an 'a' and back again, then HexEdit remember each change, even though they are redundant (i.e. you're back where you started from). Keeping this in mind, another example of when you would want to purge would be if you had done a massive search and replace, then decided that you really didn't want to do that... If you UNDO the search and replace, then you have redundant UNDO records in the log: a set of records changing the file, and a set changing it back. You can PURGE the log down to what it was before the whole search and replace fiasco, and still be able to UNDO everything. What the heck; if you want to do it, do it. Remember: if you purge the UNDO log, the panic-abort option may not restore the file entirely (unless the changes you purged were redundant). 10.16 Alt-X: Panic Abort Hitting this key combination pops up a window which asks if you really want to fast-abort the edit. If you respond yes, then all of your changes to the file are undone, and you are immediately kicked out to DOS. Use this if you have maimed the file you're editing beyond all recognition, and just want to get out HexEdit, lick your wounds, and hope

nobody ever finds out about the incident. Note that HexEdit can only UNDO the changes that are recorded in the current UNDO log, so if you have PURGED it, you're out of luck. 10.17 Esc:Exit If you. 10.18 you can't figure this one out, you need more help than I can give

Backspace Yes, believe it or not the backspace key gets a separate subsection. When you use the backspace key, the cursor will move one space to the left, and it will additionally undo any changes made to the character on the space it just moved onto. Note that this is not the same as the ALT-U UNDO, this is just a quick way to undo changes that haven't been saved yet. Just type in a couple of characters and hit the backspace key a few times and you'll see what I mean. You'll love it!

10.19

Cursor Keys See the on-line help file "HEXEDIT.HLP" (F1) for fast reference to all of the movement key assignments. The only thing you need to remember is that if you hit the up arrow when you're at the top of the current page, then you will move to the bottom line of the previous page. All of the cursor keys work in that fashion. A little experimentation will reveal all.

Page Eleven.

HexEdit 2.1

By Mike Graham

11

System Requirements HexEdit requires one floppy disk drive, and 384K of memory. However, just because HexEdit will USE pedestrian hardware doesn't mean it LIKES it. Give HexEdit hard drives and things like that, and you will have a friend for life. For ultimate performance, run it on a RAM disk. EMS will be utilized for the swapping DOS shell (up to about 700K or so) if it's found. The only incompatibility that I know of is this: HexEdit uses direct memory checks to see if a key has been pressed. For this reason, if your system has the keyboard buffer in a nonstandard place, then you might have problems aborting from searches etc. TSR programs that expand the keyboard buffer are known to cause problems. Note that HexEdit currently even works on Tandy 1000's, so any clone that calls

itself "100% compatible" should work with no problems. 12 Odd Notes These are methods. NOT bugs, they're simply somewhat unexpected operating

You may find the cursor speed in HexEdit to be not so hot. HexEdit uses BIOS functions for most keypress functions, therefore it can only go as fast as your keyboard sends the keypress info. If you use a keyboard accelerator like Cruise Control, PC-Kwik key, or something similar then you will find MARKED improvements. HexEdit spends about 80% if its time waiting for keystrokes, so if you use an accelerator then you can pump keystrokes into HexEdit MUCH faster, making for faster scrolls, etc. Note also that if you use DOS 4.01 or better, then you can use the command "MODE CON:RATE=32 DELAY=2" and that will speed up the keyboard as well (though not NEARLY as fast as Cruise Control or PC-Kwik key can). HexEdit REQUIRES DOS 3.0 or better. It might work on prior releases, but some of the features might not work properly. The reason it needs the recent DOS is because HexEdit needs to backtrack the executable file in order to do the configuration, find the help file, etc. The file is saved as you go along. Whenever you change the displayed sector, the 'Changes: n' display at the top of the screen starts blinking. Also, every character that has been altered is highlighted. When you try to exit or move from this sector using PGUP or PGDN or whatever, you will be prompted whether you want to save the sector or not. If you answer yes, the sector will be saved to disk within the original file, otherwise the changes will be discarded. Note that these saves are made directly to the original file, so if you want to play around with a file, and you're too paranoid to trust the wonderful UNDO feature, then you should use the HEB.BAT file which is documented above.

-

-

Page Twelve.

HexEdit 2.1

By Mike Graham

13

Future Enhancements Most of these enhancements will happen in phases. The next big phase is conversion to TurboVision. Each potential enhancement has been labeled either "Soon", "TVision" or "Maybe". Enhancements labeled "Soon"

will appear in the next version or two. Enhancements labeled "TVision" will appear when I convert to TurboVision (during the summer, hopefully). Those enhancements labeled "Maybe" are ones that I haven't even decided whether I'll DO yet. Soon: Keyboard remapping will be implemented in the next version or two to allow people to change the default keys to whatever they happen to want them to be. Final implementation of my buffered file access unit will be happening soon, too, which will nail shut all of the disk thrashing problems. Some day, I will code a method to actually INCREASE or DECREASE the size of files, in order to do a search and replace with unlike-sized search and replace strings. At first I thought that this would be somewhat of a waste of time, because you can't mess around with the innards of an executable file THAT much without REALLY knowing what you're doing. I have been informed, however, that people also use HexEdit to edit binary data files, and an unlike-sized search&replace would be VERY handy. Okee dokee.

-

-

TVision: Pull-down windows will be implemented with course). I'm partially against it, but I sort of happen sooner or later. If anyone would implementation of menus, it's me; remember I've keystrokes for 5 years! Ah well. There but for user go I. Upon conversion to reality! The pop-up release. TurboVision, TurboVision (of know it has to suffer at the been using these the grace of the

Maybe:

editing multiple files will be a with the TurboVision

calculator

will be thrown in

Context-sensitive help Enhanced screen customization Mouse support

Page Thirteen.

HexEdit 2.1

By Mike Graham

-

Do we want to be able to patch disk sectors directly? I'm not sure. That's not really the PURPOSE of HexEdit, but it wouldn't be too hard to do. How about a directory editor? Unerase? Maybe as a separate product? Feedback! Need user feedback!

Well, Frank Lenk (senior editor of Computing Now... wonderful magazine) recently put up his list of "Bare Necessities" for the applications of today. Well, HexEdit holds up pretty well (once the TurboVision release hits the streets). The point in Mr. Lenk's editorial that really hit home for me was his including "A Future" in with his vital attributes. That's something that not everyone thinks about when they buy software. One example of an excellent product that appears to have no future is Borland's Sprint. I'm one of the many people who bought Sprint only to find out that it's basically a dead product now. Sure it's powerful, and it does an excellent job with text documentation (such as the documentation you're reading right now) but if there's no new development happening, then how long is it going to STAY powerful? What about printer drivers, etc? The point of my meandering is that I've sweated blood over HexEdit, and there's more where that came from, so you can rest easy. HexEdit will continue to evolve for as long as the money keeps rolling (limping, crawling) in. 14 Revision History (Reverse chronological order) Version 2.1: April 20, 1991 A vast improvement over 2.0. New Additions: The HEB.BAT file was added to pacify the people who REALLY want to have .BAK files. F8 now toggles a text mask which, when active, causes all non-text characters to appear on the screen as a period '.'. ALT-N now jumps to next found item. ALT-P now jump to previous found item. ALT-X is now the panic button (previously ALT-P). ALT-A now pops up an ASCII table. ALT-S will call a fully swapping DOS available, otherwise swaps to disk). shell (swaps to EMS if

Page Fourteen.

HexEdit 2.1

By Mike Graham

-

Backspace now works in a much more intelligent way, rather than just being the same as a back-arrow. The FastRep program was added as a very vertical-market, niche application that I happened to have lying around and thought someone might be able to use. I tossed in KEYLOCK as well, even though it has nothing to do with HexEdit at all (but it's SO nice to add to your autoexec.bat to shut off the bleedin' NUM lock). Windows support has been greatly expanded with a PIF file, two icon files, and enough rewrites to let HexEdit run in a graphic window. Pretty nifty. DESQview support has been enhanced as well. HexEdit is DESQview-aware application, and there is a .DVP file included. a

-

-

Fixes: -

That weird bug regarding searches solved (it was Windows' fault).

being SO SLOW under Windows was

The search engine was heavily modified to remove some intermittent problems dealing with finding null characters, and finding strings that overlapped sector boundaries. The UNDO engine was rebuilt from the ground up. fast and clean it even amazes ME. It now works so

-

A really dumb bug was found (sharp eyes, Craig!) in the Jump routines. If you used Shift-F2 (for jump by sector) and selected to jump to the next found item, it wouldn't jump there in all cases. Dumb dumb dumb. Documentation overhauled.

-

Version 2.0: February 16, 1991 The official release! Very clean... no known bugs. You can now abort from searches and UNDO activities. Percent-done boxes were added to the UNDO engine, so now everything that can possibly take more than a second or two now has a percent-done box and the facility to abort the process cleanly. Also added was the /MONO parameter, and the RESTORE function in the configuration. I think I'll take a break from programming HexEdit for a little while to work on my next big project (still top-secret, but it will make efficient programming a MUCH more enjoyable experience).

Version 1.9g: February 9, 1991 a There were actually fairly few bugs to fix for this release. There was weird bug that only appeared if you were editing files with sizes that

Page Fifteen.

HexEdit 2.1

By Mike Graham

were evenly divisible by 256. Go figure. I modified the exit prompt to revert to the old default of 'Y' instead of 'N'. The position bar things on the main screen (the ones that show you what byte you're on... you know, those hex things in highlight at the side and top of the screen?) were a bit hard to track if you were far away from them, so I added more at the right and bottom of the screen. One or two minor things were improved, but basically this is version 1.9e with a minor facelift. (1.9f was not released). Also added was the 'Panic Button' (Alt-P) which will automatically undo all of your changes, and kick you out to DOS with the file in it's original, pristine condition (providing you haven't PURGED the UNDO log). Also, I swapped F2 and SF2, so that F2 is now Jump by Byte, rather than Jump by Sector. I did this because Jump by Byte is used MUCH MUCH more often. (Jump by Sector was F2 by inertia... it had been F2 for over five years..). I went over HexEdit with the Turbo Profiler, and I found that HexEdit spends about 85% of it's time waiting for user keypresses, and that's when the a key is HELD DOWN. Quite efficient. The search could use a minor tweak, though. So could the UNDO function. Using Turbo Pascal 6.0, I was able to compile HexEdit to a 57K executable!!! Unbelievable! I am... speechless. Version 1.9e: February 3, 1991. I've managed to streamline the code further; we're down to about a 70K executable file. A few programming glitches were exterminated, including one miserable bug that still amazes me to this minute. The previous version of HexEdit, 1.9d, required a math coprocessor. I don't know WHY, but it did. I guess I just left the compiler switch in the wrong position. Anyway, because I HAVE a coprocessor, I never noticed this flaw. Things like this BUG me. The other things that were fixed included some idiosyncrasies regarding saving log files, and some general cursor movement stuff. The cursor routines were updated so that if you're at the top of a page and cursor up, you will automatically PGUP. The net effect is that you can scroll through a file with the cursor. Version 1.9d: January 30, 1991. Several bugs were fixed in this release. The major ones were in the UNDO engine which I thought worked like a charm (of course). Many minor

changes were also implemented, including changing the 'Exit to DOS' prompt to default to no, and changing the F3/F4 key assignments. Documentation updated. I rewrote a lot of the code to more heavily encapsulate it. HexEdit now consists of TEN source files. Every major function (jump, search, undo, etc.) each has their own unit. Makes for faster compiles. Anyway, this rewrite caused a few things to glitch, but I think I have them all sorted out. We're up to 7000 lines of code now, with almost 3000 lines of it being HexEdit-specific, and the rest library-specific. Changed default colours to something that looks pretty bland, but is visible for monochrome users without being utterly disgusting in colour. Previously, monochrome users were right out of luck because they couldn't even SEE the prompts and stuff in the configuration section. Now, if they screw up the colours they only have themselves to blame...

Page Sixteen.

HexEdit 2.1

By Mike Graham

Version 1.9c: January 26, 1991. I'm home from work, and I can see that there were quite a few minor things wrong with the UNDO. They're fixed. This release will be the official BETA release for this week. I've fixed some glitches in the configuration section that were driving me absolutely around the bend. It's weird how sometimes the small bugs can drive you nuts when the big ones get fixed fast. I re-coded the base conversion procedure and saved 25K in the bargain. I'm not sure if I like it as much, though. Figures. I've decided to release only one BETA version per week, that way I don't have people pointing out bugs that I've already fixed (for a while there, I was always a version or two ahead of the BETA testers). Version 1.9a: January 26, 1991. Added UNDO, and BYTE JUMP. Modified the screen layout to display total sectors and total bytes. This release was VERY hurried. I got the undo working about a half an hour before I had to be at work... I started the upload and RAN. I knew it worked for the easy test instance I gave it, but I did no real testing. I'll be more considerate for future BETA releases (I mean, even the word 'BETA' doesn't excuse THAT many sins...) Version 1.4b: January 10, 1991 (I took a rest.) Added Search/Replace. Also modified HexEdit to track down what its executable filename is, so you can rename the executable with impunity and the self-modification still works. Also, the help files and such are no longer searched in the path. Everything is looked for in the directory in which the HexEdit executable resides.

Version 1.3b: January 5, 1991 (I don't learn, do I? :-> ) Added option to select window style (no more totalitarianism for THIS guy). Added a procedure to search for any TEXT (ALT-T). I.e. if you're looking for text, ANY text, in a humongous file, you can specify to find a string of characters at least n characters long, and it will find them. Also added a selection for case-insensitive searches. Version 1.2c: January 3, 1991 Fixed a few bugs (yeah. real, ugly bugs). Nothing else really changed. This was an emergency release, something I hope not to have to repeat. I guess you're kind of asking for it when you release three versions in two days.... I documented the call for base conversion as Alt-B, but coded it as Alt-H. I must have been tired. Version 1.2b: January 3, 1991

Page Seventeen.

HexEdit 2.1

By Mike Graham

Version 1.1b with a face-lift. I've added the ALT-C configuration section that modifies the EXE file directly to set colours. Works nice, but you can't LZEXE the file until after you have it configured. Ah well. If you have UNLZEXE or use PKLITE, then you can always just create a batch file that uncompresses HexEdit, runs it, and then compresses it again for those few occasions when you need to redefine the colours. Of course, you can just set them once then compress it. This would keep you going for the rare occasions that you need to reconfigure HexEdit. Also added was the ALT-B base conversion utility. A few minor critters were cleaned up (the kind that never pop up unless the user does something WRONG. I've got to work on the user-hostility HexEdit tends to exude.). Version 1.1b: January 2, 1991 After using my patch editor in a mostly-working capacity for a long time, I started a project wherein I had to figure out the Turbo Pascal TPU file structure. Well, I spent a LOT of time using HexEdit, and I became painfully aware of its limitations. I abandoned my TPU project (I've got to get back to it, though) and rewrote HexEdit. Version 1.1 is basically a total rewrite, with support for files of any size etc. The speedy search was refined, blockreads and writes are used for speed. Many of the seams were caulked, and it appears a much more bullet proof application.

Version 1.0: circa 1986 I first wrote 1.0 way back a few years when I was around 16 years old. It sort of worked, and I used it faithfully, but it wasn't distributed much. It would only handle files of up to 50K (No, I'm not kidding) and it generally handled like a dog. Not bad for a 16-year-old, but not great. It took forever to read and save files (files were defined FILE OF BYTE... Turbo Pascal version 3.0). I'm not entirely sure why I kept using it... I guess because it was free! 15 Legal Crud As far system: as hardware compatibility goes, here is the HexEdit standard

Dell system 310 20MHz 386 Dell DOS 4.01 and Dell OS/2 1.21 8MB RAM 155MB CDC Wren III hard drive Archive tape backup unit ATI VGAWonder/NEC MultiSync 3D

Page Eighteen.

HexEdit 2.1

By Mike Graham

-

HP LaserJet III Roland LAPC Synthesizer card with Rhodes 760 keyboard Logitech Series 9 bus mouse Gravis Deluxe joystick and controller Artist's mannequin Profile of me, done when I was in grade 2, on the wall. Two gumball machines. Me.

-

A big Pioneer stereo with no less than FOUR remote controls and lots of CDs by Enya, Robert Palmer, Billy Joel, Chris de Burgh, The Moody Blues, and the B-52's. A fridge with lots of Grapefruit juice in it. thing in the morning..) A&W Rootbeer and President's Choice (Not even *I* can handle rootbeer first standard that you that it standard

-

This is the standard system. If your system doesn't match the system EXACTLY, right down to the last mote of dust on the nose crank on one of my gumball machines, then I do not guarantee works (in fact, I don't even guarantee that it will work on the system!).

I will say, however, that I've never found a system that professes to be 100% PC compatible that HexEdit doesn't like. Basically, I don't guarantee anything. Every word of this document could be a big lie. I could be sitting at home snickering, thinking of all the people who wasted their on-line time downloading a patch editor that doesn't work. I might ENJOY typing in a thousand lines of sundry documentation in the hopes of sucking some poor individual into wasting their time with a worthless product. I'm not, and I don't, but I could be, and I might. If HexEdit works for you, then great, I'm happy, send me money. doesn't, then darn, I'm ashamed, send me a letter describing the and I'll do my best to fix it. If it error

Page Nineteen.

HexEdit 2.1

By Mike Graham

16

Credit where credit is due The following wonderful folks generously donated some of their valuable time to aid in BETA testing HexEdit: Neal Sanche Monroe Thomas, Sysop of The Keep Ben Graham

Paul Brown Craig Harris Thanks to Martin Silva for catching that odd bug in the search algorithm. Supreme thanks to j William Donovan, who taught me Turbo Pascal when I was just a wee shaver. I used the TechnoJock Turbo Toolkit windowing and fastwrite library for Turbo Pascal 5.5 in the later versions of HexEdit. It is a spiffy product, well worth the money. TechnoJock Software Inc. PO Box 820927 Houston, Texas 77282-0927 Also used was Kim Kokkonen's EXECSWAP unit. Turbo Pascal just wouldn't be the same without that guy... Kim is the president of TurboPower software, which is a major producer of Turbo Pascal programming tools. If you program Turbo Pascal and don't own any Turbo Power software products, you should seriously look into it. You can contact Kim at: P.O. Box 66747 Scotts Valley CA 95066

Page Twenty.

HexEdit 2.1

By Mike Graham

17

Contacting the Author I can be reached by mail at the following address: Michael A. Graham Box 60036 U of A Postal Outlet Edmonton, AB Canada, T6G 2S4 Or I can be contacted on InterNet as "michael_graham@mts.ucs.ualberta.ca". (if that doesn't work, substitute "MGRM" for michael_graham. I can be contacted on the McNamara Software BBS in Edmonton, Alberta, (403)433-8375, as "Mike Graham" and am also available under the same name at The Keep BBS, also in Edmonton, (403)437-1428. The latest version of HexEdit and all of my other PD and Freeware programming efforts will always be available on these two BBS's. Feel free to contact me if you have suggestions for improvements, or (perish the thought!) a bug report.

Page Twenty-One.

#