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
#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:
-
http://www.pocketpcdn.com/sections/power.html
Section: Power
-
http://www.pocketpcdn.com/articles/softreset.html
QA: How can I soft reset Pocket PC device?
-
http://www.pocketpcdn.com/articles/poweroff.html
QA: How to suspend Pocket PC device?
- http://www.microsoft.com/mobile/developer/technicalarticles/displayoff.asp
Article: Turn Off the Display While Running Applications
- http://www.innovativedss.com/Resource/PowerOff.asp
Article: Turn the device power off in eVB
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k/html/ppc_otification.asp
Article: Power Notification