Programmatically Hard reboot

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

Is there a way to perform a hard reboot from within a CF app?? Or is this a
hardware deal only.

After performing an update where I pull files down from the web service into
non-volatile i need to perform a hard reboot to activate the new updates....

TIA
Harry
 
You have to invoke the SetCleanRebootFlag or somekind before you invoke
KernelIOControl with IOCTL_HAL_REBOOT

Regards
 
Thanks Migel.

Here's the VB.NET code i'm using and it works great!

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
Declare Sub SetCleanRebootFlag Lib "CoreDll.dll" ()

Public Sub Reset(ByVal hard As Boolean)
Dim IOCTL_HAL_REBOOT As Integer = &H101003C
Dim bytesReturned As Integer = 0
If hard Then
SetCleanRebootFlag()
End If
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0,
bytesReturned)
End Sub 'Reset

Harry
 
Thanks Peter,

I found the C# somewhere else and translated it into VB before I saw your
post.

Harry
 
Forcing a hard reboot is a pretty nasty and intrusive thing to do. Why would
you need that for a managed application?
 
Back
Top