标签:
名词:IRP; PDO; FiDO1; FDO;
Windows 内核设计本身是不与设备交互由。设备驱动程序检测连接的设备,该设备提供的客户端功能接口与 Windows 内核间接通信。Windows 提供了一个抽象的设备支持接口调用驱动程序模型。驱动程序开发人员的工作是提供一个实现该接口已支持设备的具体要求.
。设备栈(Device Stack)
设备的每一次驱动,就会产生一个设备栈。
(1) 写请求
Win API:WriteFile
(2) 读请求
Win API:ReadFile
(3) 设备I/O控制
Win API:DeviceIoControl
IRP: I/O Request Packet
typedef struct _IRP {
.
.
PMDL MdlAddress;
ULONG Flags;
union {
struct _IRP *MasterIrp;
.
.
PVOID SystemBuffer;
} AssociatedIrp;
.
.
IO_STATUS_BLOCK IoStatus;
KPROCESSOR_MODE RequestorMode;
BOOLEAN PendingReturned;
.
.
BOOLEAN Cancel;
KIRQL CancelIrql;
.
.
PDRIVER_CANCEL CancelRoutine;
PVOID UserBuffer;
union {
struct {
.
.
union {
KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
struct {
PVOID DriverContext[4];
};
};
.
.
PETHREAD Thread;
.
.
LIST_ENTRY ListEntry;
.
.
} Overlay;
.
.
} Tail;
} IRP, *PIRP; IRP结构详见《IRP》
FiDO: Filter Device Object(Upper)
FDO: Functional Device Object
FiDO: Filter Device Object(Lower)
PDO: Physical Device Object
参考文献:
1. Programming the Microsoft Windows Driver Model(2nd)
1Chapter 2 - Basic Structure of a WDM Driver >> How the System Finds and Loads Drivers
标签:
原文地址:http://blog.csdn.net/xiaobin_hlj80/article/details/45749683