本文整理汇总了C++中IsFlagOn函数的典型用法代码示例。如果您正苦于以下问题:C++ IsFlagOn函数的具体用法?C++ IsFlagOn怎么用?C++ IsFlagOn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsFlagOn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}