                       Pile, Deres, Siren, Keylock
                            December 13, 1993
                             Clarence Donath



Pile, Deres and Siren were designed for fun.  Install one on a friends
computer and when they press the activation key they will get an
unsuspected surprise.


Keylock allows you to lock your keyboard when you leave your computer
unattended so that someone will not inadvertently interfere with your
work.


These programs are TSR's (Terminate and Stay Resident).  Once installed
they remain dormant allowing other programs to be operated as normal.
They are activated by pressing the activation key (also known as a
hotkey) that you assign during installation.


Pile, Deres and Keylock allow the installer to select a key to use to
activate the TSR.  You may use most keyboard keys including those used
in conjunction with Shift, Ctrl and Alt. The only keys that cannot be
assigned are Caps Lock, Num Lock, Print Screen, Scroll Lock and Pause.


Siren works only with Shift, Ctrl and Alt.  For each of the three you
are asked which of the two keys to assign to the hotkey.  Shift, Ctrl
and Alt each have two keys, one on the left and one on the right side of
the keyboard.  The assignments for Shift, Ctrl and Alt are additive, that
is, if you select the Shift key and the Alt key then both must be
pressed to activate Siren.

Example 1:
 Shift keys. None/either/left/right [N/e/l/r]:e
 Ctrl keys. None/either/left/right [N/e/l/r]:n
 Alt keys. None/either/left/right [N/e/l/r]:n

This is the prompt you will get.  In this example EITHER Shift key was
chosen. When the user presses either Shift key the siren will sound.

Example 2:
 Shift keys. None/either/left/right [N/e/l/r]:n
 Ctrl keys. None/either/left/right [N/e/l/r]:e
 Alt keys. None/either/left/right [N/e/l/r]:e

In this example either Ctrl key and either Alt key was chosen.  When the
user presses Ctrl AND Alt the siren will sound.  This can be used to
sound the siren as the user presses Ctrl-Alt-Delete to reboot the
computer.


More than one TSR may be installed at a time.  Assign different keys to
each TSR.  With this feature a TSR may be assigned more than one key.
The limitation to the number of TSR's installed is the amount of memory
left available for other programs to operate properly.  Each TSR uses
about 20K.


A TSR can be removed from memory, freeing all memory allocated by the
TSR. For all TSR's, the key stroke Shift-Alt-F1 will remove the TSR. You
must be at the DOS prompt to remove a TSR.  Siren requires that Numlock
be off to be removed since Shift and Alt may be assigned to the hotkey.
With Numlock off, the siren will not sound.
A TSR cannot be removed when an unknown TSR (other than Pile, Deres,
Siren or Keylock) is installed afterwards.  Once the unknown TSR is
removed then Pile, Deres, Siren and Keylock may once again be removed
with Shift-Alt-F1.


Pile and Deres will not work in applications that use graphics.  They
are designed to affect only text screens. Siren and Keylock will work in
applications that use graphics.


A TSR may be installed from AUTOEXEC.BAT.  The activation key may be
specified as a command line parameter.  The parameter is a number
containing the key's scan code in the high byte and the ASCII character
in the low byte.  A list of activation key numbers is included at the
end of this file.

Example:
 Deres $48E0
 or
 Deres 18656

The Up Arrow is used as the activation key.


Siren requires a different parameter for specifying a hotkey since it
uses only modifier keys.  The number consists of a byte with the Shift
keys specified in bits 1 and 2, the Ctrl keys in bits 3 and 4, and the
Alt keys in bits 5 and 6.
The following are examples of hotkey values for Siren:
 2 - left Shift key
 3 - either Shift key
 12 - either Ctrl key
 48 - either Alt key
 60 - either Ctrl key AND either Alt key

Example:
 Siren 60

The siren sounds when the user presses Ctrl-Alt


Keylock is used to lock the keyboard.  A three character password is
required to unlock the keyboard.  The password is defined during
installation.

When the hotkey is pressed to activate Keylock, a sound is emitted to
indicate that the keyboard is now locked.  No messages are displayed on
the screen to indicate that the keyboard is locked since Keylock may be
used in both text and graphics applications.  I wanted to avoid using
graphics to keep the size of Keylock as small as possible.  The three
keyboard LED's, Num Lock, Caps Lock and Scroll Lock revolve to indicate
that the keyboard is locked.  While the keyboard is locked a keypress
will do nothing.  However, pressing a modifier key (Shift, Ctrl and Alt)
may still work in some applications but this generally does nothing more
than bring down a menu.  Mouse targets are also disabled.  The mouse
pointer will still move around the screen, but clicking on an item will
do nothing.  While locked, Ctrl-Alt-Delete (warm boot) is disabled.  When
it is pressed a warning sound is emitted to remind the user that the
keyboard is locked and the computer will not reboot.

