Wednesday, May 30, 2007

How to Soft Reset Windows Mobile 5.0

[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 static void ResetDevice(bool l_Is_HardReset)

{

int IOCTL_HAL_REBOOT = 0x101003C;

int bytesReturned = 0;

if (l_Is_HardReset == true)

{

SetCleanRebootFlag();

}

KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned);

}



Call this method to reset : ResetDevice(true);

No comments: