本文整理汇总了C++中IsFlagOn函数的典型用法代码示例。如果您正苦于以下问题:C++ IsFlagOn函数的具体用法?C++ IsFlagOn怎么用?C++ IsFlagOn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsFlagOn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Ext2FlushFiles
NTSTATUS
Ext2FlushFiles(
IN PEXT2_IRP_CONTEXT IrpContext,
IN PEXT2_VCB Vcb,
IN BOOLEAN bShutDown
)
{
IO_STATUS_BLOCK IoStatus;
PEXT2_FCB Fcb;
PLIST_ENTRY ListEntry;
if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY) ||
IsFlagOn(Vcb->Flags, VCB_WRITE_PROTECTED)) {
return STATUS_SUCCESS;
}
IoStatus.Status = STATUS_SUCCESS;
DEBUG(DL_INF, ( "Flushing Files ...\n"));
// Flush all Fcbs in Vcb list queue.
for (ListEntry = Vcb->FcbList.Flink;
ListEntry != &Vcb->FcbList;
ListEntry = ListEntry->Flink ) {
Fcb = CONTAINING_RECORD(ListEntry, EXT2_FCB, Next);
ExAcquireResourceExclusiveLite(
&Fcb->MainResource, TRUE);
IoStatus.Status = Ext2FlushFile(IrpContext, Fcb, NULL);
ExReleaseResourceLite(&Fcb->MainResource);
}
return IoStatus.Status;
}
开发者ID:Uroc327,项目名称:ext2fsd,代码行数:35,代码来源:flush.c
示例2: Ext2QueueCloseRequest
VOID
Ext2QueueCloseRequest (IN PEXT2_IRP_CONTEXT IrpContext)
{
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
(IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
if (IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_DELAY_CLOSE)) {
if (IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_FILE_BUSY)) {
Ext2Sleep(500); /* 0.5 sec*/
} else {
Ext2Sleep(50); /* 0.05 sec*/
}
} else {
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_DELAY_CLOSE);
IrpContext->Fcb = (PEXT2_FCB) IrpContext->FileObject->FsContext;
IrpContext->Ccb = (PEXT2_CCB) IrpContext->FileObject->FsContext2;
}
ExInitializeWorkItem(
&IrpContext->WorkQueueItem,
Ext2DeQueueCloseRequest,
IrpContext);
ExQueueWorkItem(&IrpContext->WorkQueueItem, DelayedWorkQueue);
}
开发者ID:herocodemaster,项目名称:ext2fsd,代码行数:31,代码来源:close.c
示例3: Ext2ReadWriteBlockAsyncCompletionRoutine
NTSTATUS
Ext2ReadWriteBlockAsyncCompletionRoutine (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
)
{
PEXT2_RW_CONTEXT pContext = (PEXT2_RW_CONTEXT)Context;
PIO_STACK_LOCATION iosp;
ASSERT(FALSE == pContext->Wait);
if (Irp != pContext->MasterIrp && !NT_SUCCESS(Irp->IoStatus.Status)) {
pContext->MasterIrp->IoStatus = Irp->IoStatus;
}
if (InterlockedDecrement(&pContext->Blocks) == 0) {
if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status)) {
/* set written bytes to status information */
pContext->MasterIrp->IoStatus.Information = pContext->Length;
if (pContext->FileObject != NULL && !IsFlagOn(pContext->MasterIrp->Flags, IRP_PAGING_IO)) {
/* modify FileObject flags, skip this for volume direct access */
SetFlag( pContext->FileObject->Flags,
IsFlagOn(pContext->Flags, EXT2_RW_CONTEXT_WRITE) ?
FO_FILE_MODIFIED : FO_FILE_FAST_IO_READ);
/* update Current Byteoffset */
if (IsFlagOn(pContext->FileObject->Flags, FO_SYNCHRONOUS_IO)) {
iosp = IoGetCurrentIrpStackLocation(pContext->MasterIrp);
pContext->FileObject->CurrentByteOffset.QuadPart =
iosp->Parameters.Read.ByteOffset.QuadPart + pContext->Length;
}
}
} else {
pContext->MasterIrp->IoStatus.Information = 0;
}
/* release the locked resource acquired by the caller */
if (pContext->Resource) {
ExReleaseResourceForThread(pContext->Resource, pContext->ThreadId);
}
Ext2FreePool(pContext, EXT2_RWC_MAGIC);
DEC_MEM_COUNT(PS_RW_CONTEXT, pContext, sizeof(EXT2_RW_CONTEXT));
}
return STATUS_SUCCESS;
}
开发者ID:dond2008,项目名称:ext2fsd,代码行数:54,代码来源:block.c
示例4: FFSPurgeFile
__drv_mustHoldCriticalRegion
NTSTATUS
FFSPurgeFile(
IN PFFS_FCB Fcb,
IN BOOLEAN FlushBeforePurge)
{
IO_STATUS_BLOCK IoStatus;
PAGED_CODE();
ASSERT(Fcb != NULL);
ASSERT((Fcb->Identifier.Type == FFSFCB) &&
(Fcb->Identifier.Size == sizeof(FFS_FCB)));
if(!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY) && FlushBeforePurge &&
!IsFlagOn(Fcb->Vcb->Flags, VCB_WRITE_PROTECTED))
{
FFSPrint((DBG_INFO, "FFSPurgeFile: CcFlushCache on %s.\n",
Fcb->AnsiFileName.Buffer));
ExAcquireSharedStarveExclusive(&Fcb->PagingIoResource, TRUE);
ExReleaseResourceLite(&Fcb->PagingIoResource);
CcFlushCache(&Fcb->SectionObject, NULL, 0, &IoStatus);
ClearFlag(Fcb->Flags, FCB_FILE_MODIFIED);
}
if (Fcb->SectionObject.ImageSectionObject)
{
FFSPrint((DBG_INFO, "FFSPurgeFile: MmFlushImageSection on %s.\n",
Fcb->AnsiFileName.Buffer));
MmFlushImageSection(&Fcb->SectionObject, MmFlushForWrite);
}
if (Fcb->SectionObject.DataSectionObject)
{
FFSPrint((DBG_INFO, "FFSPurgeFile: CcPurgeCacheSection on %s.\n",
Fcb->AnsiFileName.Buffer));
CcPurgeCacheSection(&Fcb->SectionObject, NULL, 0, FALSE);
}
return STATUS_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:51,代码来源:fsctl.c
示例5: FFSZeroHoles
BOOLEAN
FFSZeroHoles(
IN PFFS_IRP_CONTEXT IrpContext,
IN PFFS_VCB Vcb,
IN PFILE_OBJECT FileObject,
IN LONGLONG Offset,
IN LONGLONG Count)
{
LARGE_INTEGER StartAddr = {0, 0};
LARGE_INTEGER EndAddr = {0, 0};
StartAddr.QuadPart = (Offset + (SECTOR_SIZE - 1)) &
~((LONGLONG)SECTOR_SIZE - 1);
EndAddr.QuadPart = (Offset + Count + (SECTOR_SIZE - 1)) &
~((LONGLONG)SECTOR_SIZE - 1);
if (StartAddr.QuadPart < EndAddr.QuadPart)
{
return CcZeroData(FileObject,
&StartAddr,
&EndAddr,
IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT));
}
return TRUE;
}
开发者ID:layerfsd,项目名称:ffsfsd,代码行数:27,代码来源:write.c
示例6: FFSQueueCloseRequest
VOID
FFSQueueCloseRequest(
IN PFFS_IRP_CONTEXT IrpContext)
{
PAGED_CODE();
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == FFSICX) &&
(IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
if (!IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_DELAY_CLOSE))
{
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_DELAY_CLOSE);
IrpContext->Fcb = (PFFS_FCB)IrpContext->FileObject->FsContext;
IrpContext->Ccb = (PFFS_CCB)IrpContext->FileObject->FsContext2;
IrpContext->FileObject = NULL;
}
// IsSynchronous means we can block (so we don't requeue it)
IrpContext->IsSynchronous = TRUE;
ExInitializeWorkItem(
&IrpContext->WorkQueueItem,
FFSDeQueueCloseRequest,
IrpContext);
ExQueueWorkItem(&IrpContext->WorkQueueItem, CriticalWorkQueue);
}
开发者ID:GYGit,项目名称:reactos,代码行数:31,代码来源:close.c
示例7: Ext2CompleteIrpContext
NTSTATUS
Ext2CompleteIrpContext (
IN PEXT2_IRP_CONTEXT IrpContext,
IN NTSTATUS Status )
{
PIRP Irp = NULL;
BOOLEAN bPrint;
Irp = IrpContext->Irp;
if (Irp != NULL) {
if (NT_ERROR(Status)) {
Irp->IoStatus.Information = 0;
}
Irp->IoStatus.Status = Status;
bPrint = !IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_REQUEUED);
Ext2CompleteRequest(
Irp, bPrint, (CCHAR)(NT_SUCCESS(Status)?
IO_DISK_INCREMENT : IO_NO_INCREMENT) );
IrpContext->Irp = NULL;
}
Ext2FreeIrpContext(IrpContext);
return Status;
}
开发者ID:jrfl,项目名称:ext2fsd,代码行数:30,代码来源:read.c
示例8: Ext2FastIoWrite
BOOLEAN
Ext2FastIoWrite (
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
IN BOOLEAN Wait,
IN ULONG LockKey,
OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject)
{
PEXT2_FCB Fcb = NULL;
BOOLEAN Status = FALSE;
BOOLEAN Locked = FALSE;
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL)
return FALSE;
__try {
FsRtlEnterFileSystem();
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
(Fcb->Identifier.Size == sizeof(EXT2_FCB)));
if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
__leave;
}
ExAcquireResourceSharedLite(&Fcb->MainResource, TRUE);
Locked = TRUE;
if (IsEndOfFile(*FileOffset) || ((LONGLONG)(Fcb->Inode->i_size) <
(FileOffset->QuadPart + Length)) ) {
} else {
ExReleaseResourceLite(&Fcb->MainResource);
Locked = FALSE;
Status = FsRtlCopyWrite(FileObject, FileOffset, Length, Wait,
LockKey, Buffer, IoStatus, DeviceObject);
}
} __finally {
if (Locked) {
ExReleaseResourceLite(&Fcb->MainResource);
}
FsRtlExitFileSystem();
}
DEBUG(DL_IO, ("Ext2FastIoWrite: %wZ Offset: %I64xh Length: %xh Key: %xh Status=%d\n",
&Fcb->Mcb->ShortName, FileOffset->QuadPart, Length, LockKey, Status));
return Status;
}
开发者ID:Uroc327,项目名称:ext2fsd,代码行数:56,代码来源:fastio.c
示例9: FFSRefreshMcb
VOID
FFSRefreshMcb(
PFFS_VCB Vcb,
PFFS_MCB Mcb)
{
ASSERT (IsFlagOn(Mcb->Flags, MCB_IN_TREE));
RemoveEntryList(&(Mcb->Link));
InsertTailList(&(Vcb->McbList), &(Mcb->Link));
}
开发者ID:layerfsd,项目名称:ffsfsd,代码行数:10,代码来源:memory.c
示例10: FFSGetPartition
NTSTATUS
FFSGetPartition(
IN PDEVICE_OBJECT DeviceObject,
OUT ULONGLONG *StartOffset)
{
CHAR Buffer[2048];
PIRP Irp;
IO_STATUS_BLOCK IoStatus;
KEVENT Event;
NTSTATUS Status;
PARTITION_INFORMATION *PartInfo;
PAGED_CODE();
if (IsFlagOn(DeviceObject->Characteristics, FILE_FLOPPY_DISKETTE))
{
*StartOffset = 0;
return STATUS_SUCCESS;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(
IOCTL_DISK_GET_PARTITION_INFO,
DeviceObject,
NULL,
0,
Buffer,
2048,
FALSE,
&Event,
&IoStatus);
if (!Irp)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = IoCallDriver(DeviceObject, Irp);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
if (!NT_SUCCESS(Status))
{
return Status;
}
PartInfo = (PARTITION_INFORMATION *)Buffer;
*StartOffset = PartInfo->StartingOffset.QuadPart;
return Status;
}
开发者ID:GYGit,项目名称:reactos,代码行数:55,代码来源:fsctl.c
示例11: Ext2DestroyMdl
VOID
Ext2DestroyMdl (IN PMDL Mdl)
{
ASSERT (Mdl != NULL);
while (Mdl) {
PMDL Next;
Next = Mdl->Next;
if (IsFlagOn(Mdl->MdlFlags, MDL_PAGES_LOCKED)) {
MmUnlockPages (Mdl);
}
IoFreeMdl (Mdl);
Mdl = Next;
}
}
开发者ID:dond2008,项目名称:ext2fsd,代码行数:14,代码来源:block.c
示例12: FFSDeleteMcbNode
BOOLEAN
FFSDeleteMcbNode(
PFFS_VCB Vcb,
PFFS_MCB McbTree,
PFFS_MCB FFSMcb)
{
PFFS_MCB TmpMcb;
PAGED_CODE();
if(!IsFlagOn(FFSMcb->Flags, MCB_IN_TREE))
{
return TRUE;
}
if (FFSMcb->Parent)
{
if (FFSMcb->Parent->Child == FFSMcb)
{
FFSMcb->Parent->Child = FFSMcb->Next;
}
else
{
TmpMcb = FFSMcb->Parent->Child;
while (TmpMcb && TmpMcb->Next != FFSMcb)
TmpMcb = TmpMcb->Next;
if (TmpMcb)
{
TmpMcb->Next = FFSMcb->Next;
}
else
{
// error
return FALSE;
}
}
}
else if (FFSMcb->Child)
{
return FALSE;
}
RemoveEntryList(&(FFSMcb->Link));
ClearFlag(FFSMcb->Flags, MCB_IN_TREE);
return TRUE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:49,代码来源:memory.c
示例13: Ext2FlushFile
NTSTATUS
Ext2FlushFile (
IN PEXT2_IRP_CONTEXT IrpContext,
IN PEXT2_FCB Fcb,
IN PEXT2_CCB Ccb
)
{
IO_STATUS_BLOCK IoStatus;
ASSERT(Fcb != NULL);
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
(Fcb->Identifier.Size == sizeof(EXT2_FCB)));
_SEH2_TRY {
/* update timestamp and achieve attribute */
if (Ccb != NULL) {
if (!IsFlagOn(Ccb->Flags, CCB_LAST_WRITE_UPDATED)) {
LARGE_INTEGER SysTime;
KeQuerySystemTime(&SysTime);
Fcb->Inode->i_mtime = Ext2LinuxTime(SysTime);
Fcb->Mcb->LastWriteTime = Ext2NtTime(Fcb->Inode->i_mtime);
Ext2SaveInode(IrpContext, Fcb->Vcb, Fcb->Inode);
}
}
if (IsDirectory(Fcb)) {
IoStatus.Status = STATUS_SUCCESS;
_SEH2_LEAVE;
}
DEBUG(DL_INF, ( "Ext2FlushFile: Flushing File Inode=%xh %S ...\n",
Fcb->Inode->i_ino, Fcb->Mcb->ShortName.Buffer));
CcFlushCache(&(Fcb->SectionObject), NULL, 0, &IoStatus);
ClearFlag(Fcb->Flags, FCB_FILE_MODIFIED);
} _SEH2_FINALLY {
/* do cleanup here */
} _SEH2_END;
return IoStatus.Status;
}
开发者ID:GYGit,项目名称:reactos,代码行数:47,代码来源:flush.c
示例14: Ext2StartFloppyFlushDpc
VOID
Ext2StartFloppyFlushDpc (
PEXT2_VCB Vcb,
PEXT2_FCB Fcb,
PFILE_OBJECT FileObject )
{
LARGE_INTEGER OneSecond;
PEXT2_FLPFLUSH_CONTEXT Context;
ASSERT(IsFlagOn(Vcb->Flags, VCB_FLOPPY_DISK));
Context = Ext2AllocatePool(
NonPagedPool,
sizeof(EXT2_FLPFLUSH_CONTEXT),
EXT2_FLPFLUSH_MAGIC
);
if (!Context) {
DEBUG(DL_ERR, ( "Ex2StartFloppy...: failed to allocate Context\n"));
DbgBreak();
return;
}
KeInitializeTimer(&Context->Timer);
KeInitializeDpc( &Context->Dpc,
Ext2FloppyFlushDpc,
Context );
ExInitializeWorkItem( &Context->Item,
Ext2FloppyFlush,
Context );
Context->Vcb = Vcb;
Context->Fcb = Fcb;
Context->FileObject = FileObject;
if (FileObject) {
ObReferenceObject(FileObject);
}
OneSecond.QuadPart = (LONGLONG)-1*1000*1000*10;
KeSetTimer( &Context->Timer,
OneSecond,
&Context->Dpc );
}
开发者ID:Axure,项目名称:Ext3Fsd,代码行数:46,代码来源:write.c
示例15: Ext2IsFastIoPossible
FAST_IO_POSSIBLE
Ext2IsFastIoPossible(
IN PEXT2_FCB Fcb
)
{
FAST_IO_POSSIBLE IsPossible = FastIoIsNotPossible;
if (!Fcb || !FsRtlOplockIsFastIoPossible(&Fcb->Oplock))
return IsPossible;
IsPossible = FastIoIsQuestionable;
if (!FsRtlAreThereCurrentFileLocks(&Fcb->FileLockAnchor)) {
if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
IsPossible = FastIoIsPossible;
}
}
return IsPossible;
}
开发者ID:Uroc327,项目名称:ext2fsd,代码行数:20,代码来源:fastio.c
示例16: FFSAddMcbNode
VOID
FFSAddMcbNode(
PFFS_VCB Vcb,
PFFS_MCB Parent,
PFFS_MCB Child)
{
PFFS_MCB TmpMcb = Parent->Child;
PAGED_CODE();
if(IsFlagOn(Child->Flags, MCB_IN_TREE))
{
FFSBreakPoint();
FFSPrint((DBG_ERROR, "FFSAddMcbNode: Child Mcb is alreay in the tree.\n"));
return;
}
if (TmpMcb)
{
ASSERT(TmpMcb->Parent == Parent);
while (TmpMcb->Next)
{
TmpMcb = TmpMcb->Next;
ASSERT(TmpMcb->Parent == Parent);
}
TmpMcb->Next = Child;
Child->Parent = Parent;
Child->Next = NULL;
}
else
{
Parent->Child = Child;
Child->Parent = Parent;
Child->Next = NULL;
}
InsertTailList(&(Vcb->McbList), &(Child->Link));
SetFlag(Child->Flags, MCB_IN_TREE);
}
开发者ID:GYGit,项目名称:reactos,代码行数:41,代码来源:memory.c
示例17: FFSStartFloppyFlushDpc
VOID
FFSStartFloppyFlushDpc(
PFFS_VCB Vcb,
PFFS_FCB Fcb,
PFILE_OBJECT FileObject)
{
LARGE_INTEGER OneSecond;
PFFS_FLPFLUSH_CONTEXT Context;
ASSERT(IsFlagOn(Vcb->Flags, VCB_FLOPPY_DISK));
Context = ExAllocatePool(NonPagedPool, sizeof(PFFS_FLPFLUSH_CONTEXT));
if (!Context)
{
FFSBreakPoint();
return;
}
KeInitializeTimer(&Context->Timer);
KeInitializeDpc(&Context->Dpc,
FFSFloppyFlushDpc,
Context);
Context->Vcb = Vcb;
Context->Fcb = Fcb;
Context->FileObject = FileObject;
if (FileObject)
{
ObReferenceObject(FileObject);
}
OneSecond.QuadPart = (LONGLONG) - 1 * 1000 * 1000 * 10;
KeSetTimer(&Context->Timer,
OneSecond,
&Context->Dpc);
}
开发者ID:layerfsd,项目名称:ffsfsd,代码行数:39,代码来源:write.c
示例18: Ext2CheckJournal
INT
Ext2CheckJournal(
PEXT2_VCB Vcb,
PULONG jNo
)
{
struct ext3_super_block* esb = NULL;
/* check ext3 super block */
esb = (struct ext3_super_block *)Vcb->SuperBlock;
if (IsFlagOn(esb->s_feature_incompat,
EXT3_FEATURE_INCOMPAT_RECOVER)) {
SetLongFlag(Vcb->Flags, VCB_JOURNAL_RECOVER);
}
/* must stop here if volume is read-only */
if (IsVcbReadOnly(Vcb)) {
goto errorout;
}
/* journal is external ? */
if (esb->s_journal_inum == 0) {
goto errorout;
}
/* oops: volume is corrupted */
if (esb->s_journal_dev) {
goto errorout;
}
/* return the journal inode number */
*jNo = esb->s_journal_inum;
return TRUE;
errorout:
return FALSE;
}
开发者ID:Strongc,项目名称:reactos,代码行数:39,代码来源:recover.c
示例19: FFSWriteVolume
NTSTATUS
FFSWriteVolume(
IN PFFS_IRP_CONTEXT IrpContext)
{
NTSTATUS Status = STATUS_UNSUCCESSFUL;
PFFS_VCB Vcb = NULL;
PFFS_CCB Ccb = NULL;
PFFS_FCBVCB FcbOrVcb = NULL;
PFILE_OBJECT FileObject = NULL;
PDEVICE_OBJECT DeviceObject = NULL;
PIRP Irp = NULL;
PIO_STACK_LOCATION IoStackLocation = NULL;
ULONG Length;
LARGE_INTEGER ByteOffset;
BOOLEAN PagingIo;
BOOLEAN Nocache;
BOOLEAN SynchronousIo;
BOOLEAN MainResourceAcquired = FALSE;
BOOLEAN PagingIoResourceAcquired = FALSE;
BOOLEAN bDeferred = FALSE;
PUCHAR Buffer = NULL;
__try
{
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == FFSICX) &&
(IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
DeviceObject = IrpContext->DeviceObject;
Vcb = (PFFS_VCB)DeviceObject->DeviceExtension;
ASSERT(Vcb != NULL);
ASSERT((Vcb->Identifier.Type == FFSVCB) &&
(Vcb->Identifier.Size == sizeof(FFS_VCB)));
FileObject = IrpContext->FileObject;
FcbOrVcb = (PFFS_FCBVCB)FileObject->FsContext;
ASSERT(FcbOrVcb);
if (!(FcbOrVcb->Identifier.Type == FFSVCB && (PVOID)FcbOrVcb == (PVOID)Vcb))
{
Status = STATUS_INVALID_DEVICE_REQUEST;
__leave;
}
Ccb = (PFFS_CCB)FileObject->FsContext2;
Irp = IrpContext->Irp;
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
Length = IoStackLocation->Parameters.Write.Length;
ByteOffset = IoStackLocation->Parameters.Write.ByteOffset;
PagingIo = (Irp->Flags & IRP_PAGING_IO ? TRUE : FALSE);
Nocache = (Irp->Flags & IRP_NOCACHE ? TRUE : FALSE);
SynchronousIo = (FileObject->Flags & FO_SYNCHRONOUS_IO ? TRUE : FALSE);
FFSPrint((DBG_INFO, "FFSWriteVolume: Off=%I64xh Len=%xh Paging=%xh Nocache=%xh\n",
ByteOffset.QuadPart, Length, PagingIo, Nocache));
if (Length == 0)
{
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
__leave;
}
// For the case of "Direct Access Storage Device", we
// need flush/purge the cache
if (Ccb != NULL)
{
ExAcquireResourceExclusive(&Vcb->MainResource, TRUE);
MainResourceAcquired = TRUE;
Status = FFSPurgeVolume(Vcb, TRUE);
ExReleaseResource(&Vcb->MainResource);
MainResourceAcquired = FALSE;
if(!IsFlagOn(Ccb->Flags, CCB_ALLOW_EXTENDED_DASD_IO))
{
if (ByteOffset.QuadPart + Length > Vcb->Header.FileSize.QuadPart)
{
Length = (ULONG)(Vcb->Header.FileSize.QuadPart - ByteOffset.QuadPart);
}
}
//.........这里部分代码省略.........
开发者ID:layerfsd,项目名称:ffsfsd,代码行数:101,代码来源:write.c
示例20: FFSWrite
NTSTATUS
FFSWrite(
IN PFFS_IRP_CONTEXT IrpContext)
{
NTSTATUS Status;
PFFS_FCBVCB FcbOrVcb;
PDEVICE_OBJECT DeviceObject;
PFILE_OBJECT FileObject;
PFFS_VCB Vcb;
BOOLEAN bCompleteRequest = TRUE;
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == FFSICX) &&
(IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
__try
{
if (FlagOn(IrpContext->MinorFunction, IRP_MN_COMPLETE))
{
Status = FFSWriteComplete(IrpContext);
bCompleteRequest = FALSE;
}
else
{
DeviceObject = IrpContext->DeviceObject;
if (DeviceObject == FFSGlobal->DeviceObject)
{
Status = STATUS_INVALID_DEVICE_REQUEST;
__leave;
}
Vcb = (PFFS_VCB)DeviceObject->DeviceExtension;
if (Vcb->Identifier.Type != FFSVCB ||
Vcb->Identifier.Size != sizeof(FFS_VCB))
{
Status = STATUS_INVALID_PARAMETER;
__leave;
}
ASSERT(IsMounted(Vcb));
if (IsFlagOn(Vcb->Flags, VCB_DISMOUNT_PENDING))
{
Status = STATUS_TOO_LATE;
__leave;
}
if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY))
{
Status = STATUS_MEDIA_WRITE_PROTECTED;
__leave;
}
FileObject = IrpContext->FileObject;
FcbOrVcb = (PFFS_FCBVCB)FileObject->FsContext;
if (FcbOrVcb->Identifier.Type == FFSVCB)
{
Status = FFSWriteVolume(IrpContext);
if (!NT_SUCCESS(Status))
{
FFSBreakPoint();
}
bCompleteRequest = FALSE;
}
else if (FcbOrVcb->Identifier.Type == FFSFCB)
{
Status = FFSWriteFile(IrpContext);
if (!NT_SUCCESS(Status))
{
FFSBreakPoint();
}
bCompleteRequest = FALSE;
}
else
{
Status = STATUS_INVALID_PARAMETER;
}
}
}
__finally
{
if (bCompleteRequest)
{
FFSCompleteIrpContext(IrpContext, Status);
}
}
return Status;
}
开发者ID:layerfsd,项目名称:ffsfsd,代码行数:99,代码来源:write.c
注:本文中的IsFlagOn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论