When the three character password is typed a different sound is emitted
to indicate that the keyboard is unlocked.  The LED's no longer revolve
and the keyboard will work normally.

Keylock does not work as specified in some applications.  For example,
some applications may use the mouse in a way that is not disabled by
Keylock.  Keylock would have to be revised to cover these applications.
For now it is only designed for general DOS use.  Test out Keylock in
all of the applications that you will be using to make sure that it is
compatible.

Keylock may be installed with the password and the activation key as
command line parameters.  Enter Keylock /? from the DOS prompt for help.
When one of the parameters is excluded from the command line, the
program will prompt for the missing parameter before installing.


These TSR's were designed and tested on a 486.  My goal was to learn how to
develop TSR's.  If you would like a particular function in a TSR please
drop me a line.  I frequent Groton, CT area BBS's and my handle is EDDATA
where aliases are allowed.  I hope you find these programs fun and maybe
even useful.



The following list contains activation key values that may be used as command
line parameters when installing Pile, Deres and Keylock.

Key codes as stored in the keyboard buffer. The high byte contains the scan
code and the low byte contains the ASCII character.

Key pressed        Hex    Decimal
 Esc               $11B   283
 F1                $3B00  15104
 Shift F1          $5400  21504
 Ctrl F1           $5E00  24064
 Alt F1            $6800  26624
 F2                $3C00  15360
 Shift F2          $5500  21760
 Ctrl F2           $5F00  24320
 Alt F2            $6900  26880
 F3                $3D00  15616
 Shift F3          $5600  22016
 Ctrl F3           $6000  24576
 Alt F3            $6A00  27136
 F4                $3E00  15872
 Shift F4          $5700  22272
 Ctrl F4           $6100  24832
 Alt F4            $6B00  27392
 F5                $3F00  16128
 Shift F5          $5800  22528
 Ctrl F5           $6200  25088
 Alt F5            $6C00  27648
 F6                $4000  16384
 Shift F6          $5900  22784
 Ctrl F6           $6300  25344
 Alt F6            $6D00  27904
 F7                $4100  16640
 Shift F7          $5A00  23040
 Ctrl F7           $6400  25600
 Alt F7            $6E00  28160
 F8                $4200  16896
 Shift F8          $5B00  23296
 Ctrl F8           $6500  25856
 Alt F8            $6F00  28416
 F9                $4300  17152
 Shift F9          $5C00  23552
 Ctrl F9           $6600  26112
 Alt F9            $7000  28672
 F10               $4400  17408
 Shift F10         $5D00  23808
 Ctrl F10          $6700  26368
 Alt F10           $7100  28928
 F11               $8500  34048
 Shift F11         $8700  34560
 Ctrl F11          $8900  35072
 Alt F11           $8B00  35584
 F12               $8600  34304
 Shift F12         $8800  34816
 Ctrl F12          $8A00  35328
 Alt F12           $8C00  35840
 `                 $2960  10592
 ~                 $297E  10622
 !                 $221   545
 1                 $231   561
 @                 $340   832
 2                 $332   818
 Ctrl 2            $300   768
 #                 $423   1059
 3                 $433   1075
 $                 $524   1316
 4                 $534   1332
 %                 $625   1573
 5                 $635   1589
 ^                 $75E   1886
 6                 $736   1846
 Ctrl 6            $71E   1822
 &                 $826   2086
 7                 $837   2103
 *                 $92A   2346
 8                 $938   2360
 (                 $A28   2600
 9                 $A39   2617
 )                 $B29   2857
 0                 $B30   2864
 _                 $C5F   3167
 -                 $C2D   3117
 Ctrl -            $C1F   3103
 +                 $D2B   3371
 =                 $D3D   3389
 Backspace         $E08   3592
 Ctrl Backspace    $E7F   3711
 Shift Backspace   $E08   3592
 Tab               $F09   3849
 Shift Tab         $F00   3840
 Q                 $1051  4177
 q                 $1071  4209
 Ctrl q            $1011  4113
 Alt q             $1000  4096
 W                 $1157  4439
 w                 $1177  4471
 Ctrl w            $1117  4375
 Alt w             $1100  4352
 E                 $1245  4677
 e                 $1265  4709
 Ctrl e            $1205  4613
 Alt e             $1200  4608
 R                 $1352  4946
 r                 $1372  4978
 Ctrl r            $1312  4882
 Alt r             $1300  4864
 T                 $1454  5204
 t                 $1474  5236
 Ctrl t            $1414  5140
 Alt t             $1400  5120
 Y                 $1559  5465
 y                 $1579  5497
 Ctrl y            $1519  5401
 Alt y             $1500  5376
 U                 $1655  5717
 u                 $1675  5749
 Ctrl u            $1615  5653
 Alt u             $1600  5632
 I                 $1749  5961
 i                 $1769  5993
 Ctrl i            $1709  5897
 Alt i             $1700  5888
 O                 $184F  6223
 o                 $186F  6255
 Ctrl o            $180F  6159
 Alt o             $1800  6144
 P                 $1950  6480
 p                 $1970  6512
 Ctrl p            $1910  6416
 Alt p             $1900  6400
 {                 $1A7B  6779
 [                 $1A5B  6747
 Ctrl [            $1A1B  6683
 }                 $1B7D  7037
 ]                 $1B5D  7005
 Ctrl ]            $1B1D  6941
 A                 $1E41  7745
 a                 $1E61  7777
 Ctrl a            $1E01  7681
 Alt a             $1E00  7680
 S                 $1F53  8019
 s                 $1F73  8051
 Ctrl s            $1F13  7955
 Alt s             $1F00  7936
 D                 $2044  8260
 d                 $2064  8292
 Ctrl d            $2004  8196
 Alt d             $2000  8192
 F                 $2146  8518
 f                 $2166  8550
 Ctrl f            $2106  8454
 Alt f             $2100  8448
 G                 $2247  8775
 g                 $2267  8807
 Ctrl g            $2207  8711
 Alt g             $2200  8704
 H                 $2348  9032
 h                 $2368  9064
 Ctrl h            $2308  8968
 Alt h             $2300  8960
 J                 $244A  9290
 j                 $246A  9322
 Ctrl j            $240A  9226
 Alt j             $2400  9216
 K                 $254B  9547
 k                 $256B  9579
 Ctrl k            $250B  9483
 Alt k             $2500  9472
 L                 $264C  9804
 l                 $266C  9836
 Ctrl l            $260C  9740
 Alt l             $2600  9728
 :                 $273A  10042
 ;                 $273B  10043
 "                 $2822  10274
 '                 $2827  10279
 Enter             $1C0D  7181
 Ctrl Enter        $1C0A  7178
 Z                 $2C5A  11354
 z                 $2C7A  11386
 Ctrl z            $2C1A  11290
 Alt z             $2C00  11264
 X                 $2D58  11608
 x                 $2D78  11640
 Ctrl x            $2D18  11544
 Alt x             $2D00  11520
 C                 $2E43  11843
 c                 $2E63  11875
 Ctrl c            $2E03  11779
 Alt c             $2E00  11776
 V                 $2F56  12118
 v                 $2F76  12150
 Ctrl v            $2F16  12054
 Alt v             $2F00  12032
 B                 $3042  12354
 b                 $3062  12386
 Ctrl b            $3002  12290
 Alt b             $3000  12288
 N                 $314E  12622
 n                 $316E  12654
 Ctrl n            $310E  12558
 Alt n             $3100  12544
 M                 $324D  12877
 m                 $326D  12909
 Ctrl m            $320D  12813
 Alt m             $3200  12800
 <                 $333C  13116
 ,                 $332C  13100
 >                 $343E  13374
 .                 $342E  13358
 ?                 $353F  13631
 /                 $352F  13615
 |                 $2B7C  11132
 \                 $2B5C  11100
 Ctrl \            $2B1C  11036
 Space             $3920  14624
 Insert            $52E0  21216
 Home              $47E0  18400
 Pgup              $49E0  18912
 Delete            $53E0  21472
 End               $4FE0  20448
 Pgdn              $51E0  20960
 Up Arrow          $48E0  18656
 Left Arrow        $4BE0  19424
 Ctrl Left Arrow   $73E0  29664
 Right Arrow       $4DE0  19936
 Ctrl Right Arrow  $74E0  29920
 Down Arrow        $50E0  20704


Keypad with Numlock on. Keys used with Shift produce a value as if numlock
were off. Keys used with Ctrl produce same value whether Numlock is on or off.

 /                 $E02F  57391
 Shift /           $353F  13631
 *                 $372A  14122
 -                 $4A2D  18989
 7                 $4737  18231
 Shift 7           $4700  18176
 Ctrl 7            $7700  30464
 8                 $4838  18488
 Shift 8           $4800  18432
 9                 $4939  18745
 Shift 9           $4900  18688
 Ctrl 9            $8400  33792
 4                 $4B34  19252
 Shift 4           $4B00  19200
 Ctrl 4            $7300  29440
 5                 $4C35  19509
 6                 $4D36  19766
 Shift 6           $4D00  19712
 Ctrl 6            $7400  29696
 1                 $4F31  20273
 Shift 1           $4F00  20224
 Ctrl 1            $7500  29952
 2                 $5032  20530
 Shift 2           $5000  20480
 3                 $5133  20787
 Shift 3           $5100  20736
 Ctrl 3            $7600  30208
 0                 $5230  21040
 Shift 0           $5200  20992
 . Del             $532E  21294
 Shift Del         $5300  21248
 +                 $4E2B  20011
 Enter             $E00D  57357
 Ctrl Enter        $E00A  57354
