Hi I solved the problem. The problem was the declaration i made of
IOCTL_SERIAL_GET_LINE_CONTROL. the C# function i wrote to emulate the
CTL_CODE macro to construct the IOCTL's codes was wrong. So i was passing to
DeviceIoControl a 'guess-what' control code so it was probably expecting as
input or output buffer something different from i was actually passing.
And yes the size of the structures are all right. I put that in that way
because i was desperate and i was triyng all kind of thing but at first i had
something like this:
IntPtr
control=Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SERIAL_LINE_CONTROL)); or
something like that
Many Thanks anyway for the reply , see you!
[quoted text, click to view] "bullshark@gmail.com" wrote:
>
> eduwushu wrote:
> > Hi Im trying tu use deviceiocontrol to retrieve serial port informationin a
>
> > IntPtr control = Marshal.AllocHGlobal(3);
>
> I don't have reference handy. Are you sure about the size of the
> SERIAL_LINE_CONTROL structure? It seems kind of odd to use just three
> bytes.
>
> Could you post your declarations for SERIAL_LINE_CONTROL and
> DeviceIoControl?
>
> bullshark
>