Windows Kernel Study Notes (6)-[summary] four different ways to create IRP

Source: Internet
Author: User
Tags subdomain

In the driver, other drivers are often called.
IRP
, And then
IRP
The dispatch letter passed to the corresponding driver is a relatively simple method. The following describes how to manually create
IRP
Methods and Their features.



Create
IRP
Total
4
Method. By calling:
Iobuildsynchronousfsdrequest
,
Iobuildasynchronousfsdrequest
,
Iobuilddeviceiocontrol
And
Ioallocateirp
This
4
Kernel functions. Here,
Ioallocateirp
Is the underlying kernel function. The other three kernel functions belong to kernel functions near the upper layer.
Ioallocateirp
.



These functions are all documented functions.
DDK documentation
Here we will not talk about the differences between them:

1.



Can be created
IRP
Type

The four functions can be created
IRP
The types are different.
Iobuildsynchronousfsdrequest

Used to create Synchronization
IRP
Request, but only the following types
IRP
:
Irp_mj_pnp
, Irp_mj_read, irp_mj_write, irp_mj_flush_buffers

And irp_mj_shutdown
;
Iobuildasynchronousfsdrequest
Can be created
IRP
Type and
Iobuildsynchronousfsdrequest
The same (as can be seen from the name), but it is used to create an asynchronous
IRP
Request.
Iobuilddeviceiocontrol
Can be created
IRP
Type: irp_mj_device_control


And irp_mj_internal_device_control
. And
Iobuilddeviceiocontrol
Only synchronous
IRP
. All three functions have one
Ulong
Specify the created
IRP
Type.
Ioallocateirp
The function is flexible to use and can create any type
IRP
But it is not specified by the parameter, but is automatically filled in after the creation, requiring the user
IRP
Have a familiar understanding of the structure.

2.



After creation
IRP
Object Deletion

Iobuildsynchronousfsdrequest
,
Iobuildasynchronousfsdrequest
And
Iobuilddeviceiocontrol
The kernel function is being created.
IRP
The programmer is not required to delete
IRP
, The operating system will automatically delete it. Use
Ioallocateirp
Kernel Function Creation
IRP
Must be called by the programmer.
Iofreeirp
Delete kernel functions
IRP
Object.

3.



Associated events

Iobuildsynchronousfsdrequest
And
Iobuilddeviceiocontrol
In the create
IRP
You need to prepare an event for them.
IRP
Requests are associated when
IRP
This event is triggered when the request ends. Used in the program
Kewaitforsingleobject
Function wait.
Iobuildasynchronousfsdrequest
Function Creation
IRP
You do not need to prepare the event, but you can use
IRP
Of
Userevent
Subdomain notification
IRP
The end of the request.

When executed
Iocompleterequest
During kernel functions, the operating system checks
IRP
Of
Userevent
Whether the subdomain is empty. If this subdomain is empty, it indicates an event pointer.
Iocompleterequest
This event is set.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.