KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q45761: How to Reboot Your Machine within a QuickC 2.00 Application

Article: Q45761
Product(s): See article
Version(s): 2.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | S_C H_MASM S_QuickASM | mspl13_c
Last Modified: 12-SEP-1989

Question:

I'm writing a QuickC 2.00 application that needs to reboot itself
without the user turning off the machine or issuing the CTRL+ALT+DEL
command. Is this possible in QuickC 2.00?

Response:

Yes, it is. You can do a complete reboot without memory check using
inline assembly. To reboot an 8086 family machine, you can insert the
word "1234h" at memory location 0040:0072 and then perform a direct
jump to address f000:fff0.

The following function performs a reboot inside a QuickC 2.00 program:

void reboot(void)
{
  unsigned reboot_vector[] = {0xfff0, 0xf000};

  _asm {
      mov ax, 40h
      mov es, ax
      mov di, 72h
      mov es:[di], 1234h               ; move 1234h into special loc
      jmp dword ptr ds:reboot_vector   ; jump to the bios routine
      }
}

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.