home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!koko.csustan.edu!nic.csu.net!nic.csu.net!nntp
- From: oleg@gd.cs.csufresno.edu
- Newsgroups: comp.os.msdos.programmer
- Subject: Re: Disable CTRL+BREAK from a TP6 program
- Message-ID: <1992Nov21.231406.3301@nic.csu.net>
- Date: 22 Nov 92 07:14:05 GMT
- References: <1992Nov18.141829.813@bradford.ac.uk> <Nov18.202206.59161@yuma.ACNS.ColoState.EDU> <1992Nov22.005737.15056@odin.corp.sgi.com>
- Sender: oleg@gd.cs.csufresno.edu
- Organization: Computer Science Departement of California State University in Fresno
- Lines: 67
- Nntp-Posting-Host: gd.cs.csufresno.edu
-
- In article <1992Nov22.005737.15056@odin.corp.sgi.com> toms@ymp.esd.sgi.com (Tom Stephenson) writes:
- >In article <Nov18.202206.59161@yuma.ACNS.ColoState.EDU>, hallch@CS.ColoState.EDU
- >(christopher hall) writes:
- >|>
- >|> >I am writing a TP6 program which requires the CTRL+BREAK sequence to be
- >|> >disabled, as it loads in data tables and manipulates them in real time.
- >|> >If CTRL+BREAK is pressed then the program bombs out and leaves the tables
- >|> >in a real mess.
- >|> >
- >|>
- >|> I played around with this problem a few years ago. The solution I came
- >|> up with was to hook the Ctrl-Break interrupt. I don't remember what it
- >|> was (I think it was around 24h). The only thing my interrupt was to do
- >|> was return immediately to its caller. I used this when I had to write
- >|> a simple program for a teacher of mine (he wanted students to have to
- >|> enter a password without being able to break of out the program).
- >|>
- >|> Hope this helps.
- >|>
- >|> Chris Hall :-)
- >
- >I wrote a program that allows me to have a password on my DOS machine. (I have
- >teenage people at home that think they are hackers). The attached code is the
-
- So, they haven't figured out yet what happens if one inserts a system diskette in
- drive A: and press Ctrl-Alt-Del ;-) Well, than they only think they are hackers.
-
- >You can use them in your password if you want. The entire source is available if
- >you want it. I just wrote the program to emulate UNIX login process.
- >
- >/* Code fragment from main */
- >
- > while ((c = getkeychar()) != 0x0d){
- > str[i] = c;
- > i++;
- > }
- >
-
- What happens if password > sizeof(str)? Program can exit or crash, quite
- probably easily interruptable in this state. Don't get too upset though. In
- early version of AT&T UNIX one could get in any account by typing a password
- of maximum length followed by encrypted form of the same password - for
- exactly the same reason. Author of login.c used gets() to get a password.
- Since gets doesn't check length of input string, it would hapily overwrite a
- buffer for encrypted password.
-
- >/*keyboard function to replace getchar() */
- >
- >getkeychar()
- >{
- > int c;
- > inreg.h.ah = 0x07;
- > intdos (&inreg, &outreg);
- > c = outreg.h.al;
- > return (c);
- >}
- >
- >
- >
- >Good Luck...
-
- While code above might be an adeqate protection when dealing with (some)
- teenage people, please don't use it in your password :) Hmmm, I think teaching
- teenage people to do something useful on computer might create better
- security...
-
- Oleg
-