Error in mscorlib.dll
I've got the error as "An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorelib.bll" without any description.
I tried to use code as I post below ... did I make something wrong ?
This error occured at the line == >"GVOP = Marshal.PtrToStructure(ptrGVOP, GetType(GETVERSIONOUTPARAMS))" in try block but it throw error immediately .. don't go into catch block..
I've tried to debug some value .. such as 'hDrive', 'ptrGVOP' ... they all got some values..
Private Structure GETVERSIONOUTPARAMS
Dim bVersion As Byte
Dim bRevision As Byte
Dim bReserved As Byte
Dim bIDEDeviceMap As Byte
Dim fCapabilities As Long
<VBFixedArray(3)> Dim dwReserved() As Long
Public Sub Initialize()
Public Declare Function DeviceIoControl Lib "kernel32.dll" _
(ByVal hDevice As Int32, _
ByVal dwIoControlCode As Int32, _
ByVal lpInBuffer As IntPtr, _
ByVal nInBufferSize As Int32, _
ByRef lpOutBuffer As IntPtr, _
ByVal nOutBufferSize As Int32, _
ByRef lpBytesReturned As Int32, _
ByRef lpOverlapped As OVERLAPPED) As Int32
Private Function MyFunction(ByVal hDrive As Long) As Boolean
Dim cbr As Long
Dim GVOP As GETVERSIONOUTPARAMS = New GETVERSIONOUTPARAMS
Dim ptrGVOP As IntPtr
MyFunction = DeviceIoControl(hDrive, _
IntPtr.Zero, Marshal.SizeOf(GVOP), _
GVOP = Marshal.PtrToStructure(ptrGVOP, GetType(GETVERSIONOUTPARAMS))
Catch ex As Exception
Thaks in advance