home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / programm / 10841 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  3.0 KB

  1. Path: sparky!uunet!olivea!charnel!rat!koko.csustan.edu!nic.csu.net!nic.csu.net!nntp
  2. From: oleg@gd.cs.csufresno.edu
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Disable CTRL+BREAK from a TP6 program
  5. Message-ID: <1992Nov21.231406.3301@nic.csu.net>
  6. Date: 22 Nov 92 07:14:05 GMT
  7. References: <1992Nov18.141829.813@bradford.ac.uk> <Nov18.202206.59161@yuma.ACNS.ColoState.EDU> <1992Nov22.005737.15056@odin.corp.sgi.com>
  8. Sender: oleg@gd.cs.csufresno.edu
  9. Organization: Computer Science Departement of California State University in Fresno
  10. Lines: 67
  11. Nntp-Posting-Host: gd.cs.csufresno.edu
  12.  
  13. In article <1992Nov22.005737.15056@odin.corp.sgi.com> toms@ymp.esd.sgi.com (Tom Stephenson) writes:
  14. >In article <Nov18.202206.59161@yuma.ACNS.ColoState.EDU>, hallch@CS.ColoState.EDU
  15. >(christopher hall) writes:
  16. >|> 
  17. >|> >I am writing a TP6 program which requires the CTRL+BREAK sequence to be
  18. >|> >disabled, as it loads in data tables and manipulates them in real time.
  19. >|> >If CTRL+BREAK is pressed then the program bombs out and leaves the tables
  20. >|> >in a real mess.
  21. >|> >
  22. >|> 
  23. >|> I played around with this problem a few years ago.  The solution I came
  24. >|> up with was to hook the Ctrl-Break interrupt.  I don't remember what it
  25. >|> was (I think it was around 24h).  The only thing my interrupt was to do
  26. >|> was return immediately to its caller.  I used this when I had to write
  27. >|> a simple program for a teacher of mine (he wanted students to have to
  28. >|> enter a password without being able to break of out the program).
  29. >|> 
  30. >|> Hope this helps.
  31. >|> 
  32. >|>                         Chris Hall :-)
  33. >
  34. >I wrote a program that allows me to have a password on my DOS machine. (I have
  35. >teenage people at home that think they are hackers). The attached code is the
  36.  
  37. So, they haven't figured out yet what happens if one inserts a system diskette in
  38. drive A: and press Ctrl-Alt-Del ;-) Well, than they only think they are hackers.
  39.  
  40. >You can use them in your password if you want. The entire source is available if
  41. >you want it. I just wrote the program to emulate UNIX login process.
  42. >
  43. >/* Code fragment from main */
  44. >
  45. >        while ((c = getkeychar()) != 0x0d){
  46. >            str[i] = c;
  47. >            i++;
  48. >        }
  49. >
  50.  
  51. What happens  if  password > sizeof(str)?  Program  can exit or  crash,  quite
  52. probably easily  interruptable in this  state. Don't get too upset  though. In
  53. early version of AT&T UNIX one could get in any account  by  typing a password
  54. of  maximum length  followed  by  encrypted form   of the same  password - for
  55. exactly the same reason.   Author of  login.c used gets()  to get  a password.
  56. Since gets doesn't check  length of input  string, it would hapily overwrite a
  57. buffer for encrypted password.
  58.  
  59. >/*keyboard function to replace getchar() */
  60. >
  61. >getkeychar()
  62. >{
  63. >    int c;
  64. >    inreg.h.ah = 0x07;
  65. >    intdos (&inreg, &outreg);
  66. >    c = outreg.h.al;
  67. >    return (c);
  68. >}
  69. >
  70. >
  71. >
  72. >Good Luck...
  73.  
  74. While  code above  might  be an adeqate  protection  when  dealing with (some)
  75. teenage people, please don't use it in your password :) Hmmm, I think teaching
  76. teenage  people to   do  something  useful  on  computer  might create  better
  77. security...
  78.  
  79. Oleg
  80.