RebootThroughKeyboardController


/*

------------------ BEGIN MAKEFILE -----------------


#

# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source

# file to this component.  This file merely indirects to the real make file

# that is shared by all the components of NT OS/2

#

!INCLUDE $(NTMAKEENV)\makefile.def


------------------ END MAKEFILE -------------------

*/


/*

------------------ BEGIN SOURCES ------------------


TARGETNAME=Reboot

TARGETPATH=obj

TARGETTYPE=DRIVER

INCLUDES=

SOURCES=Reboot.c


----------------- END SOURCES ---------------------

*/


//

//  Sample driver that hard boots a machine.  Extract the SOURCES and

//  MAKEFILE above as needed then use the DDK build environment to

//  create the driver.  Use a driver loader to load the driver into the

//  kernel.

//

//  Michael Wookey / July 2006

//

#include "ntddk.h"



NTSTATUS

DriverEntry(

    IN PDRIVER_OBJECT DriverObject, 

    IN PUNICODE_STRING RegistryPath 

    )

{

    //

    //  Historically, keyboards used to have a reboot key with a direct

    //  line to the CPU that forced a reboot.  The 8042 controller still

    //  has this direct line, but keyboards no longer have a hard reboot

    //  key.  We can trigger a hard reboot by writing to port 0x64 with

    //  command 0xFE.  Regardless of the OS, a PC will hard reboot.  Not

    //  sure why you would want to do this... but anyway...

    //


    //

    //  Using the wrapper API's, force a reboot...

    //


    WRITE_PORT_UCHAR(0x64, 0xFE);


    //

    //  The above is equivalent to the following assembler which can

    //  be used instead and is OS independent...

    //

    

    /*

    __asm mov dx, 0x64

    __asm mov al, 0xfe

    __asm out dx, al

    */


    return STATUS_SUCCESS;

}


/* EOF */