ENTERPRISE

Windows 7 : Programming Multiple I/O Queues and Programming I/O - Creating and Configuring the Queues (part 2)

7/17/2014 4:40:05 AM

2.2. Code to Create Queues for Read Requests

The driver creates a manual queue for read requests in the same way that it did for write requests. The only difference is that it configures the queue for request dispatching, so that KMDF places read requests directly into the queue. The driver creates the queue as follows:

WDF_IO_QUEUE_CONFIG_INIT (
&ioQueueConfig,
WdfIoQueueDispatchManual
);

status = WdfIoQueueCreate (
FdoData->WdfDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&FdoData->PendingReadQueue
);

if (!NT_SUCCESS (status))
{
return status;
}

Status = WdfDeviceConfigureRequestDispatching (
FdoData->WdfDevice,
FdoData->PendingReadQueue,
WdfRequesttypeRead
);
if (!NT_SUCCESS (status))
{
ASSERT (NT_SUCCESS (status));
return status;
}


2.3. Code to Create Queues for Device I/O Control Requests

The driver creates a second pair of parallel and internal manual queues for IRP_MJ_DEVICE_IO_CONTROL requests, just as it did for write requests, as follows:

WDF_IO_QUEUE_CONFIG_INIT (
&ioQueueConfig,
WdfIoQueueDispatchParallel
);

ioQueueConfig.EvtIoDeviceControl =
PciDrvEvtIoDeviceControl;

status = WdfIoQueueCreate (
FdoData->WdfDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&FdoData->IoctlQueue
);

if (!NT_SUCCESS (status))
{
return status;
}

status = WdfDeviceConfigureRequestDispatching (
FdoData->WdfDevice,
FdoData->IoctlQueue,
WdfRequestTypeDeviceControl
);

if (!NT_SUCCESS (status))
{
ASSERT (NT_SUCCESS (status));
return status;
}

// Create internal queue for pending IOCTL requests.

WDF_IO_QUEUE_CONFIG_INIT (
&ioQueueConfig,
WdfIoQueueDispatchManual
);

status = WdfIoQueueCreate (
FdoData->WdfDevice,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&FdoData-PendingIoctlQueue
);

if (!NT_SUCCESS (status))
{
return status;
}


The driver configures these two queues exactly as it did the parallel and manual queues for write requests. The only difference is that it set a callback for EvtDeviceIoControl instead of EvtIoWrite and configures request dispatching for WdfRequestTypeDeviceControl instead of WdfRequestTypeWrite.

Other  
  •  Microsoft Exchange Server 2010 : Managing Mailbox and public Folder Databases (part 2) - Moving Databases
  •  Microsoft Exchange Server 2010 : Managing Mailbox and public Folder Databases (part 1) - Mounting and Dismounting Databases
  •  Microsoft Exchange Server 2010 : Using Public Folder Databases (part 4) - Configuring Public Folder Referrals, Recovering Deleted Items from Public Folder Databases
  •  Microsoft Exchange Server 2010 : Using Public Folder Databases (part 3) - Configuring Public Folder Replication
  •  Microsoft Exchange Server 2010 : Using Public Folder Databases (part 2) - Setting Public Folder Database Limits
  •  Microsoft Exchange Server 2010 : Using Public Folder Databases (part 1) - Creating Public Folder Databases
  •  Microsoft Exchange Server 2010 : Working with Active Mailbox Databases (part 3) - Recovering Deleted Mailboxes , Recovering Deleted Items from Mailbox Databases
  •  Microsoft Exchange Server 2010 : Working with Active Mailbox Databases (part 2) - Setting Mailbox Database Limits and Deletion retention
  •  Microsoft Exchange Server 2010 : Working with Active Mailbox Databases (part 1) - Creating Mailbox Databases
  •  Microsoft Exchange Server 2010 : Managing Public Folder Settings (part 3) - Manipulating, Renaming, and Recovering Public Folders
  •  
    Top 10
    Extending LINQ to Objects : Writing a Single Element Operator (part 2) - Building the RandomElement Operator
    Extending LINQ to Objects : Writing a Single Element Operator (part 1) - Building Our Own Last Operator
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
    OPEL MERIVA : Making a grand entrance
    FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
    BMW 650i COUPE : Sexy retooling of BMW's 6-series
    BMW 120d; M135i - Finely tuned
    PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
    PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS