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

  1. Path: sparky!uunet!olivea!sgigate!sgi!fido!zola!sgihub!odin!ymp.esd.sgi.com!toms
  2. From: toms@ymp.esd.sgi.com (Tom Stephenson)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Disable CTRL+BREAK from a TP6 program
  5. Message-ID: <1992Nov22.005737.15056@odin.corp.sgi.com>
  6. Date: 22 Nov 92 00:57:37 GMT
  7. References: <1992Nov18.141829.813@bradford.ac.uk> <Nov18.202206.59161@yuma.ACNS.ColoState.EDU>
  8. Sender: news@odin.corp.sgi.com (Net News)
  9. Organization: Silicon Graphics, Inc.
  10. Lines: 51
  11. Nntp-Posting-Host: ymp.esd.sgi.com
  12.  
  13. In article <Nov18.202206.59161@yuma.ACNS.ColoState.EDU>, hallch@CS.ColoState.EDU
  14. (christopher hall) writes:
  15. |> 
  16. |> >I am writing a TP6 program which requires the CTRL+BREAK sequence to be
  17. |> >disabled, as it loads in data tables and manipulates them in real time.
  18. |> >If CTRL+BREAK is pressed then the program bombs out and leaves the tables
  19. |> >in a real mess.
  20. |> >
  21. |> 
  22. |> I played around with this problem a few years ago.  The solution I came
  23. |> up with was to hook the Ctrl-Break interrupt.  I don't remember what it
  24. |> was (I think it was around 24h).  The only thing my interrupt was to do
  25. |> was return immediately to its caller.  I used this when I had to write
  26. |> a simple program for a teacher of mine (he wanted students to have to
  27. |> enter a password without being able to break of out the program).
  28. |> 
  29. |> Hope this helps.
  30. |> 
  31. |>                         Chris Hall :-)
  32.  
  33. I wrote a program that allows me to have a password on my DOS machine. (I have
  34. teenage people at home that think they are hackers). The attached code is the
  35. key element to the puzzle. The function getkeychar returns the characters input
  36. from the keyboard including ^C or ^Z etc.
  37.  
  38. You can use them in your password if you want. The entire source is available if
  39. you want it. I just wrote the program to emulate UNIX login process.
  40.  
  41. /* Code fragment from main */
  42.  
  43.         while ((c = getkeychar()) != 0x0d){
  44.             str[i] = c;
  45.             i++;
  46.         }
  47.  
  48. /*keyboard function to replace getchar() */
  49.  
  50. getkeychar()
  51. {
  52.     int c;
  53.     inreg.h.ah = 0x07;
  54.     intdos (&inreg, &outreg);
  55.     c = outreg.h.al;
  56.     return (c);
  57. }
  58.  
  59.  
  60.  
  61. Good Luck...
  62.  
  63.                     Tom Stephenson
  64.