I was looking through the Windows Mobile Team Blog for something and came across a bit of code that I thought would be useful to some for resetting a device. Here's the code:
[DllImport("Coredll.dll")]
extern static int KernelIoControl(
int dwIoControlCode,
IntPtr lpInBuf,
int nInBufSize,
IntPtr lpOutBuf,
int nOutBufSize ,
ref int lpBytesReturned
);
[DllImport("Coredll.dll")]
extern static void SetCleanRebootFlag();
public void HardReset()
{
int IOCTL_HAL_REBOOT = 0x101003C;
int bytesReturned = 0;
SetCleanRebootFlag();
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned );
}
Tags: