Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!imagen!qmsseq!pipkins From: pipkins@qmsseq.imagen.com (Jeff Pipkins) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: How to do a warm-boot from a C program Keywords: boot, C Message-ID: <117@qmsseq.imagen.com> Date: 21 Feb 90 14:59:35 GMT References: <2028@milton.acs.washington.edu>
Reply-To: pipkins@qmsseq.UUCP (Jeff Pipkins) Distribution: na Organization: QMS Inc., Mobile, Alabama Lines: 50 In article
mcintyre@turing.cs.rpi.edu (David McIntyre) writes: >jimmy writes: >>Does anyone know how to do a boot from a C program? > >Yes, just do an Interrupt 25 (which is 19h). That will do it nicely. No, you should never do that. If you do, sometimes it will work, but much of the time it will hang. The proper way to simulate Ctrl-Alt-Del is to use the same technique that the keyboard handler uses when it detects the Ctrl-Alt-Del sequence. Try something like this: void warm_boot() { unsigned int far *reset_flag = (unsigned int far *) 0x00400072L; void (far *boot)() = 0xFFFF0000L; *reset_flag = 0x1234; (*boot)(); } void cold_boot() { [same definitions] *reset_flag = 0; (*boot)(); } >One minor comment: rebooting a computer is a pretty harsh way to recover >from a program error. In fact, with today's windowing systems, by rebooting >the system you could cause a nasty problem for another program. >[example deleted] Good point. It is also not a very user-friendly kind of thing to do anyway. If you want to create a robust, bullet-proof program, you can't do it by barfing and leaving the user at the mercy of an MS-DOS prompt. >Dave "mr question" McIntyre | "....say you're thinking about a plate >mcintyre@turing.cs.rpi.edu | of shrimp.....and someone says to >office : 518-276-8633 | you 'plate,' or 'shrimp'......" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Would you please explain the shrimp thing? Jeff Pipkins pipkins@imagen.com