handling IRPs 12: Data Transfer Mechanisms
来源:互联网 发布:大庆网络问政平台下载 编辑:程序博客网 时间:2024/06/04 19:16
Data Transfer Mechanisms
The Windows family of operating systems supports three data transfer mechanisms:
· Buffered I/O operates on a kernel-mode copy of the user’s data.
· Direct I/O directly accesses the user’s data through Memory Descriptor Lists (MDLs) and kernel-mode pointers.
· Method neither I/O (neither buffered nor direct I/O) accesses the user’s data through user-mode pointers.
For standard I/O requests, such as IRP_MJ_READ and IRP_MJ_WRITE, drivers specify which transfer mechanism they support by modifying the value of theDeviceObject->Flags field soon after creating the device.
Buffered I/O
To receive read and write requests as buffered I/O, the driver sets the DO_BUFFERED_IO flag in theDeviceObject->Flags field during initialization. When a driver receives a buffered I/O request, theIrp‑>AssociatedIrp.SystemBuffer field contains the address of the kernel-mode buffer on which the driver should operate. The I/O Manager copies data from the kernel-mode buffer to the user-mode buffer during a read request, or from the user-mode buffer to the kernel-mode buffer during a write request.
Direct I/O
To receive read and write requests as direct I/O, the driver sets the DO_DIRECT_IO flag in theDeviceObject->Flags field during initialization. When a driver receives a direct I/O request, theIrp->MdlAddress field contains the address of an MDL that describes the request buffer. The MDL lists the buffer’s virtual address and size, along with the physical pages in the buffer. The I/O Manager locks these physical pages before issuing the request to the driver and unlocks them during completion. The driver must not use the user-mode buffer address specified in the MDL; instead, it must get a kernel-mode address by calling theMmGetSystemAddressForMdlSafe macro.
Neither Buffered nor Direct I/O
To receive neither buffered nor direct I/O requests, the driver sets neither the DO_BUFFERED_IO flag nor the DO_DIRECT_IO flag in theDeviceObject‑>Flags field. When a driver receives such a request, theIrp‑>UserBuffer field contains the address of the data pertaining to the request. Because this buffer is in the user address space, the driver must validate the address before using it. To validate the pointer, a driver calls theProbeForRead or ProbeForWrite function within atry/except block. The driver must also perform all access to the buffer within atry/except block.
In addition, the driver must copy the data to a safe kernel-mode address in the pool or on the stack before manipulating it. Copying the data to a kernel-mode buffer ensures that the user-mode caller cannot change the data after the driver has validated it.
Note: For detailed information on probing and on problems commonly seen in driver I/O paths, see the white paper “Common Driver Reliability Issues.”
- handling IRPs 12: Data Transfer Mechanisms
- handling IRPs 15: Building IRPs
- Handling IRPs: Introduction
- Handling IRPs 10: Optimizations
- Data Transfer Process and Error handling process
- Handling IRPs 9: Summary of Guidelines for Pending IRPs
- Handling IRPs 4: Completing an IRP
- Handling IRPs 5: Synchronous I/O Responses
- Handling IRPs 6: Asynchronous I/O Responses
- Handling IRPs 8: Propagating the Pending Bit
- handling IRPs 16: Debugging I/O Problems
- Handling IRPs: What Every Driver Writer Needs to Know -翻译
- Handling IRPs 7: IoCompletion Routines and Asynchronous I/O Responses
- Handling IRPs 11: Life Cycle of a File Object
- handling IRPs 13: I/O Control Codes (IOCTLs)
- handling IRPs 17: Call to Action and Resources
- Data Transfer
- [Cloud Computing]Mechanisms: Data Transport
- js中的typeof 操作符
- 内网渗透---常用手法
- Handling IRPs 11: Life Cycle of a File Object
- 浏览器之间的不同
- SVM学习一~四
- handling IRPs 12: Data Transfer Mechanisms
- handling IRPs 13: I/O Control Codes (IOCTLs)
- linux防火墙中的snat和dnat
- directx 中的.x文件与3dmax文件坐标转换
- UVA 10670 Work Reduction
- handling IRPs 14: Success, Error, and Warning Status for IRP Completion
- [黑马程序员]浅谈对'对象'的理解
- 3.android最简单的短信发送器
- handling IRPs 15: Building IRPs