WDF 缓冲区指针的 WDM 等效项

Kernel-Mode驱动程序框架 (KMDF) 或 User-Mode Driver Framework (UMDF) 驱动程序使用以下方法来检索缓冲和直接 I/O 的 I/O 缓冲区。 除非另行指定,否则方法适用于 KMDF 和 UMDF。

下表描述了检索方法针对缓冲 I/O 和直接 I/O 的IRP_MJ_READ、IRP_MJ_WRITE和IRP_MJ_DEVICE_CONTROL请求返回的内容。 两个 I/O 请求都不需要特殊处理,因为驱动程序必须在请求用户模式进程的上下文中运行时检索缓冲区。

IRP_MJ_READ请求的缓冲区

为了检索读取请求的缓冲区,KMDF 驱动程序调用 WdfRequestRetrieveOutputXxx 方法之一。 每个方法返回的缓冲区各不相同,具体取决于驱动程序执行缓冲 I/O 还是直接 I/O。 下表描述了 WDM 术语中每个方法返回的指针。

函数 缓冲的 I/O 直接 I/O
WdfRequestRetrieveOutputBuffer Irp-AssociatedIrp.SystemBuffer> MmGetSystemAddressForMdlSafe (Irp-MdlAddress>)
WdfRequestRetrieveOutputWdmMdl (KMDF 仅) Irp-AssociatedIrp.SystemBuffer> (MDL) 生成内存描述符列表,并返回 MDL。 Irp-MdlAddress>
WdfRequestRetrieveOutputMemory 返回 WDFMEMORY 对象。 对此对象调用 WdfMemoryGetBuffer 以获取 Irp-AssociatedIrp.SystemBuffer> 返回 WDFMEMORY 对象。 在此对象上调用 WdfMemoryGetBuffer 以获取 MmGetSystemAddressForMdlSafe (Irp-MdlAddress>) 。

IRP_MJ_WRITE请求的缓冲区

为了检索写入请求的缓冲区,KMDF 驱动程序调用 WdfRequestRetrieveInputXxx 方法之一。 每个方法返回的缓冲区各不相同,具体取决于驱动程序执行缓冲 I/O 还是直接 I/O。 下表描述了 WDM 术语中每个方法返回的指针。

函数 缓冲的 I/O 直接 I/O
WdfRequestRetrieveInputBuffer Irp-AssociatedIrp.SystemBuffer> MmGetSystemAddressForMdlSafe (Irp-MdlAddress>)
WdfRequestRetrieveInputWdmMdl (KMDF 仅) Irp-AssociatedIrp.SystemBuffer> 生成 MDL 并返回 MDL。 Irp-MdlAddress>
WdfRequestRetrieveInputMemory 返回 WDFMEMORY 对象。 对此对象调用 WdfMemoryGetBuffer 以获取 Irp-AssociatedIrp.SystemBuffer> 返回 WDFMEMORY 对象。 在此对象上调用 WdfMemoryGetBuffer 以获取 MmGetSystemAddressForMdlSafe (Irp-MdlAddress>) 。

IRP_MJ_DEVICE_CONTROL请求的缓冲区

为了检索设备 I/O 控制请求的缓冲区,KMDF 驱动程序调用 WdfRequestRetrieveInputXxxWdfRequestRetrieveOutputXxx 方法。 每个方法返回的缓冲区各不相同,具体取决于驱动程序是执行 缓冲 I/O 还是直接 I/O,如下表所示:

函数 缓冲的 I/O 直接 I/O
WdfRequestRetrieveInputBuffer Irp-AssociatedIrp.SystemBuffer> MmGetSystemAddressForMdlSafe (Irp-MdlAddress>)
WdfRequestRetrieveInputWdmMdl (KMDF 仅) Irp-AssociatedIrp.SystemBuffer> 生成 MDL 并返回 MDL。 Irp-AssociatedIrp.SystemBuffer> 生成 MDL 并返回 MDL。
WdfRequestRetrieveInputMemory 返回 WDFMEMORY 对象。 对此对象调用 WdfMemoryGetBuffer 以获取 Irp-AssociatedIrp.SystemBuffer> 返回 WDFMEMORY 对象。 在此对象上调用 WdfMemoryGetBuffer 以获取 MmGetSystemAddressForMdlSafe (Irp-MdlAddress>) 。
WdfRequestRetrieveOutputBuffer Irp-AssociatedIrp.SystemBuffer> MmGetSystemAddressForMdlSafe (Irp-MdlAddress>)
WdfRequestRetrieveOutputWdmMdl (KMDF 仅) Irp-AssociatedIrp.SystemBuffer> (MDL) 生成内存描述符列表,并返回 MDL。 Irp-MdlAddress>
WdfRequestRetrieveOutputMemory 返回 WDFMEMORY 对象。 对此对象调用 WdfMemoryGetBuffer 以获取 Irp-AssociatedIrp.SystemBuffer> 返回 WDFMEMORY 对象。 在此对象上调用 WdfMemoryGetBuffer 以获取 MmGetSystemAddressForMdlSafe (Irp-MdlAddress>) 。