Limit on DeviceIoControl

Is there any memory limit on how much data (size of data in IN/OUT buffer) can be sent using DeviceIoControl ?

Abhijit

There is no general limit imposed by DeviceIoControl apart from the bit
width of the InBufferSize and outBufferSize which are 32 bits wide. So you
cannot exceed 4G of buffer length. A device driver processing the
deviceIoControl depending on the IOCTL command may have length limitations.
If the ioctl is a METHOD_DIRECT IOCTL then the OS has to lock the pages in
memory. The amount of pages that can be locked is limited by the memory
manager according to some global policies. If you exceed the amount
DeviceIoControl will get an error status ERROR_WORKING_SET_QUOTA.


Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.

“Abhijit” wrote in message news:xxxxx@ntdev…
Is there any memory limit on how much data (size of data in IN/OUT buffer)
can be sent using DeviceIoControl ?

Abhijit

I am passing 512 K buffer to my driver. In this case which method will be
efficient, METHOD_DIRECT or METHOD_BUFFERED ?

Thanks for your answer.
Abhijit.

“Nar Ganapathy[MS]” wrote in message
news:xxxxx@ntdev…
> There is no general limit imposed by DeviceIoControl apart from the bit
> width of the InBufferSize and outBufferSize which are 32 bits wide. So you
> cannot exceed 4G of buffer length. A device driver processing the
> deviceIoControl depending on the IOCTL command may have length
limitations.
> If the ioctl is a METHOD_DIRECT IOCTL then the OS has to lock the pages in
> memory. The amount of pages that can be locked is limited by the memory
> manager according to some global policies. If you exceed the amount
> DeviceIoControl will get an error status ERROR_WORKING_SET_QUOTA.
>
> –
> Nar Ganapathy
> Windows Core OS group
> This posting is provided “AS IS” with no warranties, and confers no
rights.
>
> “Abhijit” wrote in message news:xxxxx@ntdev…
> Is there any memory limit on how much data (size of data in IN/OUT buffer)
> can be sent using DeviceIoControl ?
>
>
> Abhijit
>
>
>

On Wed, 2004-08-18 at 23:32, Abhijit wrote:

I am passing 512 K buffer to my driver. In this case which method will be
efficient, METHOD_DIRECT or METHOD_BUFFERED ?

METHOD_DIRECT should be more efficient, particularly if you’re doing it
more than once. METHOD_BUFFERED results in a double-buffer of the
data. 512k is a lot of data to double-buffer.

-sd

Thanks.

“Steve Dispensa” wrote in message
news:xxxxx@ntdev…
> On Wed, 2004-08-18 at 23:32, Abhijit wrote:
> > I am passing 512 K buffer to my driver. In this case which method will
be
> > efficient, METHOD_DIRECT or METHOD_BUFFERED ?
>
> METHOD_DIRECT should be more efficient, particularly if you’re doing it
> more than once. METHOD_BUFFERED results in a double-buffer of the
> data. 512k is a lot of data to double-buffer.
>
> -sd
>
>
>

Indeed. Typically the rule of thumb is that ‘page size or greater’ plus
“frequency > n” argue for using an MDL although I don’t know of any actual
analysis.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Steve Dispensa
Sent: Thursday, August 19, 2004 1:06 AM
To: Windows System Software Devs Interest List
Subject: Re: Re:[ntdev] Limit on DeviceIoControl

On Wed, 2004-08-18 at 23:32, Abhijit wrote:
> I am passing 512 K buffer to my driver. In this case which
method will
> be efficient, METHOD_DIRECT or METHOD_BUFFERED ?

METHOD_DIRECT should be more efficient, particularly if
you’re doing it more than once. METHOD_BUFFERED results in a
double-buffer of the data. 512k is a lot of data to double-buffer.

-sd


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The usual heuristic is to use _DIRECT only if the requests are > PAGE_SIZE.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Abhijit” wrote in message
news:…
> I am passing 512 K buffer to my driver. In this case which method will be
> efficient, METHOD_DIRECT or METHOD_BUFFERED ?
>
> Thanks for your answer.
> Abhijit.