2009-05-07

WinMobile İçin Reset Sınıfı




Public Class SoftReset

Private Const FILE_DEVICE_HAL As Integer = &H101
Private Const METHOD_BUFFERED As Integer = 0
Private Const FILE_ANY_ACCESS As Integer = 0

<DllImport("coredll.dll", CharSet:=CharSet.Auto)> _
Private Shared Function KernelIoControl(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
End Function

Private Shared 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 Shared Sub [Do]()
Dim bytesReturned As Integer = 0
Dim IOCTL_HAL_REBOOT As Integer = CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
Dim sonuc = KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, bytesReturned)
End Sub

End Class