G
Guest
We have some C++ code that we need to convert to VB.net. It calls the DeviceIOControl API and uses a char array as the output buffer. We think we need to use marshalling to do this but don't know exactly how. For example if we use
Dim outputBuffer(1000) as char
anObject = DeviceIoControl(aHandle, FSCTL_ENUM_USN_DATA, EnumDataBufferIn, Marshal.SizeOf(EnumDataBufferIn), outputbuffer, Marshal.SizeOf(outputbuffer), byteBack, 0)
It tells us that outputbuffer cannot be marshalled as a meaningful structure, no meaningul size or offset can be computed. We have tried all kinds of things to try and get around this and get different errors with everything we try.
Dim outputBuffer(1000) as char
anObject = DeviceIoControl(aHandle, FSCTL_ENUM_USN_DATA, EnumDataBufferIn, Marshal.SizeOf(EnumDataBufferIn), outputbuffer, Marshal.SizeOf(outputbuffer), byteBack, 0)
It tells us that outputbuffer cannot be marshalled as a meaningful structure, no meaningul size or offset can be computed. We have tried all kinds of things to try and get around this and get different errors with everything we try.