reactos操作系统实现(125)
2009-11-04 22:15
477 查看
VfatCreate函数创建或者打开一个文件。具体实现代码如下:
#001 NTSTATUS
#002 VfatCreate
(PVFAT_IRP_CONTEXT IrpContext)
#003 /*
#004 * FUNCTION: Create or open
a file
#005 */
#006 {
#007 NTSTATUS Status;
#008
#009 ASSERT(IrpContext);
#010
检查当前上下文里的设备是否与全局里保存的设备一致。
#011 if (IrpContext->DeviceObject ==
VfatGlobalData->DeviceObject)
#012 {
如果文件系统已经打开,就直接返回。
#013 /* DeviceObject represents FileSystem instead of logical
volume */
#014 DPRINT ("FsdCreate called with file system/n");
#015 IrpContext->Irp->IoStatus.Information = FILE_OPENED;
#016 IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
#017 IoCompleteRequest (IrpContext->Irp, IO_DISK_INCREMENT);
#018 VfatFreeIrpContext(IrpContext);
#019 return(STATUS_SUCCESS);
#020 }
#021
如果标记为不能等,就直接放到队列里执行。
#022 if (!(IrpContext->Flags & IRPCONTEXT_CANWAIT))
#023 {
#024 return(VfatQueueRequest (IrpContext));
#025 }
#026
#027 IrpContext->Irp->IoStatus.Information = 0;
#028 ExAcquireResourceExclusiveLite
(&IrpContext->DeviceExt->DirResource, TRUE);
创建或者打开一个文件。
#029 Status = VfatCreateFile (IrpContext->DeviceObject,
IrpContext->Irp);
#030 ExReleaseResourceLite
(&IrpContext->DeviceExt->DirResource);
#031
已经完成IPR,设置标记为完成状态。
#032 IrpContext->Irp->IoStatus.Status = Status;
#033 IoCompleteRequest (IrpContext->Irp,
#034 (CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT :
IO_NO_INCREMENT));
#035 VfatFreeIrpContext(IrpContext);
#036 return(Status);
#037 }
#001 NTSTATUS
#002 VfatCreate
(PVFAT_IRP_CONTEXT IrpContext)
#003 /*
#004 * FUNCTION: Create or open
a file
#005 */
#006 {
#007 NTSTATUS Status;
#008
#009 ASSERT(IrpContext);
#010
检查当前上下文里的设备是否与全局里保存的设备一致。
#011 if (IrpContext->DeviceObject ==
VfatGlobalData->DeviceObject)
#012 {
如果文件系统已经打开,就直接返回。
#013 /* DeviceObject represents FileSystem instead of logical
volume */
#014 DPRINT ("FsdCreate called with file system/n");
#015 IrpContext->Irp->IoStatus.Information = FILE_OPENED;
#016 IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
#017 IoCompleteRequest (IrpContext->Irp, IO_DISK_INCREMENT);
#018 VfatFreeIrpContext(IrpContext);
#019 return(STATUS_SUCCESS);
#020 }
#021
如果标记为不能等,就直接放到队列里执行。
#022 if (!(IrpContext->Flags & IRPCONTEXT_CANWAIT))
#023 {
#024 return(VfatQueueRequest (IrpContext));
#025 }
#026
#027 IrpContext->Irp->IoStatus.Information = 0;
#028 ExAcquireResourceExclusiveLite
(&IrpContext->DeviceExt->DirResource, TRUE);
创建或者打开一个文件。
#029 Status = VfatCreateFile (IrpContext->DeviceObject,
IrpContext->Irp);
#030 ExReleaseResourceLite
(&IrpContext->DeviceExt->DirResource);
#031
已经完成IPR,设置标记为完成状态。
#032 IrpContext->Irp->IoStatus.Status = Status;
#033 IoCompleteRequest (IrpContext->Irp,
#034 (CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT :
IO_NO_INCREMENT));
#035 VfatFreeIrpContext(IrpContext);
#036 return(Status);
#037 }
相关文章推荐
- reactos操作系统实现(125)
- reactos操作系统实现(133)
- reactos操作系统实现(135)
- reactos操作系统实现(137)
- reactos操作系统实现(140)
- reactos操作系统实现(141)
- reactos操作系统实现(143)
- reactos操作系统实现(145)
- reactos操作系统实现(146)
- reactos操作系统实现(150)
- reactos操作系统实现(8)
- reactos操作系统实现(124)
- reactos操作系统实现(100)
- reactos操作系统实现(101)
- reactos操作系统实现(107)
- reactos操作系统实现(108)
- reactos操作系统实现(113)
- reactos操作系统实现(116)
- reactos操作系统实现(119)
- reactos操作系统实现(94)