Performing a Hard Reset through Software in C++CESD|200157Applies To
OverviewFor the majority of users performing a Hard Reset involves powering down the device, removing all battery cells and leaving the device uninitialised for several minutes. More InfoThe code below demonstrates how to flush the RAM contents and reinitialise a Windows CE hard boot using C++ #include <windows.h>
#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); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { SetCleanRebootFlag(); KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL); return 0; } AcknowledgementsWith thanks to Monica Erdody for assisting us with this article. |