QA: How to perform hard reset?

Alexander Muratov (alexvirt@yahoo.com), December 18, 2001.

Question

I need to perform the device hard reset programmatically. How can I do that?

Note

Information provided in this article is for educational purposes only. Pocket PC Developer Network is not responsible in any way for any use of this code. We publish this information because it is available in official documentation.

Answer

You should use KernelIOControl and SetCleanRebootFlag functions. Insert following code into your program and you could easily clean Pocket PC device calling HardResetPocketPC():

Source code

#include <winioctl.h > #define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS) extern "C" __declspec(dllimport)void SetCleanRebootFlag(void); extern "C" __declspec(dllimport) BOOL KernelIoControl( DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned); BOOL HardResetPocketPC() { SetCleanRebootFlag(); return KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL); }

Note: actual implementation is determined by the original equipment manufacturer (OEM) and some devices may not support this function.

Note: all data will be erased from Pocket PC during hard-reset!

Related resources: