home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- This document describes the program TINYPROG.EXE.
-
-
-
- Tranzoa, Co.
- P.O. Box 911
- Maple Valley, WA 98038
- (206) 432-3532
-
- -----------------------------------------------------------------
-
-
- WHAT TINYPROG DOES FOR YOU
-
-
- Makes EXE or COM file programs smaller.
-
- Stops corrupted or patched programs from running.
-
- Makes EXE files as easy to self-configure as COM files.
-
- Encrypts programs to make internal text unreadable.
-
-
- -----------------------------------------------------------------
-
-
- WHAT TINYPROG NEEDS TO RUN
-
-
- PC or compatible computer.
-
- DOS 2.x or higher.
-
- 90k bytes of memory plus 10k bytes for every 2500 relocation
- table entries in EXE files to be converted.
-
-
- -----------------------------------------------------------------
-
-
- WHAT PROGRAMS CONVERTED BY TINYPROG NEED
-
-
- PC or compatible computer.
-
- DOS 2.x or higher.
-
- Possibly more memory than the original program. (See below.)
-
-
- -----------------------------------------------------------------
-
-
-
- 1
-
-
-
-
- HOW TO RUN TINYPROG
-
-
- C>TINYPROG original.exe smaller.exe
- or
- C>TINYPROG original.com smaller.exe
-
- These commands convert the file, ORIGINAL.xxx into
- SMALLER.EXE. If ORIGINAL.xxx is over a few K bytes in size,
- SMALLER.EXE will be from 10% to 50% smaller. When run, SMALLER
- may load slightly slower from RAM disks and hard disks than
- ORIGINAL.xxx did. But, you may not be able to detect the
- difference.
-
-
- C>TINYPROG original.exe
- or
- C>TINYPROG original.com
-
- These commands convert the file, ORIGINAL.xxx into the file,
- ORIGINAL.EXE. The original program file, ORIGINAL.xxx is copied
- to ORIGINAL.BXE if the file, ORIGINAL.BXE does not already exist.
-
- -----------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2
-
-
-
-
- RESTRICTIONS
-
-
- Special programs............................................
-
- TINYPROG will not work on these programs:
-
- COMMAND.COM
- IBMBIO.COM
- IBMDOS.COM
-
- These programs are COM files in name only,
- and MUST NOT be converted!
-
-
- Device drivers..............................................
-
- Device drivers cannot be converted by
- TINYPROG. As a precaution, TINYPROG will not
- convert files with .SYS or .BIN file name
- extensions, or files that TINYPROG senses to be
- DOS device drivers.
-
-
- Self-configuring programs...................................
-
- A few programs configure themselves by
- writing data back to the program file, itself.
- They cannot read or write a copy of themselves
- that has been converted by TINYPROG. Many will
- sense if their program file is not as they expect.
- Some programs of this type do not check! They
- simply clobber the TINYPROG'ed version of
- themselves. Usually, you can use TINYPROG to
- convert this type of program after you have
- configured the program.
-
-
- Programs with internal overlays.............................
-
- TINYPROG may sense programs that contain
- overlay modules in their own program file. (See
- below.)
-
-
-
- Otherwise...................................................
-
- Run TINYPROG on any other program, either EXE or COM file,
- that you want to convert.
-
- If TINYPROG tells you to use the /A, /C, or /I options, and
- the program you are converting is not your own, stop right there.
- You should not convert this program.
-
-
- 3
-
-
-
-
-
- The request for the /A option tells you that this
- program has already been TINYPROG'ed. Doing it again
- may harm the program by throwing away special, 'user-
- data,' information that the program contains.
-
- The request for the /C option tells you that
- TINYPROG thinks that the input file is both a COM file
- and is too big to be a good COM file.
-
- The request for the /I option tells you that this
- program cannot be run through TINYPROG without losing
- some of the original program file. If you do not know
- what that program's extra file information is
- (overlays?), you are safer to leave the program alone.
-
-
- Run the converted program to verify that all is well. Keep
- a copy of the original program backed-up somewhere, of course.
- Use DOS commands to copy/rename the converted program to the
- original program file name.
-
- -----------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4
-
-
-
-
- PAY TO PLAY
-
-
- Programmers:
-
- If you use TINYPROG to make yourself money or to save time
- or trouble, then you and your organization will want to feel good
- about yourselves. We will, too. If you are a software
- developer, you probably know that highly optimized assembly
- language and custom data compression algorithms don't come easy.
- So, please send to Tranzoa the price - to you - of the
- alternative to TINYPROG, plus 1/10th of what TINYPROG is worth to
- you beyond that alternative. Or, 15 dollars. Whichever is more.
-
- Naturally, we will send to you a copy of TINYPROG without
- the "shareware irritant" - the random number prompt.
-
- Oh, by the way, your program will be clearly converted by
- TINYPROG.
-
-
- Users:
-
- Well, what's disk space cost, anyway? Not much. So we
- don't expect much in return. But if it's your turn to chip in
- for that vast, "free-software" universe that we all use to make
- our PC's valuable, please keep Tranzoa in mind.
-
-
- Everybody:
-
- There are two versions of this program. One version, you
- have paid Tranzoa for; the other, you did not. Which version do
- you have? The paid-for version does not ask you to type a random
- number when it converts a program.
-
- The version that you paid for is yours to use where and when
- you wish. But if someone else is using your copy, you should not
- be using it.
-
- The other program version (the one that you did not pay
- Tranzoa for), you may use, copy, and give to whomever you choose.
- You may not resell it, though, for more than a nominal charge (in
- mid-1990: $10) either alone or in combination with any other
- product without getting the OK from Tranzoa.
-
- Of course, programs that you convert with TINYPROG are your
- own business and responsibility.
-
-
-
- -----------------------------------------------------------------
-
-
-
-
- 5
-
-
-
-
- TINYPROG COMMAND LINE OPTIONS
-
-
- To detect command line options, TINYPROG understands both
- '/' and '-'. You must rename files whose names begin with the
- dash ('-') character in order to run TINYPROG on them.
-
- The command line options can actually be in any order, to
- the left or right of the file names.
-
-
- Here are the details of the command line options:
-
-
- /A This switch tells TINYPROG to convert a file even
- though the file looks like it has already been produced by
- TINYPROG. We use this switch in testing.
-
-
-
- /C This switch tells TINYPROG to create the output EXE file
- even though the input file, which is not an EXE file, is really
- too long to be a reasonable COM file.
-
-
- /I This switch tells TINYPROG to convert an EXE file even
- though the EXE file is too much longer than its "load image."
- The "load image" is a value in the EXE file's header that tells
- DOS how much of the file to load into memory. If the file has
- data past the next even 128 bytes beyond the "load image,"
- TINYPROG won't convert the EXE file without this switch option.
-
-
- /H This switch option tells TINYPROG to write this
- documentation out to a given file or to the DOS STDOUT device if
- no file name is given. If a given file name exists, TINYPROG
- asks you whether you want to overwrite it before doing so.
-
-
- /U These options allow you to put clear-text, unencrypted,
- uncompressed "user-data" at the top of your output EXE file.
- This option takes its own options in quite a few ways. Here are
- some examples:
-
-
-
- /Ut "\r\n (C) Copyright 2001 Zingo, Inc.\r\n"
-
- Puts the text string in the user-data area. To put text
- with embedded spaces into the user-data area, type the whole
- string inside double quotes.
-
-
- These two options are equivalent:
-
-
- 6
-
-
-
-
- /Ut1234567890
- /Ut 1234567890
-
-
- These options are equivalent:
-
- /Ub 12 100 (put 100 bytes of value decimal 12)
- /Ub 0xC 100 (the numbers can be in hex, C-style)
- /uB 12 0x64
- -ub 014 100 (the numbers can be leading-zero octal)
- -ub014 100 (the numbers can be fairly free-form)
- -ub12,100
- /UB 12,100
-
-
-
- There are four ways to put user-data into your program. In
- one command line you can use any or all of these ways, in any
- order you choose. The final user-data will be in the order given
- in the command line with no extra bytes put between separately-
- given data. Your final user-data area must be under 60k bytes in
- length.
-
- Here are the four ways of specifying user-data:
-
- ASCII Text:
-
- You may specify simple ASCII text. In the text strings, you
- may specify non-ASCII byte values using these extended C language
- conventions:
-
- \a Bell \b Backspace
- \f Form feed \n Line feed
- \r Carriage return \t Tab
- \v Vertical tab \z Control Z (End_of_file)
- \- Minus sign/dash \/ Forward slash
- \' Single quote \" Double quote
- \\ Back-slash \? Question mark
- \xHHH Hex value \DDD Octal value
- \_ Ignored (Used for null-string: "\_")
-
- The text is put in the program without any extra
- information. To put a trailing NULL character in the text,
- simple use the '\0' character sequence at the end of your string.
-
-
- Examples:
-
- /UT "text"
- /ut "\r\n Howdy, howdy, howdy.\r\n"
- /ut "I say, \"What's up, Doc.\""
- /ut "\a beep"
- -ut "A normal C string\0"
-
-
-
- 7
-
-
-
-
-
- Byte values:
-
- You may specify blocks of data in which every byte has the
- same value.
-
- Examples:
-
- /UB 0 2048 (2k of zeros)
- -ub -1 100 (100 Hex FF's)
- /UB -128 1 (1 Hex 80 byte)
- /UB 255 1 (1 Hex FF byte)
-
-
-
- Word (16 bit) values:
-
- You may specify blocks of data in which every 16-bit word
- has the same value. The words are stored low-byte-first and are
- not aligned on even word boundaries.
-
- Examples:
-
- /Uw 0 2048 (4k of zeros)
- -uw -1 100 (200 Hex FF's)
- /Uw -128 1 (1 Hex 0080 word)
- /UW 255 1 (1 Hex 00FF word)
- /uw -32768 2 (2 words of Hex 8000)
- /uw 65535 7 (7 words of Hex FFFF)
- /uw -1 4 (4 words of Hex FFFF)
-
-
-
- Files:
-
- You may include an entire file. TINYPROG copies the file as
- binary data to the user-data area.
-
- Examples (these options are all equivalent):
-
- /uFX.Y (puts the file X.Y into user-data area)
- /uf x.y
- /ufx.y
-
-
-
-
- Finally, here are some complex examples:
-
- /ut"MY_PROGRAM \0" /ut "5/26/90" /ub 0x20 32 /uf DATA_FILE.DAT
-
- /ut "Overlay1\0" /uf OVER1.EXE /utOverlay2\0 /ufOVER2.EXE
-
-
-
-
- 8
-
-
-
-
- Here is the structure of the user-data area and the top of a
- TINYPROG-produced EXE file:
-
- The first 32 bytes are the EXE file header. This header
- tells DOS what it needs to know to load and run the program.
-
- The next 3 bytes are a jump instruction to jump over the
- user data area. The first of these 3 bytes is the JMP op-code.
- The next two bytes are 1 word with the length in bytes of the
- user-data area + 1.
-
- The next 0..60k bytes are the user-data area.
-
- The user data area is followed by a Control Z and the
- initial TINYPROG code.
-
-
- -----------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 9
-
-
-
-
-
- PROGRAMMERS, WHAT TINYPROG DOES TO YOUR PROGRAM
-
-
- TINYPROG compresses your program and adds to it new code
- that decompresses your program whenever it is run. TINYPROG can
- also add, to the front of the EXE file, uncompressed, unencrypted
- data and text that you specify.
-
-
- When your program runs, the TINYPROG code decrypts and does
- a Cyclical Redundancy Check (CRC) on the compressed program.
- Then the TINYPROG code decompresses your program and jumps to the
- real program beginning. If the TINYPROG logic finds a CRC mis-
- match or if the decompression logic is not happy, the program
- prints an error message to the screen and exits with an
- ERRORLEVEL of 255.
-
- The error messages are sent to the DOS STDERR file handle.
- This file handle usually points to the PC's screen - even when
- the user redirects normal output (the STDOUT file handle) to a
- file.
-
-
- Here are the two messages and their meanings:
-
-
- TINYPROG says, "Bad program file!"
-
- The file was not loaded as an EXE program, or the program
- failed the CRC test.
-
-
- TINYPROG says, "Patched program!"
-
- The decompression logic found something horrible. This
- implies either a bug in the compression/decompression logic or a
- patch that escaped the CRC check. Tranzoa wants to know about
- this message.
-
-
-
- -----------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10
-
-
-
-
-
- THE COST OF TINYPROG'ING YOUR PROGRAM
-
-
- Beyond the zillions you send to Tranzoa, here is the price
- you pay for a smaller program file and file-corruption self-
- testing:
-
- 1) Slower loading. Our benchmark, 215k program compresses
- to 140k. (It has 40k of "help" text but no big, zeroed memory
- blocks.) Loading the program on a 4.77 megahertz XT takes an
- extra 30k per second beyond disk-read time. On a 25 megahertz
- 386, only from RAM disk is the extra load time perceptible. And
- then, barely so.
-
- 2) You can't patch the code. You may, though, put a
- patch/configuration area in front of the program file. Example:
- the copyright at the top of TINYPROG, itself.
-
- 3) TINYPROG output-programs must be .EXE files. (See
- below.)
-
- 4) Unusual programs may require more memory to load and
- run. (See below.)
-
-
- -----------------------------------------------------------------
-
-
- TINYPROG OUTPUTS .EXE PROGRAMS
-
-
- When you run a normal EXE program, DOS insures that there is
- sufficient memory to run the program. COM programs must check
- for themselves. If TINYPROG were to output COM programs, extra
- code would be included with your program to check memory. This
- code takes more space than the EXE file "header" that TINYPROG
- includes with your program. The EXE file header and its
- information would be the only difference between a EXE file and a
- COM file put out by TINYPROG.
-
-
- -----------------------------------------------------------------
-
-
- MEMORY REQUIREMENTS
-
-
- TINYPROG adds extra code to your program. This code needs
- approximately 1.5k bytes beyond your program's "load image" to
- operate. What is a "load image?" The load image of a COM file
- is its file length. EXE files contain their load image size in
- some extra information at the top of the file called the
- "header." Normally, both types of programs need more memory to
-
-
- 11
-
-
-
- run in than their load image size. Except for extremely simple
- or unusual programs, the extra memory needed to run the program
- exceeds 1.5k by a good margin. So, in a sense, the TINYPROG
- version of your program needs NO extra memory.
-
- There is a notable exception to this "no extra memory"
- requirement: certain EXE programs have no initial stack
- specified. These programs are dangerous to run with less than
- 64k of memory remaining. TINYPROG converts these programs in a
- way that makes them safe. Without enough memory, DOS will simply
- not load them.
-
- A few EXE programs tell DOS to give them only a certain
- amount of memory to run in. When the added TINYPROG code sets up
- the run-time environment for such programs, it may cause DOS to
- give these programs slightly more memory than would have been the
- case with the original program.
-
-
- -----------------------------------------------------------------
-
-
- OVERLAYS
-
- We're sorry. Since overlaid programs are usually big, they
- certainly could use TINYPROG compression! There are, of course,
- ways to compress overlays. But we must wait for the linkage
- editor people to want the ability.
-
-
- -----------------------------------------------------------------
-
-
- LONG .COM OR OTHER FILES
-
- In testing, you may have found that TINYPROG accepts any
- input file name other than the special DOS files, .BIN and .SYS
- files. So, you can tell TINYPROG to convert a large data file
- into an EXE file. If the data file has code up front, it will
- actually run as a program. Now, TINYPROG will convert these long
- non-EXE files, but when they load as programs, their stack will
- be at the end of their 64k segment, presumably in the middle of
- the loaded program. You can count on a few 10's of bytes in that
- area being clobbered even if you swap the stack right at the top
- of the program.
-
-
- -----------------------------------------------------------------
-
-
- CPU PROTECTED MODE OPERATION
-
- The code TINYPROG adds to your program uses segment register
- arithmetic. This arithmetic will not work in protected mode.
- But, it will work in VM-86 mode on a 386 or 486 CPU.
-
-
- 12
-
-
-
-
-
- -----------------------------------------------------------------
-
-
- USER DATA AREA
-
-
- Currently, the user-patch-area is not in RAM when your
- program gets control of the CPU. At run-time you must read it
- from the program file. (Under DOS 2.x, this may not be possible.
- Generally, you must tell your user to run your program another
- way, or ask him for the explicit name, or do tricks to find the
- original command line in memory.)
-
-
-
- How to Patch the User Data Area
-
- The user data area starts at the 35th byte of your program's
- EXE file. Its length + 1 is in the 31st and 32nd bytes as a low-
- byte-first word. The data is in the order of how it was given in
- the command line.
-
-
- -----------------------------------------------------------------
- June 8, 1990
- -----------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 13
-