COM FILE SYMBIOSIS


WHAT IS IT?


The C-- compiler has the option to append the program it is compiling to the
end of an already created COM file.  This I call "COM File Symbiosis".  When
the program is loaded, execution will start in the appended C-- code, and
when execution passes the end of the main() procedure block, execution of the
original program will begin.  If a procedure like EXIT() or ABORT() is
called within the C-- program, the program will quit, and the original code
from the COM file will not be executed.  This allows the program being
appended on to the COM file to determine whether control will be passed onto
the original code.


HOWS IT DONE


I will tell you later, its not really that complicated.


HOW TO DO IT

To do it, you need to use the /SYM command line option followed by the full
name of the COM file to append to.  The original COM file will not be
changed, only copied into the beginning of the outputted run COM file.  For
example, to compile the program HELLO.C-- on to the end of a copy of
C:\COMMAND.COM use the following command:

    C-- /SYM C:\COMMAND.COM HELLO.C--

An output file HELLO.COM will be created.


USES

You can probably think of lots of ways of using this function, such as:

    - Adding password protection to certain special COM files.
    - Reducing the memory available to the COM file at start up.
    - Initializing a video mode for the COM file.


ABUSES


Anyone with a mischievous mind (most people do) can think of some not so nice
ways of using this function.  The most obvious of which would be the creation
of trojan horses.  I WOULD LIKE TO POINT OUT THAT THIS IS NOT A CONSTRUCTIVE
USE OF C-- AND ANY DESTRUCTIVE USE OF COM FILE SYMBIOSIS IS PROHIBITED.  In
other words, don't be a jerk.


Post a Comment

0 Comments