bcs33424@uxa.cso.uiuc.edu (02/11/90)
I'm writing a password program in Turbo Pascal for friend's computer. The program is fine, but I can't disable control-C. I've tried the break command under DOS, and the {C-}, {C+}, {$U-}, and the {$U+} (the book I'm using is very vague). With- out the control-C disabled, the program has no real effect. Is there something I missed? Is there another compiler directive I could use? Could the autoexec.bat be written so that, if the password program is stopped by a ^C that it recalls the password program, until it is ended normally? Thanks in advance, Bryan Siegfried email to: sig@mrcnext.cso.uiuc.edu zig@uiuc.edu bcs33424@uxa.cso.uiuc.edu "The interests of the landlord always oppose the interests of every othewr class of society." - David Ricardo
ts@uwasa.fi (Timo Salmi LASK) (02/13/90)
In article <116500002@uxa.cso.uiuc.edu> bcs33424@uxa.cso.uiuc.edu writes: > > I'm writing a password program in Turbo Pascal for friend's > computer. The program is fine, but I can't disable control-C. > I've tried the break command under DOS, and the {C-}, {C+}, > {$U-}, and the {$U+} (the book I'm using is very vague). With- > out the control-C disabled, the program has no real effect. > Is there something I missed? Is there another compiler directive CheckBreak := false; ................................................................... Prof. Timo Salmi (Moderating at anon. ftp site 128.214.12.3) School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun
baldwin@usna.MIL (J.D. Baldwin.) (02/14/90)
In article <116500002@uxa.cso.uiuc.edu>, bcs33424@uxa.cso.uiuc.edu writes: > I'm writing a password program in Turbo Pascal for friend's > computer. The program is fine, but I can't disable control-C. > I've tried the break command under DOS, and the {C-}, {C+}, > {$U-}, and the {$U+} (the book I'm using is very vague). With- > out the control-C disabled, the program has no real effect. > Is there something I missed? Is there another compiler directive > I could use? Could the autoexec.bat be written so that, if > the password program is stopped by a ^C that it recalls the > password program, until it is ended normally? Yes, the Crt unit contains a variable CheckBreak : boolean. Setting CheckBreak := false; will have the desired effect. N.B.: the BREAK key *will* work normally when you run the program from the Turbo editor! You must run the .EXE file to see any results from this. There is no way I have heard to do what you desire with DOS, so your scheme can be defeated easily enough by hitting BREAK *before* your program starts. There are such things as security "drivers" (so to speak) that load from your CONFIG.SYS file that cannot be defeated this way--you might look for something like this on BBS's on simtel20 (but beware the data burglar who carries a boot disk in his toolkit). > "The interests of the landlord always oppose the interests of > every othewr class of society." - David Ricardo Like most statements so sweepingly general, this is patently false. -- From the catapult of: |+| "If anyone disagrees with anything I _, J. D. Baldwin, Comp Sci Dept |+| say, I am quite prepared not only to __||____:::)=}- U.S. Naval Academy|+| retract it, but also to deny under \ / baldwin@cad.usna.navy.mil |+| oath that I ever said it." --T. Lehrer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d88-eli@nada.kth.se (Erik Liljencrantz) (02/14/90)
In article <116500002@uxa.cso.uiuc.edu> bcs33424@uxa.cso.uiuc.edu writes: > I'm writing a password program in Turbo Pascal for friend's > computer. The program is fine, but I can't disable control-C. > I've tried the break command under DOS, and the {C-}, {C+}, > {$U-}, and the {$U+} (the book I'm using is very vague). With- > out the control-C disabled, the program has no real effect. > Is there something I missed? Is there another compiler directive > I could use? Could the autoexec.bat be written so that, if > the password program is stopped by a ^C that it recalls the > password program, until it is ended normally? It's always possible to break AUTOEXEC.BAT and MS-DOS asks if you want to terminate the batch-file. The only possibility is to do something before the execution of AUTOEXEC.BAT begins, that is in CONFIG.SYS: Write a device- driver! The line DEVICE=device.sys in CONFIG.SYS loads a devicedriver and calls the initialization code in the driver. That code could display a password prompt, and refuse any CTRL-C or incorrect password. However, a devicedriver requires some (understatement...) assembly programming. And another thing: You can't protect the system from floppy boot. Anyone with a bootable floppy can enter the system... I've written a devicedriver (XTRALOCK.SYS). I can mail it to you (and others) if you are interested (it includes assembly source). -- Erik Liljencrantz | "No silly quotes!!" d88-eli@nada.kth.se | Embraquel D. Tuta
lihan@walt.cc.utexas.edu (Bruce Bostwick) (02/15/90)
In article <116500002@uxa.cso.uiuc.edu> bcs33424@uxa.cso.uiuc.edu writes: > I've tried the break command under DOS, and the {C-}, {C+}, Didi you type them exactly that way or did you use {$C-} and {$C+} as the compiler directives? I know it sounds nitpicky, but {C-} looks just like a comment to TP. The {$C-} should work. (This assumes, of course, that you're using 3.0 -- I know nothing about 5.x compiler directives ...) I have used it for exactly that purpose in both the CP/M 2.0 and DOS 3.0 implementations. ======================================================================= Internet:lihan@walt.cc.utexas.edu Disclaimer: My employer doesn't MaBellNet:(512)459-1602 even know UseNet exists, let SlowNet:varies chaotically, alone that I'm on it and ex- e-mail for current value pressing opinions ... +---------------------------------------------------------------------+ (-: a.k.a. BB/CIV :-) =======================================================================
davidr@hplsla.HP.COM (David M. Reed) (02/17/90)
In my Turbo Pascal 3.x programs I used, very successfully, {$C-}, after thoroughly debugging a program (or *I* would not be able to interrupt something running wild). I particularly did this for the benefit of using the DOS type-ahead buffering, plus a small screen speed improvement. And, of course, in a login/password program I created to use on some shared systems. In Turbo Pascal 5.x you must set Borland's global variable CheckBreak := FALSE (from the CRT unit). Last June I found a suggestion posted to comp.sys.ibm.pc which has been helpful for the shared systems I put my login program on. It is simple to use in thwarting users from aborting the boot process until it is finished. It only works with MS-DOS 3.3 or later. In CONFIG.SYS make certain you specify BREAK = OFF DEVICE = ANSI.SYS Then my first two statements in AUTOEXEC.BAT are @ECHO OFF ECHO ^[[3;67p and my last statements are ECHO ^[[3;3p MENU The need for MS-DOS 3.3 (or later) is so that the first statment is not echoed to the screen (which is when DOS looks for a ^C code). The second echo is the ANSI escape code sequence for key re-mapping, specifying that ASCII code 3 (the ^C character) should be remapped as a simple C character, and the last statement restores the original definition. Now the only way some can circumvent my defined boot-up process on those systems (to bypass the login/password program) is to boot from a floppy.
hampton@handel.CS.ColoState.Edu (thomas hampton) (02/19/90)
In article <1990Feb12.192905.7805@uwasa.fi> ts@uwasa.fi (Timo Salmi LASK) writes: >In article <116500002@uxa.cso.uiuc.edu> bcs33424@uxa.cso.uiuc.edu writes: >> >> I've tried the break command under DOS, and the {C-}, {C+}, >> {$U-}, and the {$U+} (the book I'm using is very vague). With- >> out the control-C disabled, the program has no real effect. >> Is there something I missed? Is there another compiler directive > >CheckBreak := false; > setting checkbreak to false won't entirely work. Dos will still check for break durring I/O processes just not at any other time. Normally dos checks more often than only durring I/O. One way to dissable c-break is with the command "ctty filename" this will cause dos to check for c-break in filename instead of standard input(actually it changes standard I/O to filename). Add this command to the first line of your autoexec file. But be sure to add the command "ctty con" as the last line of your auto file. If you don't do this standard I/O becomes filename and it is then impossible to type at the keyboard. Also, you may have to spcifically write to "con" inside your program because standard I/O has been changed. Try it and find out I haven't used it myself so I'm not sure. Good luck let me know how it turns out. 8D Tom!
phsieh@watcsc.waterloo.edu (Paul Hsieh) (02/27/90)
To disable the ^C in Turbo Pascal refer to the section in the manual on programming interrupts (TP 4.0+) simply re-route the ^C vector to a null procedure (or a nifty one that beeps or something). You may require some assembly language knowlegde etc. etc. Hope this helps