Ioskipcurrentirpstacklocation. Go

Source: Internet
Author: User

Original link: http://m.blog.csdn.net/blog/ruanben/19758769#

When the drives are layered, they are registered in a chain, and the IRP is passed in the chain, from the top, to the bottom, and back to the top.
To adapt to this system, the size of the IRP structure is not fixed, the general structure is as follows:
--------------------
| IRP Header |
--------------------
| Io_stack_location |<-----Lowest driver STACK location #index1
--------------------
| Io_stack_location |<-----Next higher STACK location #index2
--------------------
| Io_stack_location |<-----Topmost driver STACK location #index3
--------------------
That is, the chain of the top-level drive, the corresponding io_stack_location is at the bottom
The index of the io_stack_location that holds the current driver in the IRP header, starting from 1, not starting from 0
At the same time, the address of the io_stack_location corresponding to the current driver is also preserved.
When the top driver finishes processing the IRP, it calls IoCallDriver, which causes the index to be reduced by 1 and the address to the next io_stack_location address.
Then the IRP is handed over to the next driver processing,
The role of the Ioskipcurrentirpstacklocation macro is to make the io_stack_location pointer less forward
The IoCallDriver function causes the io_stack_location pointer to move forward, neutralizing the result that the io_stack_location2006-11-20 pointer is unchanged
When the dispatch routine of the next driver calls Iogetcurrentirpstacklocation, it will receive the same as we are making
Using the exact same io_stack_location pointer, so that it will handle the same request (the same primary
Code) and the same parameters.

Attached: Filter drive and IRP processing mode

A.pending Completing Routines

Iocopycurrentirpstacklocationtonext

B. Ignoring direct issuance

Ioskipcurrentirpstacklocation, the lower device gets the same io_stacklocation as the current one.

C. End of IRP not issued

Pio_stack_location irpstack = iogetcurrentirpstacklocation (IRP);

Irp->iostatus.status = status_success;

irp->iostatus.information = 0;

IoCompleteRequest (irp,io_no_increment);

D. Manually build the IRP

IoAllocateIrp

Iogetnextirpstacklocation

Ioskipcurrentirpstacklocation. Go

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.