WARM BOOT - VB.NET

M

Mobile Boy 36

Is there a way to perform a warm boot on a pocket pc 2003 device from within
vb.net code? Managed or unmanged. Does someone have a working piece of code
please?

This was my version but it doesn't seem to work, although it worked well in
EVB.



Private Const GENERIC_READ As Integer = &H80000000
Private Const GENERIC_WRITE As Integer = &H40000000
Private Const OPEN_EXISTING As Integer = 3
Private Const WBFILE_ATTRIBUTE_NORMAL As Integer = &H80
Private Const INVALID_HANDLE_VALUE As Integer = -1
Private Const IOCTL_TERMINAL_RESET As Integer = &H22C802

Private Declare Function CreateFile Lib "Coredll" Alias "CreateFileW" (ByVal
lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As
Integer, ByVal lpSecurityAttributes As Integer, ByVal dwCreationDisposition
As Integer, ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As
Integer) As Integer
Private Declare Function DeviceIoControl Lib "Coredll" (ByVal hDevice As
Integer, ByVal dwIoControlCode As Integer, ByVal lpInBuffer As String, ByVal
nInBufferSize As Integer, ByVal lpOutBuffer As String, ByVal nOutBufferSize
As Integer, ByVal lpBytesReturned As Integer, ByVal lpOverlapped As Integer)
As Integer
Private Declare Function CloseHandle Lib "Coredll" (ByVal hObject As
Integer) As Integer


Public Shared Sub WarmReset()

Dim dwBytes As Integer
Dim hFile As Integer
Dim dwCode As Integer

'vbNullPtr --> Nothing

hFile = CreateFile("SYI1:", GENERIC_READ Or GENERIC_WRITE, 0,
Nothing, OPEN_EXISTING, WBFILE_ATTRIBUTE_NORMAL, 0)
If (hFile <> INVALID_HANDLE_VALUE) Then
DeviceIoControl(hFile, IOCTL_TERMINAL_RESET, Nothing, 0,
Nothing, 0, dwBytes, Nothing)
CloseHandle(hFile)
End If

End Sub




Best regards,

Mobile boy
 

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