Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to reboot WinCE Device ?

2,367 views
Skip to first unread message

Avex

unread,
Jan 4, 2006, 7:21:27 AM1/4/06
to
Hi there,

How do I reboot WinCE device? ExitWindowEx ? I cannot find any API to use.
thanks for any help,

Avex


Philippe Majerus

unread,
Jan 4, 2006, 8:05:51 AM1/4/06
to
> How do I reboot WinCE device? ExitWindowEx ? I cannot find any API to use.
> thanks for any help,

You never really exit windows, but you can reset the hardware, and restart
the operating system.
Just make sure you add the code to close all running applications if you
don't want the user to lose any data.

extern "C"
{
#include <winioctl.h>
BOOL KernelIoControl(DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD );
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED,
FILE_ANY_ACCESS)
}

void SoftReset ()
{
// try Windows CE <= 3.0 reset method
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
// if failed, try the Windows >= CE 4.0 specific method
SetSystemPowerState (NULL, POWER_STATE_RESET, 0);
}

The first method goes through the HAL, asking OEM code to perform a reboot.
The second method uses the WinCE 4 power manager, newer devices might not be
able to reset themselves from the HAL, the power manager is at a higher
level and can communicate with more hardware (I know at least one device
which control its reboot through I2C, and cannot perform the reboot from the
HAL).

--
Philippe Majerus
http://www.phm.lu


Bill T

unread,
Jan 4, 2006, 8:12:05 AM1/4/06
to
If your platfrom supports it, you can use KernelIoControl( IOCTL_HAL_REBOOT,
NULL, 0, NULL, 0, NULL );. PB enviroment variable BSP_HARDRESETbeing set or
not determines the type of reset.

Steve Maillet (eMVP)

unread,
Jan 4, 2006, 1:40:22 PM1/4/06
to
>PB enviroment variable BSP_HARDRESETbeing set or
>not determines the type of reset.
That variable is BSP specific and not an officially standardized setting.
Some might use it others don't


--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com


Jemmy

unread,
Jan 5, 2006, 4:34:31 AM1/5/06
to

> extern "C"
> {
> #include <winioctl.h>
> BOOL KernelIoControl(DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD );
> #define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED,
> FILE_ANY_ACCESS)
> }
>
> void SoftReset ()
> {
> // try Windows CE <= 3.0 reset method
> KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
> // if failed, try the Windows >= CE 4.0 specific method
> SetSystemPowerState (NULL, POWER_STATE_RESET, 0);
> }

Thanks, it works!

0 new messages