E
Einar Høst
I'm using the Win32 ReadFile function to read data from a tape. I've exposed
an unsafe version of ReadFile with this signature:
static extern unsafe bool ReadFile(IntPtr hFile, void* lpBuffer, uint
nNumberOfBytesToRead, IntPtr lpNumberOfBytesRead, IntPtr lpOverlapped);
which works just fine. However, I'd like to expose a safe version instead,
with a signature like:
static extern bool ReadFile(IntPtr hFile, IntPtr lpBuffer, uint
nNumberOfBytesToRead, IntPtr lpNumberOfBytesRead, IntPtr lpOverlapped);
The problem is how to marshal the managed byte array in a way that allows it
to be populated by ReadFile? I've been looking at the samples provided by
Sonja Keserovic, but I don't quite understand what to do...
Any help would be much appreciated!
Regards,
Einar
an unsafe version of ReadFile with this signature:
static extern unsafe bool ReadFile(IntPtr hFile, void* lpBuffer, uint
nNumberOfBytesToRead, IntPtr lpNumberOfBytesRead, IntPtr lpOverlapped);
which works just fine. However, I'd like to expose a safe version instead,
with a signature like:
static extern bool ReadFile(IntPtr hFile, IntPtr lpBuffer, uint
nNumberOfBytesToRead, IntPtr lpNumberOfBytesRead, IntPtr lpOverlapped);
The problem is how to marshal the managed byte array in a way that allows it
to be populated by ReadFile? I've been looking at the samples provided by
Sonja Keserovic, but I don't quite understand what to do...
Any help would be much appreciated!
Regards,
Einar