DeviceIoControl error message

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

Anybody have any ideas on this cryptic error message when calling this:
bRet = DeviceIoControl(hGpiFile, IOCTL_BLIO_READ_BYTE, lpBufferIn,
Len(lpBufferIn), lpBufferOut, Len(lpBufferOut), lpBytesReceived, Nothing)


A first chance exception of type 'System.ArgumentException' occurred in
Microsoft.VisualBasic.dll

at Microsoft.VisualBasic.CompilerServices.StructUtils.EnumerateUDT(ValueType
oStruct, IRecordEnum intfRecEnum, Boolean fGet)

at Microsoft.VisualBasic.CompilerServices.StructUtils.GetRecordLength(Object
o, Int32 PackSize)

at Microsoft.VisualBasic.Strings.Len(Object Expression)

at BlastronicsGpi.cGpi.CheckForInput() in E:\VB
Projects.Net\BlastronicsGpi\BlastronicsGpi\cGpi.vb:line 126

Argument 'oStruct' is not a valid value.





-Lou
 
Anybody have any ideas on this cryptic error message when calling this:
bRet = DeviceIoControl(hGpiFile, IOCTL_BLIO_READ_BYTE, lpBufferIn,
Len(lpBufferIn), lpBufferOut, Len(lpBufferOut), lpBytesReceived, Nothing)


A first chance exception of type 'System.ArgumentException' occurred in
Microsoft.VisualBasic.dll

at Microsoft.VisualBasic.CompilerServices.StructUtils.EnumerateUDT(ValueType
oStruct, IRecordEnum intfRecEnum, Boolean fGet)

at Microsoft.VisualBasic.CompilerServices.StructUtils.GetRecordLength(Object
o, Int32 PackSize)

at Microsoft.VisualBasic.Strings.Len(Object Expression)

at BlastronicsGpi.cGpi.CheckForInput() in E:\VB
Projects.Net\BlastronicsGpi\BlastronicsGpi\cGpi.vb:line 126

Argument 'oStruct' is not a valid value.


Looks like the Len function can't handle the type you're passing to
it. What's the data type of lpBufferIn and lpBufferOut?

You might want to try using Marshal.SizeOf instead of Len.


Mattias
 
Thanks, that worked!

Mattias Sjögren said:
Looks like the Len function can't handle the type you're passing to
it. What's the data type of lpBufferIn and lpBufferOut?

You might want to try using Marshal.SizeOf instead of Len.


Mattias
 

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

Back
Top