Groups | Blog | Home
all groups > dotnet compact framework > september 2005 >

dotnet compact framework : Programmatically Hard reboot



Miguel
9/28/2005 10:27:51 AM
You have to invoke the SetCleanRebootFlag or somekind before you invoke
KernelIOControl with IOCTL_HAL_REBOOT

Regards


[quoted text, click to view]
Peter Foot [MVP]
9/28/2005 10:34:27 AM
Here is the code in C#:-
http://blogs.msdn.com/windowsmobile/archive/2004/04/01/105878.aspx

And VB.NET
http://www.peterfoot.net/RebootADevice.aspx

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net

[quoted text, click to view]

Harry Simpson
9/28/2005 12:19:52 PM
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

Joanne
9/28/2005 12:29:48 PM
i think you mean a soft reset. right?

[quoted text, click to view]

Harry Simpson
9/28/2005 1:42:54 PM
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


[quoted text, click to view]

Harry Simpson
9/28/2005 2:19:57 PM
Thanks Peter,

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

Harry

[quoted text, click to view]

Harry Simpson
9/28/2005 2:20:25 PM
nope, hard reboot. <g>

[quoted text, click to view]

Steve Maillet (eMVP)
10/1/2005 7:52:02 PM
Forcing a hard reboot is a pretty nasty and intrusive thing to do. Why would
you need that for a managed application?

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

AddThis Social Bookmark Button