Search by Tags

IOCTL HAL REBOOT

 

Compare with Revision



Subscribe for this article updates

Using this IOCTL, you can reboot the system.

Definitions

# define FILE_DEVICE_HAL              0x101
# define METHOD_BUFFERED              0x0
# define FILE_ANY_ACCESS              0x0
# define CTL_CODE( DeviceType, Function, Method, Access ) (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
# define IOCTL_HAL_REBOOT         CTL_CODE(FILE_DEVICE_HAL,  15,      METHOD_BUFFERED, FILE_ANY_ACCESS)
 
BOOL KernelIoControl(DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned);

Sample

// To force a Cold Boot: let the 2nd function parameter point to a value 0
//                       *lpInBuf = 0;
// To force a Warm Boot: let the 2nd function parameter be NULL
//                       lpInBuf = 0;
if(coldBoot)
{ 
    DWORD zero=0;
    KernelIoControl(IOCTL_HAL_REBOOT, &zero, 4, NULL, 0, NULL);
}
else
{
    KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
}