Hard Reset from .NET CF
Have you ever needed to write .NET CF code that forces a device to hard-reset? Here's my solution:
[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 );
}
[Author: Robert Levy]
Comments
Anonymous
April 01, 2004
I ran across this interesting tidbit of code on the Windows Mobile Team Blog that shows you how to do a hard reset of your mobile device using CF.NET code. It's basically a wrapper around the KernelIoControl function within Coredll.dll....Anonymous
April 03, 2004
Definitely one to keep out of the hands of children...Anonymous
May 19, 2004
Hi. I copy you hard rest codes to my app and it complied successfully.
I deploy my application to test PDA. But, It didn't work.
My hardway is Casio IT-500 PDA with WindowCE4.1.
please help me.Anonymous
May 20, 2004
Sorry, I haven't looked into do this on devices outside of the Windows Mobile family.Anonymous
October 13, 2005
This doesn't seem to work on Windows Mobile 5 devices (test on iPAQ hx2190).
The device resets but all the data is left on the device. Perhaps persistent storage is the "culpit"
Any suggestions ?Anonymous
February 26, 2006
Yes This Works.Anonymous
February 28, 2006
It worked on a real Qtek 9100 (Wizard) I don't know It will work on the other or notAnonymous
February 28, 2006
But now it doesn't work, I'm now trying many time, it still doesn't work. It worked only one time, strangly ???Anonymous
March 08, 2006
This works for the soft reset and not for the hard reset, I tried on Treo-700.
Plz Suggest, if anyone get anything on the hard reset.
With Regards,
Rakesh Ranjan,
NJ USAAnonymous
March 08, 2006
Maybe you do not have .net framework to run your applivcation before hard reset ...Anonymous
July 19, 2006
it works fine!
correct hard-reset. :-)Anonymous
September 14, 2006
Works a treat on a Symbol MC70 - Windows Mobile 5 - said it did a WARM boot - just what I wanted !!Anonymous
September 24, 2006
Hi how do i use this code butte in VB.net not C#, i have try to convert using some programs butte don't work, pls if you guys have this code in vb.net send to me.
mpires@astralpool.pt
Many tks.
Miguel PiresAnonymous
May 22, 2007
I want to hard reset my O2 windows mobile how can I do that?Pls suggestAnonymous
June 10, 2007
With my Symbol MC1000 Windows Mobile 4.2 device this code does a warm boot, not a cold boot. Translated in VB.Net
Public Declare Function KernelIoControl Lib "coredll.dll" (ByVal dwIoControlCode As Integer, ByVal lpInBuf As IntPtr, ByVal nInBufSize As Integer, ByVal lpOutBuf As IntPtr, ByVal nOutBufSize As Integer, ByRef lpBytesReturned As Integer) As Integer Public Declare Sub SetCleanRebootFlag Lib "coredll.dll" () Public Sub HardReset() Const IOCTL_HAL_REBOOT As Integer = &H101003C Dim bytesReturned As Integer = 0 SetCleanRebootFlag() KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned) End Sub
Anonymous
June 22, 2007
HTC Artemis does only softreset. Anything to keep aware of?Anonymous
July 24, 2007
Change ur Title... I tried on Symbol MC70 WM5 device...all it does was soft reset not HARD RESET...stop misguiding pple...Anonymous
July 25, 2007
This hard resets (erases applications and data) on WM Emulator and warm boots on MC9094 device (applications and data intact).Anonymous
August 22, 2007
Hi i have a mc70 how i run this code in my ppc.. thanks..Anonymous
September 17, 2007
The VB code definitely does a HARD reset on a Symbol MC50. Any vb code for a soft-reset? tnx ~jAnonymous
October 22, 2007
how i have a hard reset5 in the Symbol MC 70.. How i run this code in the Pda.. thank mail me cristonovive@gmail.comAnonymous
November 19, 2007
I have a MC50 model, but I need a step by step instruction how to get to the DOS prompt to run the script. Can anyone help me?Anonymous
November 26, 2007
how i have a hard reset5 in the Symbol MC 70.. How i run this code in the Pda.. thank mail me cristonovive@gmail.comAnonymous
January 15, 2008
If you're wondering about hard and warm resets read the code and pause for thought: "KernelIoControl(IOCTL_HAL_REBOOT..." does the reset. "SetCleanRebootFlag();" requests hard reset funtionality. I don't think the author is trying to misguide you gizmoAnonymous
January 23, 2008
The comment has been removedAnonymous
February 05, 2008
2Jim: Performing a Cold Boot on Symbol MC70: To perform a cold boot simultaneously press the Power button and the 1 and 9 keys.Anonymous
February 05, 2008
If your device have the same problem after cold rebooting - contact your service center.Anonymous
April 27, 2008
I am developing an install shiled project for WM5 device installation and would like to restrict .NET CF 2.0 installation during warm boot how do I do itAnonymous
June 09, 2008
Have any of you guys had any experience of disabling the keys on a symbol MC50 handheld? This is obviously to stop silly users from loading email, internet and other apps other than my app.... How difficult can it be... I can't find any data onm this though. kind Regards, Nigel.Anonymous
January 01, 2009
>>This is obviously to stop silly users from loading email, internet and other apps other than my app.... to disable any other application, you can use AppCenter. You can download it from symbol site (devzone.symbol.com) Also i recommend to read a "Developer guide for Motorola devices".