Posted on 2008-08-28 12:03
没画完的画 阅读(1988)
评论(0) 编辑 收藏 引用 所属分类:
Windows Driver
IRP_MJ_CREATE
[本文摘自MSDN,翻译不好敬请指正,谢谢]
Every kernel-mode driver must handle IRP_MJ_CREATE requests in a DispatchCreate or DispatchCreateClose routine.
每个内核驱动必须在 DispatchCreate 或 DispatchCreateClose 处理 IRP_MJ_CREATE 请求
When Sent
什么时候系统会发送 IRP_MJ_CREATE
The operating system sends an IRP_MJ_CREATE request to open a handle to a file object or device object. For example, when a driver calls ZwCreateFile, the operating system sends an IRP_MJ_CREATE request to perform the actual open operation.
操作系统发送一个 IRP_MJ_CREATE 请求打开文件对象或设备对象. 比如, 设备调用 ZwCreateFile, 操作系统发送一个 IRP_MJ_CREATE 请求进行实际的打开操作
Input Parameters
The Parameters.Create.SecurityContext member points to an IO_SECURITY_CONTEXT structure that describes the security context for the request.
输入参数
Parameters.Create.SecurityContext 成员指针指向 描述请求安全上下文的 IO_SECURITY_CONTEXT 结构
The Parameters.Create.Options member is a ULONG value that describes the options that are used when opening the handle. The high 8 bits correspond to the value of the CreateDisposition parameter of ZwCreateFile, and the low 24 bits correspond to the value of the CreateOptions parameter of ZwCreateFile.
Parameters.Create.Options 成员是一个 ULONG 值 用来描述 打开的句柄时使用的选项.
高8位相当于 ZwCreateFile 的 CreateDisposition 参数, 低 24位相关于 ZwCreateFile 的 CreateOptions 参数
The Parameters.Create.ShareAccess member is a USHORT value that describes the type of share access. This value corresponds to the value of the ShareAccess parameter of ZwCreateFile.
Parameters.Create.ShareAccess 成员是一个 USHORT 值用来描述共享访问的类型, 相当于 ZwCreateFile 的 ShareAccess 参数
The Parameters.Create.FileAttributes and Parameters.Create.EaLength members are reserved for use by file systems and file system filter drivers. For more information, see the IRP_MJ_CREATE topic in the Installable File System (IFS) documentation.
Parameters.Create.FileAttributes 和 Parameters.Create.EaLength 成员为文件系统 和文件系统的过滤驱动所保留,详细请参见 IFS 中IRP_MJ_CREATE 相关部份
Output Parameters
None
输出参数: 无
Operation
Most device and intermediate drivers set STATUS_SUCESS in the I/O status block of the IRP and complete the create request, but drivers can optionally use their DispatchCreate routine to reserve resources for any subsequent I/O requests for that handle. For example, the system serial driver maps its paged-out code and allocates any resources that are necessary to handle subsequent I/O requests for the user-mode thread that is attempting to open the device for input and output.
大部份设备和中间层驱动在 IRP 的IO状态阻塞和完成IRP请求时会设置为 STATUS_SUCESS, 但驱动可以用 DispatchCreate 函数保留 随后I/O请求的句柄 的资源. 例如, 系统串口驱动映射它的页面溢出的代码和分配一些资源, 那有必要处理 用户模式线程绑定一个设备用来输入输出的随后IO请求