home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
t
/
tcsel003.zip
/
LOCKKBD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-10-16
|
2KB
|
73 lines
{$X+}
{ Author Trevor J Carlsen. Released into the public domain. Req TP6 }
{ Compile and run this program and all keyboard input except keys that }
{ make up a valid password will be ignored. In this case the password }
{ is '1234' and the scancodes for those keys are stored in a constant. }
{ To change the password compute the scancodes for the desired password}
{ and change the password approriately. }
uses
Dos,
Crt;
var
OldInt9 : pointer; { for storing the old interrupt vector }
password : string[4];
pwdlen : byte absolute password;
procedure RestoreOldInt9;
{ Restores control to the old interrupt handler }
begin
SetIntVec($09,OldInt9);
end;
{$F+}
procedure NewInt9; interrupt;
const
masterpwd :string[4] = #2#3#4#5; { '1234' scancodes }
var
scancode : byte;
procedure ResetKBD;
var
b : byte;
begin
b := port[$61];
port[$61] := b or $80;
port[$61] := b;
port[$20] := $20; { Signals EOI to PIC }
end;
begin
scancode := port[$60];
if chr(scancode) = masterpwd[pwdlen+1] then begin
password[pwdlen+1] := chr(scancode);
inc(pwdlen);
if password = masterpwd then
RestoreOldInt9;
end
else if not odd(scancode shr 7) then { invalid key }
pwdlen := 0;
ResetKBD;
end;
{$F-}
begin
pwdlen := 0;
GetIntVec($09,OldInt9);
SetIntVec($09,@NewInt9);
ReadKey;
end.
TeeCee
--- TC-ED v2.01
* Origin: The Pilbara's Pascal Centre (+61 91 732569) (3:690/644)