DeviceIoControl

All,

Is there any limit to the size of the input buffer that may be passed to
DeviceIoControl? If so, is there any other method available for passing
sizeable amounts of data (~800k) to a driver?

Many thanks for your time,

James

What method are your ioctls set up as? Using METHOD_NEITHER, no copying
occurs, though you must be very aware of context issues.

Pete

Peter Scott
xxxxx@KernelDrivers.com
www.KernelDrivers.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of James Wain
Sent: Friday, February 28, 2003 6:45 AM
To: NT Developers Interest List
Subject: [ntdev] DeviceIoControl

All,

Is there any limit to the size of the input buffer that may be passed to
DeviceIoControl? If so, is there any other method available for passing
sizeable amounts of data (~800k) to a driver?

Many thanks for your time,

James


You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The size is specified as “DWORD nInBufferSize” and this should be enough on
32 bit machines.

Joze

-----Original Message-----
From: James Wain
Sent: Friday, February 28, 2003 2:45 PM
Subject: [ntdev] DeviceIoControl

Is there any limit to the size of the input buffer that may be passed to
DeviceIoControl? If so, is there any other method available for passing
sizeable amounts of data (~800k) to a driver?

Many thanks for your time,

James

Pete,

I’m using METHOD_BUFFERED, although I think this may be unnecessary, since
I’m not using asynchronous IO. As for context issues, I’m fairly new to
driver development, so I’m not fully aware of potential pitfalls. Any
enlightenment would be very welcome!

Many thanks

James

What method are your ioctls set up as? Using METHOD_NEITHER, no copying
occurs, though you must be very aware of context issues.

Pete

Peter Scott
xxxxx@KernelDrivers.com
www.KernelDrivers.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of James Wain
Sent: Friday, February 28, 2003 6:45 AM
To: NT Developers Interest List
Subject: [ntdev] DeviceIoControl

All,

Is there any limit to the size of the input buffer that may be passed to
DeviceIoControl? If so, is there any other method available for passing
sizeable amounts of data (~800k) to a driver?

Many thanks for your time,

James


You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

As long as you are processing the IOCtl in the driver in the same
context as the buffers are allocated in user space;i.e. in the same
process context and you are not passing them to a worker thread, then
just use METHOD_NEITHER and lock the buffers down when you get them in
your driver. This way if the user app dies you won’t touch invalid
buffers.

There is more info on the OSR site either in the FAQ or in the list
archives. The advantage of this method is no copying is performed, the
disadvantage is that the address may not be valid in your context, etc.

Pete

Peter Scott
xxxxx@KernelDrivers.com
www.KernelDrivers.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@vutrix.com
Sent: Friday, February 28, 2003 7:09 AM
To: NT Developers Interest List
Subject: [ntdev] RE: DeviceIoControl

Pete,

I’m using METHOD_BUFFERED, although I think this may be unnecessary,
since
I’m not using asynchronous IO. As for context issues, I’m fairly new to
driver development, so I’m not fully aware of potential pitfalls. Any
enlightenment would be very welcome!

Many thanks

James

What method are your ioctls set up as? Using METHOD_NEITHER, no
copying
occurs, though you must be very aware of context issues.

Pete

Peter Scott
xxxxx@KernelDrivers.com
www.KernelDrivers.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of James Wain
Sent: Friday, February 28, 2003 6:45 AM
To: NT Developers Interest List
Subject: [ntdev] DeviceIoControl

All,

Is there any limit to the size of the input buffer that may be passed
to
DeviceIoControl? If so, is there any other method available for
passing
sizeable amounts of data (~800k) to a driver?

Many thanks for your time,

James


You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

To prevent copying and still have a valid address even in arbitary thread
context, use METHOD_IN/OUT_DIRECT. A command and control buffer will be
passed to the driver in Irp->AssociatedIrp.SystemBuffer. Irp->MdlAddress
will point to an MDL that contains the data buffer you described in the
OutBuffer/OutBufferLength parameters. The advantages is that the MDL is
ready to be passed to system DMA functions such as GetScatterGatherList.
Snce this data buffer is described as an MDL your limitation there is the
maximum number of page frame numbers that an MDL can contain which just
happens to be 64Meg.


Gary G. Little
Have Computer, will travel …
909-698-3191
909-551-2105

“Peter Scott” wrote in message
news:xxxxx@ntdev…
>
>
> As long as you are processing the IOCtl in the driver in the same
> context as the buffers are allocated in user space;i.e. in the same
> process context and you are not passing them to a worker thread, then
> just use METHOD_NEITHER and lock the buffers down when you get them in
> your driver. This way if the user app dies you won’t touch invalid
> buffers.
>
> There is more info on the OSR site either in the FAQ or in the list
> archives. The advantage of this method is no copying is performed, the
> disadvantage is that the address may not be valid in your context, etc.
>
> Pete
>
> Peter Scott
> xxxxx@KernelDrivers.com
> www.KernelDrivers.com
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@vutrix.com
> Sent: Friday, February 28, 2003 7:09 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: DeviceIoControl
>
> Pete,
>
> I’m using METHOD_BUFFERED, although I think this may be unnecessary,
> since
> I’m not using asynchronous IO. As for context issues, I’m fairly new to
> driver development, so I’m not fully aware of potential pitfalls. Any
> enlightenment would be very welcome!
>
> Many thanks
>
> James
>
> > What method are your ioctls set up as? Using METHOD_NEITHER, no
> copying
> > occurs, though you must be very aware of context issues.
> >
> > Pete
> >
> > Peter Scott
> > xxxxx@KernelDrivers.com
> > www.KernelDrivers.com
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of James Wain
> > Sent: Friday, February 28, 2003 6:45 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] DeviceIoControl
> >
> >
> > All,
> >
> > Is there any limit to the size of the input buffer that may be passed
> to
> > DeviceIoControl? If so, is there any other method available for
> passing
> > sizeable amounts of data (~800k) to a driver?
> >
> > Many thanks for your time,
> >
> > James
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@kerneldrivers.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
>