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:

extern static int KernelIoControl(int dwIoControlCode, IntPtr lpInBuf, int nInBufSize, IntPtr lpOutBuf, int nOutBufSize , ref int lpBytesReturned );

extern static void SetCleanRebootFlag();

public void HardReset()
bytesReturned = 0;
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref
bytesReturned );

[Author: Robert Levy]

Comments (31)

  1. 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….

  2. Kevin Daly says:

    Definitely one to keep out of the hands of children…

  3. ms.joo says:

    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.

  4. Robert Levy says:

    Sorry, I haven’t looked into do this on devices outside of the Windows Mobile family.

  5. Peter Mohr says:

    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 ?

  6. Thanh_Lam says:

    It worked on a real Qtek 9100 (Wizard) I don’t know It will work on the other or not

  7. Thanh_Lam says:

    But now it doesn’t work, I’m now trying many time, it still doesn’t work. It worked only one time, strangly ???

  8. 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 USA

  9. Alexandre Morato says:

    Maybe you do not have .net framework to run your applivcation before hard reset …

  10. Soeren Schusser says:

    it works fine!

    correct hard-reset. 🙂

  11. Andrew Sims says:

    Works a treat on a Symbol MC70 – Windows Mobile 5 – said it did a WARM boot – just what I wanted !!

  12. Miguel Pires says:

    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.


    Many tks.

    Miguel Pires

  13. mahfuz says:

    I want to hard reset my O2 windows mobile how can I do that?Pls suggest

  14. Dan says:

    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


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

     End Sub

  15. Florian says:

    HTC Artemis does only softreset.

    Anything to keep aware of?

  16. gizmo says:

    Change ur Title…

    I tried on Symbol MC70 WM5 device…all it does was soft reset not HARD RESET…stop misguiding pple…

  17. Jayesh Kitukale says:

    This hard resets (erases applications and data) on WM Emulator and warm boots on MC9094 device (applications and data intact).

  18. SuckMe says:

    Hi i have a mc70 how i run this code in my ppc..


  19. Prosit says:

    The VB code definitely does a HARD reset on a Symbol MC50.  

    Any vb code for a soft-reset?



  20. Suckme says:

    how i have a hard reset5 in the Symbol MC 70..

    How i run this code in the Pda.. thank mail me cristonovive@gmail.com

  21. Dragonfly says:

    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?

  22. suckme says:

    how i have a hard reset5 in the Symbol MC 70..

    How i run this code in the Pda.. thank mail me cristonovive@gmail.com

  23. Lyall says:

    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 gizmo

  24. Jim says:

    Hi All,

    We are doing some work with the Symbol MC70 – our programmers are writing forms in Visual Basic and printing these forms with PrinterCE software. One of the MC70s is not printing these forms for some reason. We don’t know if its an active sync issue, PC or configuration issue.

    We need to wipe everything out except the Windows Mobile operating system.  Basically back to the "Out of the Box" Factory Settings.  If anyone knows how to do a hard reboot please let me know.

    What they call a warm and cold re-boot is not working.


  25. 2Jim:

    Performing a Cold Boot on Symbol MC70:

    To perform a cold boot simultaneously press the Power button and the 1 and 9 keys.

  26. If your device have the same problem after cold rebooting – contact your service center.

  27. mobileseek says:

    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 it

  28. Nigel Bogle says:

    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,


  29. >>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".

Skip to main content