Reboot windows ce 5.0

A

Arnaud (MesNews)

Hi,

I have an application on a windows ce 5.0. I need to reboot the system
by code. Is it possible ?

Thanks
 
A

Arnaud (MesNews)

Ok, sorry, I found the solution on Visual Studio :

Private Declare Function KernelIoControl Lib "coredll.dll" (ByVal dwIoControlCode As Integer, ByVal lpInBuf As IntPtr, ByVal nInBufSize As Integer, ByVal lpOutBuf As IntPtr, ByVal nOutBufSize As Integer, ByRef lpBytesReturned As Integer) As Integer

Private Function CTL_CODE(ByVal DeviceType As Integer, ByVal Func As Integer, ByVal Method As Integer, ByVal Access As Integer) As Integer
Return (DeviceType << 16) Or (Access << 14) Or (Func << 2) Or Method
End Function

Public Function ResetPocketPC() As Integer
Const FILE_DEVICE_HAL As Integer = &H101
Const METHOD_BUFFERED As Integer = 0
Const FILE_ANY_ACCESS As Integer = 0
Dim bytesReturned As Integer = 0
Dim IOCTL_HAL_REBOOT As Integer

IOCTL_HAL_REBOOT = CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
Return KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
End Function
 
P

Paul G. Tobey [eMVP]

Maybe that's the solution and maybe not. You should really consult the
documentation for the specific device you're running on. Many support that
Kernel I/O control message and it might even be the right way to do the
reboot. However, there might be a better way that preserves the registry,
for example, before rebooting and shut down all of the device drivers before
reset is just fired.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top