There are some reasons to reset a device. Some examples would be installing a new driver or changi...
There are some reasons to reset a device. Some examples would be installing a new driver or changing the system path in the registry. These changes don’t take effect until the system boots up again.
The standard method to reset a device is to call KernelIoControl with IOCTL_HAL_REBOOT. Example:
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
Which, if implemented by the OEM, will cause the device to reset. It is up to the OEM to implement this and to implement it as either a soft reset, where RAM is maintained during the reset, or a hard reset where the entire system is reset.
Note: In Windows CE 6.0, IOCTL_HAL_REBOOT will have no effect if called from a user application or driver. The OEM can override this behavior, see Windows CE 6.0: User Mode KernelIoControlfor more.
You can call SetCleanRebootFlag() before calling KernelIoControl to request that the ObjectStore be cleared when the kernel starts. Example:
SetCleanRebootFlag();
Neither of these methods will reset the persistent registry or delete files stored on a persistent disk. Doing either would be OEM specific.
---------------------------------------------------------------------------------------------------------------------------------
Note: This article is written by Bruce Eitman, and is posted to the Embedded101 site with Bruce’s permission.
Copyright © 2010 – Bruce Eitman – All Rights Reserved
http://geekswithblogs.net/BruceEitman/