Q47634: How to Reboot Your Machine within a Pure C Application
Article: Q47634
Product(s): See article
Version(s): 5.00 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | S_QuickC S_QuickASM | mspl13_c
Last Modified: 16-AUG-1989
Question:
How can I cause my machine to reboot itself from within my pure C
program? Interrupt 19H does not accomplish this task.
Response:
You can do a complete reboot on an 8086-based machine by jumping to
the address F000:FFF0. This action also reboots many 80286 and 80386
machines. The address contains a jump instruction that leads to the
machine's initialization code. For this method to succeed, your
machine must be in real-mode operation.
To prevent a memory check (on IBM and many compatibles), you should
store the value 0x1234 in the memory location at 0040:0072.
The following functions reboot your system without a memory check. If
you wish to allow the memory check to occur, you must remove the
single line comment delimiters, "//", from the lines involving
"memchk".
//int far *memchk ;
void (far *reboot)( void ) = (void far *)0xf000fff0 ;
void main ( void )
{
// memchk = (int far *)0x00400072 ; /* address of mem. check control */
// *memchk = 0x1234 ; /* disable memory check */
(*reboot)() ; /* reboot your machine */
}
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.