PC Review


Reply
Thread Tools Rate Thread

WARM BOOT - VB.NET

 
 
Mobile Boy 36
Guest
Posts: n/a
 
      9th Jun 2004
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


 
Reply With Quote
 
 
 
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      9th Jun 2004
There is a VB.NET routine to reboot the device in this post:-
http://blog.opennetcf.org/pfoot/Perm...e-a045ff7cf700

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"Mobile Boy 36" <(E-Mail Removed)> wrote in message
news:40c6cf8e$0$13203$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Mobile Boy 36
Guest
Posts: n/a
 
      10th Jun 2004
Thans Peter, this code is working well...
"Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> There is a VB.NET routine to reboot the device in this post:-
>

http://blog.opennetcf.org/pfoot/Perm...e-a045ff7cf700
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> www.inthehand.com | www.opennetcf.org
>
> "Mobile Boy 36" <(E-Mail Removed)> wrote in message
> news:40c6cf8e$0$13203$(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cold boot freezes - warm boot OK =?Utf-8?B?VGhlIEdlbnQ=?= Windows XP Help 2 20th Nov 2007 01:41 PM
How can I install a new driver under warm boot not cold boot? Jim Microsoft Dot NET Compact Framework 0 7th Jul 2006 10:56 PM
Hang up on clod boot - warm boot and rest OK Mike Windows XP Help 1 5th Apr 2004 03:36 AM
Warm Boot Darren Palmer Windows XP Hardware 2 24th Oct 2003 03:39 PM
warm boot problem - manageable, but annoying Kenny Windows XP General 1 19th Aug 2003 06:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 PM.