这篇教程C++ FatCompleteRequest函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FatCompleteRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ FatCompleteRequest函数的具体用法?C++ FatCompleteRequest怎么用?C++ FatCompleteRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FatCompleteRequest函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FatiReadNTSTATUSNTAPIFatiRead(PFAT_IRP_CONTEXT IrpContext){ ULONG NumberOfBytes; LARGE_INTEGER ByteOffset; PFILE_OBJECT FileObject; TYPE_OF_OPEN OpenType; PIO_STACK_LOCATION IrpSp = IrpContext->Stack; PFCB Fcb; PVCB Vcb; PCCB Ccb; PVOID Buffer; LONG BytesRead; FileObject = IrpSp->FileObject; NumberOfBytes = IrpSp->Parameters.Read.Length; ByteOffset = IrpSp->Parameters.Read.ByteOffset; if (NumberOfBytes == 0) { FatCompleteRequest(IrpContext, IrpContext->Irp, STATUS_SUCCESS); return STATUS_SUCCESS; } OpenType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb); DPRINT("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p/n", Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes, Fcb->FatHandle); /* Perform actual read */ if (IrpContext->MinorFunction & IRP_MN_MDL) { DPRINT1("MDL read/n"); } else { Buffer = FatMapUserBuffer(IrpContext->Irp); DPRINT("Normal cached read, buffer %p/n"); /* Set offset */ FF_Seek(Fcb->FatHandle, ByteOffset.LowPart, FF_SEEK_SET); /* Read */ BytesRead = FF_Read(Fcb->FatHandle, NumberOfBytes, 1, Buffer); DPRINT("Read %d bytes/n", BytesRead); /* Indicate we read requested amount of bytes */ IrpContext->Irp->IoStatus.Information = BytesRead; IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS; } /* Complete the request */ FatCompleteRequest(IrpContext, IrpContext->Irp, STATUS_SUCCESS); return STATUS_SUCCESS;}
开发者ID:hoangduit,项目名称:reactos,代码行数:56,
示例2: FatVerifyVolumeNTSTATUSNTAPIFatVerifyVolume(PFAT_IRP_CONTEXT IrpContext, PIRP Irp){ DPRINT1("FatVerifyVolume()/n"); FatCompleteRequest(IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST); return STATUS_INVALID_DEVICE_REQUEST;}
开发者ID:hoangduit,项目名称:reactos,代码行数:8,
示例3: FatOplockCompleteVOIDFatOplockComplete ( IN PVOID Context, IN PIRP Irp )/*++Routine Description: This routine is called by the oplock package when an oplock break has completed, allowing an Irp to resume execution. If the status in the Irp is STATUS_SUCCESS, then we queue the Irp to the Fsp queue. Otherwise we complete the Irp with the status in the Irp.Arguments: Context - Pointer to the IrpContext to be queued to the Fsp Irp - I/O Request Packet.Return Value: None.--*/{ PAGED_CODE(); // // Check on the return value in the Irp. // if (Irp->IoStatus.Status == STATUS_SUCCESS) { // // Insert the Irp context in the workqueue. // FatAddToWorkque( (PIRP_CONTEXT) Context, Irp ); // // Otherwise complete the request. // } else { FatCompleteRequest( (PIRP_CONTEXT) Context, Irp, Irp->IoStatus.Status ); } return;}
开发者ID:340211173,项目名称:Driver,代码行数:53,
示例4: FatiFileSystemControlNTSTATUSNTAPIFatiFileSystemControl(PFAT_IRP_CONTEXT IrpContext, PIRP Irp){ PIO_STACK_LOCATION IrpSp; NTSTATUS Status; /* Get current IRP stack location */ IrpSp = IoGetCurrentIrpStackLocation(Irp); /* Dispatch depending on the minor function */ switch (IrpSp->MinorFunction) { case IRP_MN_KERNEL_CALL: case IRP_MN_USER_FS_REQUEST: Status = FatUserFsCtrl(IrpContext, Irp); break; case IRP_MN_MOUNT_VOLUME: Status = FatMountVolume(IrpContext, IrpSp->Parameters.MountVolume.DeviceObject, IrpSp->Parameters.MountVolume.Vpb, IrpSp->DeviceObject); FatCompleteRequest(IrpContext, Irp, Status); break; case IRP_MN_VERIFY_VOLUME: Status = FatVerifyVolume(IrpContext, Irp); break; default: DPRINT1("Unhandled FSCTL minor 0x%x/n", IrpSp->MinorFunction); FatCompleteRequest(IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST); Status = STATUS_INVALID_DEVICE_REQUEST; } return Status;}
开发者ID:hoangduit,项目名称:reactos,代码行数:40,
示例5: FatOplockRequestNTSTATUSNTAPIFatOplockRequest(IN PFAT_IRP_CONTEXT IrpContext, IN PIRP Irp){ NTSTATUS Status; DPRINT1("Oplock request!/n"); Status = STATUS_INVALID_DEVICE_REQUEST; FatCompleteRequest(IrpContext, Irp, Status); return Status;}
开发者ID:hoangduit,项目名称:reactos,代码行数:13,
示例6: FatMarkVolumeDirtyNTSTATUSNTAPIFatMarkVolumeDirty(IN PFAT_IRP_CONTEXT IrpContext, IN PIRP Irp){ NTSTATUS Status; DPRINT1("Marking volume as dirty/n"); Status = STATUS_SUCCESS; FatCompleteRequest(IrpContext, Irp, Status); return Status;}
开发者ID:hoangduit,项目名称:reactos,代码行数:13,
示例7: FatPnpSurpriseRemove//.........这里部分代码省略......... Vcb - Supplies the volume being removed.Return Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; KEVENT Event; BOOLEAN VcbDeleted; // // SURPRISE - a device was physically yanked away without // any warning. This means external forces. // FatAcquireExclusiveGlobal( IrpContext ); FatAcquireExclusiveVcb( IrpContext, Vcb ); // // We need to pass this down before starting the dismount, which // could disconnect us immediately from the stack. // // // Get the next stack location, and copy over the stack location // IoCopyCurrentIrpStackLocationToNext( Irp ); // // Set up the completion routine // KeInitializeEvent( &Event, NotificationEvent, FALSE ); IoSetCompletionRoutine( Irp, FatPnpCompletionRoutine, &Event, TRUE, TRUE, TRUE ); // // Send the request and wait. // Status = IoCallDriver(Vcb->TargetDeviceObject, Irp); if (Status == STATUS_PENDING) { KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL ); Status = Irp->IoStatus.Status; } try { // // Knock as many files down for this volume as we can. // FatFlushAndCleanVolume( IrpContext, Irp, Vcb, NoFlush ); // // Now make our dismount happen. This may not vaporize the // Vcb, of course, since there could be any number of handles // outstanding since this is an out of band notification. // VcbDeleted = FatCheckForDismount( IrpContext, Vcb, TRUE ); } finally { // // Release the Vcb if it could still remain. // if (!VcbDeleted) { FatReleaseVcb( IrpContext, Vcb ); } FatReleaseGlobal( IrpContext ); } // // Cleanup our IrpContext and complete the IRP. // FatCompleteRequest( IrpContext, Irp, Status ); return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例8: FatPnpRemove//.........这里部分代码省略......... // for a REMOVE in the first two cases, as we try to intiate // dismount. // // // Acquire the global resource so that we can try to vaporize // the volume, and the vcb resource itself. // FatAcquireExclusiveGlobal( IrpContext ); FatAcquireExclusiveVcb( IrpContext, Vcb ); // // The device will be going away. Remove our lock (benign // if we never had it). // (VOID) FatUnlockVolumeInternal( IrpContext, Vcb, NULL ); // // We need to pass this down before starting the dismount, which // could disconnect us immediately from the stack. // // // Get the next stack location, and copy over the stack location // IoCopyCurrentIrpStackLocationToNext( Irp ); // // Set up the completion routine // KeInitializeEvent( &Event, NotificationEvent, FALSE ); IoSetCompletionRoutine( Irp, FatPnpCompletionRoutine, &Event, TRUE, TRUE, TRUE ); // // Send the request and wait. // Status = IoCallDriver(Vcb->TargetDeviceObject, Irp); if (Status == STATUS_PENDING) { KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL ); Status = Irp->IoStatus.Status; } try { // // Knock as many files down for this volume as we can. // FatFlushAndCleanVolume( IrpContext, Irp, Vcb, NoFlush ); // // Now make our dismount happen. This may not vaporize the // Vcb, of course, since there could be any number of handles // outstanding if we were not preceeded by a QUERY. // // PnP will take care of disconnecting this stack if we // couldn't get off of it immediately. // VcbDeleted = FatCheckForDismount( IrpContext, Vcb, TRUE ); } finally { // // Release the Vcb if it could still remain. // if (!VcbDeleted) { FatReleaseVcb( IrpContext, Vcb ); } FatReleaseGlobal( IrpContext ); } // // Cleanup our IrpContext and complete the IRP. // FatCompleteRequest( IrpContext, Irp, Status ); return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例9: FatFspDispatch//.........这里部分代码省略......... PFCB Fcb; PCCB Ccb; TYPE_OF_OPEN TypeOfOpen; // // Extract and decode the file object // TypeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ); // // Do the close. We have a slightly different format // for this call because of the async closes. // Status = FatCommonClose( Vcb, Fcb, Ccb, TypeOfOpen, TRUE, &VcbDeleted ); // // If the VCB was deleted, do not try to access it later. // if (VcbDeleted) { VolDo = NULL; } ASSERT(Status == STATUS_SUCCESS); FatCompleteRequest( IrpContext, Irp, Status ); break; } // // For read operations // case IRP_MJ_READ: (VOID) FatCommonRead( IrpContext, Irp ); break; // // For write operations, // case IRP_MJ_WRITE: (VOID) FatCommonWrite( IrpContext, Irp ); break; // // For Query Information operations, // case IRP_MJ_QUERY_INFORMATION: (VOID) FatCommonQueryInformation( IrpContext, Irp ); break; //
开发者ID:bekdepostan,项目名称:hf-2011,代码行数:67,
示例10: FatProcessExceptionNTSTATUSFatProcessException ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN NTSTATUS ExceptionCode )/*++Routine Description: This routine process an exception. It either completes the request with the saved exception status or it sends it off to IoRaiseHardError()Arguments: Irp - Supplies the Irp being processed ExceptionCode - Supplies the normalized exception status being handledReturn Value: NTSTATUS - Returns the results of either posting the Irp or the saved completion status.--*/{ PVCB Vcb; PIO_STACK_LOCATION IrpSp; FAT_VOLUME_STATE TransitionState = VolumeDirty; ULONG SavedFlags; DebugTrace(0, Dbg, "FatProcessException/n", 0); // // If there is not an irp context, we must have had insufficient resources. // if ( !ARGUMENT_PRESENT( IrpContext ) ) { FatCompleteRequest( FatNull, Irp, ExceptionCode ); return ExceptionCode; } // // Get the real exception status from IrpContext->ExceptionStatus, and // reset it. // ExceptionCode = IrpContext->ExceptionStatus; FatResetExceptionState( IrpContext ); // // If this is an Mdl write request, then take care of the Mdl // here so that things get cleaned up properly. Cc now leaves // the MDL in place so a filesystem can retry after clearing an // internal condition (FAT does not). //#if __NDAS_FAT_WIN2K_SUPPORT__ if (NdFatCcMdlWriteAbort && (IrpContext->MajorFunction == IRP_MJ_WRITE) && (FlagOn( IrpContext->MinorFunction, IRP_MN_COMPLETE_MDL ) == IRP_MN_COMPLETE_MDL) && (Irp->MdlAddress != NULL)) { PIO_STACK_LOCATION LocalIrpSp = IoGetCurrentIrpStackLocation(Irp); NdFatCcMdlWriteAbort( LocalIrpSp->FileObject, Irp->MdlAddress ); Irp->MdlAddress = NULL; }#else if ((IrpContext->MajorFunction == IRP_MJ_WRITE) && (FlagOn( IrpContext->MinorFunction, IRP_MN_COMPLETE_MDL ) == IRP_MN_COMPLETE_MDL) && (Irp->MdlAddress != NULL)) { PIO_STACK_LOCATION LocalIrpSp = IoGetCurrentIrpStackLocation(Irp); CcMdlWriteAbort( LocalIrpSp->FileObject, Irp->MdlAddress ); Irp->MdlAddress = NULL; }#endif // // If we are going to post the request, we may have to lock down the // user's buffer, so do it here in a try except so that we failed the // request if the LockPages fails. // // Also unpin any repinned Bcbs, protected by the try {} except {} filter. // try { SavedFlags = IrpContext->Flags;//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,
示例11: FatCommonLockControlNTSTATUSFatCommonLockControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing Lock control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status = STATUS_SUCCESS; PIO_STACK_LOCATION IrpSp; TYPE_OF_OPEN TypeOfOpen; PVCB Vcb; PFCB Fcb; PCCB Ccb; BOOLEAN OplockPostIrp = FALSE; PAGED_CODE(); // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonLockControl/n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp); DebugTrace( 0, Dbg, "MinorFunction = %08lx/n", IrpSp->MinorFunction); // // Decode the type of file object we're being asked to process // TypeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ); // // If the file is not a user file open then we reject the request // as an invalid parameter // if (TypeOfOpen != UserFileOpen) { FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER ); DebugTrace(-1, Dbg, "FatCommonLockControl -> STATUS_INVALID_PARAMETER/n", 0); return STATUS_INVALID_PARAMETER; } // // Acquire exclusive access to the Fcb and enqueue the Irp if we didn't // get access // if (!FatAcquireSharedFcb( IrpContext, Fcb )) { Status = FatFsdPostRequest( IrpContext, Irp ); DebugTrace(-1, Dbg, "FatCommonLockControl -> %08lx/n", Status); return Status; } try { // // We check whether we can proceed // based on the state of the file oplocks. //#if (NTDDI_VERSION >= NTDDI_WIN8) if (((IRP_MN_LOCK == IrpSp->MinorFunction) && ((ULONGLONG)IrpSp->Parameters.LockControl.ByteOffset.QuadPart < (ULONGLONG)Fcb->Header.AllocationSize.QuadPart)) || ((IRP_MN_LOCK != IrpSp->MinorFunction) && FsRtlAreThereWaitingFileLocks( &Fcb->Specific.Fcb.FileLock ))) { // // Check whether we can proceed based on the state of file oplocks if doing // an operation that interferes with oplocks. Those operations are: // // 1. Lock a range within the file's AllocationSize. // 2. Unlock a range when there are waiting locks on the file. This one//.........这里部分代码省略.........
开发者ID:Realhram,项目名称:wdk81,代码行数:101,
示例12: FatCommonDirectoryControlNTSTATUSFatCommonDirectoryControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp)/*++Routine Description: This is the common routine for doing directory control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonDirectoryControl/n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp ); DebugTrace( 0, Dbg, "MinorFunction = %08lx/n", IrpSp->MinorFunction ); // // We know this is a directory control so we'll case on the // minor function, and call a internal worker routine to complete // the irp. // switch ( IrpSp->MinorFunction ) { case IRP_MN_QUERY_DIRECTORY: Status = FatQueryDirectory( IrpContext, Irp ); break; case IRP_MN_NOTIFY_CHANGE_DIRECTORY: Status = FatNotifyChangeDirectory( IrpContext, Irp ); break; default: DebugTrace(0, Dbg, "Invalid Directory Control Minor Function %08lx/n", IrpSp->MinorFunction); FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST ); Status = STATUS_INVALID_DEVICE_REQUEST; break; } DebugTrace(-1, Dbg, "FatCommonDirectoryControl -> %08lx/n", Status); return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:68,
示例13: FatCommonSetVolumeInfoNTSTATUSFatCommonSetVolumeInfo ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for setting Volume Information called by both the fsd and fsp threads.Arguments: Irp - Supplies the Irp being processedReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; PVCB Vcb; PFCB Fcb; PCCB Ccb; TYPE_OF_OPEN TypeOfOpen; ULONG Length; FS_INFORMATION_CLASS FsInformationClass; PVOID Buffer; // // Get the current stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonSetVolumeInfo.../n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp ); DebugTrace( 0, Dbg, "->Length = %08lx/n", IrpSp->Parameters.SetVolume.Length); DebugTrace( 0, Dbg, "->FsInformationClass = %08lx/n", IrpSp->Parameters.SetVolume.FsInformationClass); DebugTrace( 0, Dbg, "->Buffer = %08lx/n", Irp->AssociatedIrp.SystemBuffer); // // Reference our input parameters to make things easier // Length = IrpSp->Parameters.SetVolume.Length; FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass; Buffer = Irp->AssociatedIrp.SystemBuffer; // // Decode the file object to get the Vcb // TypeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ); if (TypeOfOpen != UserVolumeOpen) { FatCompleteRequest( IrpContext, Irp, STATUS_ACCESS_DENIED ); DebugTrace(-1, Dbg, "FatCommonSetVolumeInfo -> STATUS_ACCESS_DENIED/n", 0); return STATUS_ACCESS_DENIED; } // // Acquire exclusive access to the Vcb and enqueue the Irp if we didn't // get access // if (!FatAcquireExclusiveVcb( IrpContext, Vcb )) { DebugTrace(0, Dbg, "Cannot acquire Vcb/n", 0); Status = FatFsdPostRequest( IrpContext, Irp ); DebugTrace(-1, Dbg, "FatCommonSetVolumeInfo -> %08lx/n", Status ); return Status; } try { // // Make sure the vcb is in a usable condition. This will raise // and error condition if the volume is unusable // // Also verify the Root Dcb since we need info from there. // FatVerifyFcb( IrpContext, Vcb->RootDcb ); // // Based on the information class we'll do different actions. Each // of the procedures that we're calling performs the action if//.........这里部分代码省略.........
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例14: FatCommonQueryVolumeInfo//.........这里部分代码省略......... (VOID) FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ); ASSERT( Vcb != NULL ); try { // // Make sure the vcb is in a usable condition. This will raise // and error condition if the volume is unusable // // Also verify the Root Dcb since we need info from there. // FatVerifyFcb( IrpContext, Vcb->RootDcb ); // // Based on the information class we'll do different actions. Each // of the procedures that we're calling fills up the output buffer // if possible and returns true if it successfully filled the buffer // and false if it couldn't wait for any I/O to complete. // switch (FsInformationClass) { case FileFsVolumeInformation: // // This is the only routine we need the Vcb shared because of // copying the volume label. All other routines copy fields that // cannot change or are just manifest constants. // if (!FatAcquireSharedVcb( IrpContext, Vcb )) { DebugTrace(0, Dbg, "Cannot acquire Vcb/n", 0); Status = FatFsdPostRequest( IrpContext, Irp ); IrpContext = NULL; Irp = NULL; } else { WeAcquiredVcb = TRUE; Status = FatQueryFsVolumeInfo( IrpContext, Vcb, Buffer, &Length ); } break; case FileFsSizeInformation: Status = FatQueryFsSizeInfo( IrpContext, Vcb, Buffer, &Length ); break; case FileFsDeviceInformation: Status = FatQueryFsDeviceInfo( IrpContext, Vcb, Buffer, &Length ); break; case FileFsAttributeInformation: Status = FatQueryFsAttributeInfo( IrpContext, Vcb, Buffer, &Length ); break; case FileFsFullSizeInformation: Status = FatQueryFsFullSizeInfo( IrpContext, Vcb, Buffer, &Length ); break; default: Status = STATUS_INVALID_PARAMETER; break; } // // Set the information field to the number of bytes actually filled in. // if (Irp != NULL) { Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length; } } finally { DebugUnwind( FatCommonQueryVolumeInfo ); if ( WeAcquiredVcb ) { FatReleaseVcb( IrpContext, Vcb ); } if (!AbnormalTermination()) { FatCompleteRequest( IrpContext, Irp, Status ); } DebugTrace(-1, Dbg, "FatCommonQueryVolumeInfo -> %08lx/n", Status); } return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例15: FatiLockControlNTSTATUSNTAPIFatiLockControl(PFAT_IRP_CONTEXT IrpContext, PIRP Irp){ PIO_STACK_LOCATION IrpSp; TYPE_OF_OPEN TypeOfOpen; PVCB Vcb; PFCB Fcb; PCCB Ccb; NTSTATUS Status; /* Get IRP stack location */ IrpSp = IoGetCurrentIrpStackLocation(Irp); /* Determine type of open */ TypeOfOpen = FatDecodeFileObject(IrpSp->FileObject, &Vcb, &Fcb, &Ccb); /* Only user file open is allowed */ if (TypeOfOpen != UserFileOpen) { FatCompleteRequest(IrpContext, Irp, STATUS_INVALID_PARAMETER); return STATUS_INVALID_PARAMETER; } /* Acquire shared FCB lock */ if (!FatAcquireSharedFcb(IrpContext, Fcb)) { UNIMPLEMENTED; //Status = FatFsdPostRequest(IrpContext, Irp); Status = STATUS_NOT_IMPLEMENTED; return Status; } /* Check oplock state */ Status = FsRtlCheckOplock(&Fcb->Fcb.Oplock, Irp, IrpContext, FatOplockComplete, NULL); if (Status != STATUS_SUCCESS) { /* Release FCB lock */ FatReleaseFcb(IrpContext, Fcb); return Status; } /* Process the lock */ Status = FsRtlProcessFileLock(&Fcb->Fcb.Lock, Irp, NULL); /* Update Fast I/O state */ Fcb->Header.IsFastIoPossible = FatIsFastIoPossible(Fcb); /* Complete the request */ FatCompleteRequest(IrpContext, NULL, 0); /* Release FCB lock */ FatReleaseFcb(IrpContext, Fcb); return Status;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:62,
示例16: FatPnpCancelRemoveNTSTATUSFatPnpCancelRemove ( PIRP_CONTEXT IrpContext, PIRP Irp, PVCB Vcb )/*++Routine Description: This routine handles the PnP cancel remove operation. This is our notification that a previously proposed remove (query) was eventually vetoed by a component. The filesystem is responsible for cleaning up and getting ready for more IO. Arguments: Irp - Supplies the Irp to process Vcb - Supplies the volume being removed.Return Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; // // CANCEL - a previous QUERY has been rescinded as a result // of someone vetoing. Since PnP cannot figure out who may // have gotten the QUERY (think about it: stacked drivers), // we must expect to deal with getting a CANCEL without having // seen the QUERY. // // For FAT, this is quite easy. In fact, we can't get a // CANCEL if the underlying drivers succeeded the QUERY since // we disconnect the Vpb on our dismount initiation. This is // actually pretty important because if PnP could get to us // after the disconnect we'd be thoroughly unsynchronized // with respect to the Vcb getting torn apart - merely referencing // the volume device object is insufficient to keep us intact. // FatAcquireExclusiveVcb( IrpContext, Vcb ); // // Unlock the volume. This is benign if we never had seen // a QUERY. // Status = FatUnlockVolumeInternal( IrpContext, Vcb, NULL ); try { // // Send the request. The underlying driver will complete the // IRP. Since we don't need to be in the way, simply ellide // ourselves out of the IRP stack. // IoSkipCurrentIrpStackLocation( Irp ); Status = IoCallDriver(Vcb->TargetDeviceObject, Irp); } finally { FatReleaseVcb( IrpContext, Vcb ); } FatCompleteRequest( IrpContext, NULL, STATUS_SUCCESS ); return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:77,
示例17: NdasFatSecondaryQueryDirectory//.........这里部分代码省略......... DebugTrace( 0, Dbg, " ->UserBuffer = %08lx/n", Irp->AssociatedIrp.SystemBuffer); DebugTrace( 0, Dbg, " ->RestartScan = %08lx/n", FlagOn( IrpSp->Flags, SL_RESTART_SCAN )); DebugTrace( 0, Dbg, " ->ReturnSingleEntry = %08lx/n", FlagOn( IrpSp->Flags, SL_RETURN_SINGLE_ENTRY )); DebugTrace( 0, Dbg, " ->IndexSpecified = %08lx/n", FlagOn( IrpSp->Flags, SL_INDEX_SPECIFIED )); // // Reference our input parameters to make things easier // UserBufferLength = IrpSp->Parameters.QueryDirectory.Length; FileInformationClass = IrpSp->Parameters.QueryDirectory.FileInformationClass; FileIndex = IrpSp->Parameters.QueryDirectory.FileIndex; UniArgFileName = (PUNICODE_STRING) IrpSp->Parameters.QueryDirectory.FileName; RestartScan = BooleanFlagOn(IrpSp->Flags, SL_RESTART_SCAN); ReturnSingleEntry = BooleanFlagOn(IrpSp->Flags, SL_RETURN_SINGLE_ENTRY); IndexSpecified = BooleanFlagOn(IrpSp->Flags, SL_INDEX_SPECIFIED); // // Check on the type of open. We return invalid parameter for all // but UserDirectoryOpens. Also check that the filename is a valid // UNICODE string. // if (FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Dcb, &Ccb) != UserDirectoryOpen || (UniArgFileName && UniArgFileName->Length % sizeof(WCHAR))) { FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER ); DebugTrace(-1, Dbg, "FatQueryDirectory -> STATUS_INVALID_PARAMETER/n", 0); return STATUS_INVALID_PARAMETER; }#if 1 if (FlagOn(Ccb->NdasFatFlags, ND_FAT_CCB_FLAG_UNOPENED)) { ASSERT( FlagOn(Ccb->NdasFatFlags, ND_FAT_CCB_FLAG_CORRUPTED) ); FatCompleteRequest( IrpContext, Irp, STATUS_FILE_CORRUPT_ERROR ); DebugTrace2( -1, Dbg, ("NtfsCommonDirectoryControl -> STATUS_FILE_CORRUPT_ERROR/n") ); return STATUS_FILE_CORRUPT_ERROR; }#endif // // Initialize the local variables. // Bcb = NULL; UpdateCcb = TRUE; Dirent = NULL; Fat8Dot3String.MaximumLength = 12; Fat8Dot3String.Buffer = Fat8Dot3Buffer; LongFileName.Length = 0;
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:67,
示例18: NdasFatSecondaryUserFsCtrl//.........这里部分代码省略......... // request synchronous. Since the former was not done by design, do the latter. // if (Irp->RequestorMode != KernelMode && (FsControlCode & 3) == METHOD_NEITHER) { SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT); } // // Case on the control code. // switch ( FsControlCode ) { case FSCTL_REQUEST_OPLOCK_LEVEL_1: case FSCTL_REQUEST_OPLOCK_LEVEL_2: case FSCTL_REQUEST_BATCH_OPLOCK: case FSCTL_OPLOCK_BREAK_ACKNOWLEDGE: case FSCTL_OPBATCH_ACK_CLOSE_PENDING: case FSCTL_OPLOCK_BREAK_NOTIFY: case FSCTL_OPLOCK_BREAK_ACK_NO_2: case FSCTL_REQUEST_FILTER_OPLOCK : //ASSERT( FALSE ); //Status = STATUS_SUCCESS; //break; Status = FatOplockRequest( IrpContext, Irp ); return Status; case FSCTL_LOCK_VOLUME: FatCompleteRequest( IrpContext, Irp, Status = STATUS_ACCESS_DENIED ); DebugTrace2( -1, Dbg, ("NdasFatSecondaryUserFsCtrl -> %08lx/n", Status) ); return Status; //Status = FatLockVolume( IrpContext, Irp ); break; case FSCTL_UNLOCK_VOLUME: FatCompleteRequest( IrpContext, Irp, Status = STATUS_ACCESS_DENIED ); DebugTrace2( -1, Dbg, ("NdasFatSecondaryUserFsCtrl -> %08lx/n", Status) ); return Status; //Status = FatUnlockVolume( IrpContext, Irp ); break; case FSCTL_DISMOUNT_VOLUME: FatCompleteRequest( IrpContext, Irp, Status = STATUS_ACCESS_DENIED ); DebugTrace2( -1, Dbg, ("NdasFatSecondaryUserFsCtrl -> %08lx/n", Status) ); return Status; //Status = FatDismountVolume( IrpContext, Irp ); break; case FSCTL_MARK_VOLUME_DIRTY: FatCompleteRequest( IrpContext, Irp, Status = STATUS_ACCESS_DENIED ); DebugTrace2( -1, Dbg, ("NdasFatSecondaryUserFsCtrl -> %08lx/n", Status) );
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:67,
示例19: FatCommonDeviceControlNTSTATUSFatCommonDeviceControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing Device control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to process InFsp - Indicates if this is the fsp thread or someother threadReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; KEVENT WaitEvent; PVOID CompletionContext = NULL; PVCB Vcb; PFCB Fcb; PCCB Ccb;#if __NDAS_FAT_PRIMARY__ if (IrpContext->MajorFunction == IRP_MJ_DEVICE_CONTROL && IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode == IOCTL_INSERT_PRIMARY_SESSION) { PVOLUME_DEVICE_OBJECT VolDo = CONTAINING_RECORD( IoGetCurrentIrpStackLocation(Irp)->DeviceObject, VOLUME_DEVICE_OBJECT, DeviceObject ); PSESSION_INFORMATION inputBuffer = (PSESSION_INFORMATION)Irp->AssociatedIrp.SystemBuffer; ULONG inputBufferLength = IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.InputBufferLength; ULONG outputBufferLength; PULONG outputBuffer; PPRIMARY_SESSION primarySession; if (inputBufferLength != sizeof(SESSION_INFORMATION)) { FatCompleteRequest( IrpContext, Irp, Status = STATUS_INVALID_PARAMETER ); return Status; } outputBufferLength = IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.OutputBufferLength; outputBuffer = (PULONG)Irp->AssociatedIrp.SystemBuffer; primarySession = PrimarySession_Create( IrpContext, VolDo, inputBuffer, Irp ); ASSERT( primarySession ); FatCompleteRequest( IrpContext, NULL, 0 ); Status = STATUS_PENDING; return Status; }#endif // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonDeviceControl/n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp); DebugTrace( 0, Dbg, "MinorFunction = %08lx/n", IrpSp->MinorFunction); // // Decode the file object, the only type of opens we accept are // user volume opens. // if (FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ) != UserVolumeOpen) { FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER ); DebugTrace(-1, Dbg2, "FatCommonDeviceControl -> %08lx/n", STATUS_INVALID_PARAMETER); return STATUS_INVALID_PARAMETER; }#define IOCTL_VOLUME_BASE ((ULONG) 'V')#define MOUNTDEVCONTROLTYPE ((ULONG) 'M') DebugTrace2( 0, Dbg2, ("FatCommonDeviceControl: deviceType = %d, function = %d IOCTL_VOLUME_BASE = %d, MOUNTDEVCONTROLTYPE = %d/n", DEVICE_TYPE_FROM_CTL_CODE(IrpSp->Parameters.DeviceIoControl.IoControlCode), (UCHAR)((IrpSp->Parameters.DeviceIoControl.IoControlCode & 0x00003FFC) >> 2), IOCTL_VOLUME_BASE, MOUNTDEVCONTROLTYPE) );//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,
示例20: FatCommonDeviceControlNTSTATUSFatCommonDeviceControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing Device control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to process InFsp - Indicates if this is the fsp thread or someother threadReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; KEVENT WaitEvent; PVOID CompletionContext = NULL; PVCB Vcb; PFCB Fcb; PCCB Ccb; // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonDeviceControl/n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp); DebugTrace( 0, Dbg, "MinorFunction = %08lx/n", IrpSp->MinorFunction); // // Decode the file object, the only type of opens we accept are // user volume opens. // if (FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ) != UserVolumeOpen) { FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER ); DebugTrace(-1, Dbg, "FatCommonDeviceControl -> %08lx/n", STATUS_INVALID_PARAMETER); return STATUS_INVALID_PARAMETER; } // // A few IOCTLs actually require some intervention on our part // switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_VOLSNAP_FLUSH_AND_HOLD_WRITES: // // This is sent by the Volume Snapshot driver (Lovelace). // We flush the volume, and hold all file resources // to make sure that nothing more gets dirty. Then we wait // for the IRP to complete or cancel. // SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ); FatAcquireExclusiveVolume( IrpContext, Vcb ); FatFlushAndCleanVolume( IrpContext, Irp, Vcb, FlushWithoutPurge ); KeInitializeEvent( &WaitEvent, NotificationEvent, FALSE ); CompletionContext = &WaitEvent; // // Get the next stack location, and copy over the stack location // IoCopyCurrentIrpStackLocationToNext( Irp ); // // Set up the completion routine // IoSetCompletionRoutine( Irp, FatDeviceControlCompletionRoutine, CompletionContext, TRUE, TRUE, TRUE );//.........这里部分代码省略.........
开发者ID:bekdepostan,项目名称:hf-2011,代码行数:101,
示例21: NdasFatSecondaryCommonFileSystemControlNTSTATUSNdasFatSecondaryCommonFileSystemControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing FileSystem control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg,"FatCommonFileSystemControl/n", 0); DebugTrace( 0, Dbg,"Irp = %08lx/n", Irp); DebugTrace( 0, Dbg,"MinorFunction = %08lx/n", IrpSp->MinorFunction); // // We know this is a file system control so we'll case on the // minor function, and call a internal worker routine to complete // the irp. // switch (IrpSp->MinorFunction) { case IRP_MN_USER_FS_REQUEST: Status = NdasFatSecondaryUserFsCtrl( IrpContext, Irp ); break; case IRP_MN_MOUNT_VOLUME: NDAS_ASSERT( FALSE ); Status = STATUS_INVALID_DEVICE_REQUEST; //Status = FatMountVolume( IrpContext, // IrpSp->Parameters.MountVolume.DeviceObject, // IrpSp->Parameters.MountVolume.Vpb, // IrpSp->DeviceObject ); // // Complete the request. // // We do this here because FatMountVolume can be called recursively, // but the Irp is only to be completed once. // // NOTE: I don't think this is true anymore (danlo 3/15/1999). Probably // an artifact of the old doublespace attempt. // FatCompleteRequest( IrpContext, Irp, Status ); break; case IRP_MN_VERIFY_VOLUME: Status = STATUS_INVALID_DEVICE_REQUEST; FatCompleteRequest( IrpContext, Irp, Status ); //Status = FatVerifyVolume( IrpContext, Irp ); break; default: DebugTrace( 0, Dbg, "Invalid FS Control Minor Function %08lx/n", IrpSp->MinorFunction); FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST ); Status = STATUS_INVALID_DEVICE_REQUEST; break; } DebugTrace(-1, Dbg, "FatCommonFileSystemControl -> %08lx/n", Status); return Status;}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:96,
示例22: NdFatSecondaryCommonWrite3NTSTATUSNdFatSecondaryCommonWrite3 ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp ){ NTSTATUS status; PVOLUME_DEVICE_OBJECT volDo = CONTAINING_RECORD( IrpContext->Vcb, VOLUME_DEVICE_OBJECT, Vcb ); BOOLEAN secondarySessionResourceAcquired = FALSE; PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation( Irp ); PFILE_OBJECT fileObject = irpSp->FileObject; struct Write write; PSECONDARY_REQUEST secondaryRequest = NULL; PNDFS_REQUEST_HEADER ndfsRequestHeader; PNDFS_WINXP_REQUEST_HEADER ndfsWinxpRequestHeader; PNDFS_WINXP_REPLY_HEADER ndfsWinxpReplytHeader; LARGE_INTEGER timeOut; TYPE_OF_OPEN typeOfOpen; PVCB vcb; PFCB fcb; PCCB ccb; BOOLEAN fcbAcquired = FALSE; BOOLEAN writeToEof; PUCHAR inputBuffer; ULONG totalWriteLength; ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL ); ASSERT (!FlagOn(Irp->Flags, IRP_PAGING_IO)); typeOfOpen = FatDecodeFileObject( fileObject, &vcb, &fcb, &ccb ); ASSERT( typeOfOpen == UserFileOpen ); if (FlagOn(ccb->NdFatFlags, ND_FAT_CCB_FLAG_UNOPENED)) { /*if (FlagOn( fcb->FcbState, FCB_STATE_FILE_DELETED )) { ASSERT( FALSE ); FatRaiseStatus( IrpContext, STATUS_FILE_DELETED, NULL, NULL ); } else */{ ASSERT( FlagOn(ccb->NdFatFlags, ND_FAT_CCB_FLAG_CORRUPTED) ); status = STATUS_FILE_CORRUPT_ERROR; FatCompleteRequest( IrpContext, Irp, status ); return status; } } writeToEof = (irpSp->Parameters.Write.ByteOffset.QuadPart == FILE_WRITE_TO_END_OF_FILE && irpSp->Parameters.Write.ByteOffset.HighPart == -1); write.ByteOffset = irpSp->Parameters.Write.ByteOffset; write.Key = irpSp->Parameters.Write.Key; write.Length = irpSp->Parameters.Write.Length; ASSERT( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) ); //FatAcquireSharedFcb( IrpContext, fcb ); //fcbAcquired = TRUE; try { secondarySessionResourceAcquired = SecondaryAcquireResourceExclusiveLite( IrpContext, &volDo->Secondary->SessionResource, BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) ); if (FlagOn(volDo->Secondary->Thread.Flags, SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED) ) { PrintIrp( Dbg, "SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED", NULL, IrpContext->OriginatingIrp ); if (FlagOn(Irp->Flags, IRP_PAGING_IO)) { try_return( status = STATUS_FILE_LOCK_CONFLICT ); } else { FatRaiseStatus( IrpContext, STATUS_CANT_WAIT ); } } inputBuffer = FatMapUserBuffer( IrpContext, Irp ); totalWriteLength = 0; do { ULONG inputBufferLength; _U8 *ndfsWinxpRequestData; _U64 primaryFileHandle;//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,
示例23: NdFatCommonFlushBuffers//.........这里部分代码省略......... // // The volume is now clean, note it. // if (!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_MOUNTED_DIRTY)) { FatMarkVolume( IrpContext, Vcb, VolumeClean ); ClearFlag( Vcb->VcbState, VCB_STATE_FLAG_VOLUME_DIRTY ); } // // Unlock the volume if it is removable. // if (FlagOn(Vcb->VcbState, VCB_STATE_FLAG_REMOVABLE_MEDIA) && !FlagOn(Vcb->VcbState, VCB_STATE_FLAG_BOOT_OR_PAGING_FILE)) { FatToggleMediaEjectDisable( IrpContext, Vcb, FALSE ); } } break; default: FatBugCheck( TypeOfOpen, 0, 0 ); } FatUnpinBcb( IrpContext, DirentBcb ); FatUnpinRepinnedBcbs( IrpContext ); } finally { DebugUnwind( FatCommonFlushBuffers ); if (secondaryRequest) DereferenceSecondaryRequest( secondaryRequest ); if (secondarySessionResourceAcquired) { SecondaryReleaseResourceLite( IrpContext, &volDo->Secondary->SessionResource ); } FatUnpinBcb( IrpContext, DirentBcb ); if (VcbAcquired) { FatReleaseSecondaryVcb( IrpContext, Vcb ); } if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); } // // If this is a normal termination then pass the request on // to the target device object. // if (!AbnormalTermination()) { NTSTATUS DriverStatus; PIO_STACK_LOCATION NextIrpSp; // // Get the next stack location, and copy over the stack location // NextIrpSp = IoGetNextIrpStackLocation( Irp ); *NextIrpSp = *IrpSp; // // Set up the completion routine // IoSetCompletionRoutine( Irp, FatFlushCompletionRoutine, ULongToPtr( Status ), TRUE, TRUE, TRUE ); // // Send the request. // DriverStatus = IoCallDriver(Vcb->TargetDeviceObject, Irp); Status = (DriverStatus == STATUS_INVALID_DEVICE_REQUEST) ? Status : DriverStatus; // // Free the IrpContext and return to the caller. // FatCompleteRequest( IrpContext, FatNull, STATUS_SUCCESS ); } DebugTrace(-1, Dbg, "FatCommonFlushBuffers -> %08lx/n", Status); } return Status;}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,
示例24: FatCommonPnpNTSTATUSFatCommonPnp ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing PnP operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; PVOLUME_DEVICE_OBJECT OurDeviceObject; PVCB Vcb; // // Force everything to wait. // SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT); // // Get the current Irp stack location. // IrpSp = IoGetCurrentIrpStackLocation( Irp ); // // Find our Vcb. This is tricky since we have no file object in the Irp. // OurDeviceObject = (PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject; // // Take the global lock to synchronise against volume teardown. // FatAcquireExclusiveGlobal( IrpContext ); // // Make sure this device object really is big enough to be a volume device // object. If it isn't, we need to get out before we try to reference some // field that takes us past the end of an ordinary device object. // if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) || NodeType( &OurDeviceObject->Vcb ) != FAT_NTC_VCB) { // // We were called with something we don't understand. // FatReleaseGlobal( IrpContext ); Status = STATUS_INVALID_PARAMETER; FatCompleteRequest( IrpContext, Irp, Status ); return Status; }#if __NDAS_FAT__ if (OurDeviceObject->NetdiskEnableMode == NETDISK_SECONDARY) SetFlag( IrpContext->NdFatFlags, ND_FAT_IRP_CONTEXT_FLAG_SECONDARY_CONTEXT );#endif Vcb = &OurDeviceObject->Vcb; // // Case on the minor code. // #if __NDAS_FAT_SECONDARY__ if ( ((PVOLUME_DEVICE_OBJECT)IrpSp->DeviceObject)->Secondary && ( ((PVOLUME_DEVICE_OBJECT)IrpSp->DeviceObject)->NetdiskEnableMode == NETDISK_SECONDARY || ((PVOLUME_DEVICE_OBJECT)IrpSp->DeviceObject)->NetdiskEnableMode == NETDISK_SECONDARY2PRIMARY ) ) { PSECONDARY Secondary = ((PVOLUME_DEVICE_OBJECT)IrpSp->DeviceObject)->Secondary; Status = STATUS_SUCCESS; Secondary_Reference( Secondary ); switch ( IrpSp->MinorFunction ) {//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,
示例25: FatCommonLockControlNTSTATUSFatCommonLockControl ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp)/*++Routine Description: This is the common routine for doing Lock control operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; TYPE_OF_OPEN TypeOfOpen; PVCB Vcb; PFCB Fcb; PCCB Ccb; BOOLEAN OplockPostIrp = FALSE; // // Get a pointer to the current Irp stack location // IrpSp = IoGetCurrentIrpStackLocation( Irp ); DebugTrace(+1, Dbg, "FatCommonLockControl/n", 0); DebugTrace( 0, Dbg, "Irp = %08lx/n", Irp); DebugTrace( 0, Dbg, "MinorFunction = %08lx/n", IrpSp->MinorFunction); // // Decode the type of file object we're being asked to process // TypeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb ); // // If the file is not a user file open then we reject the request // as an invalid parameter // if (TypeOfOpen != UserFileOpen) { FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER ); DebugTrace(-1, Dbg, "FatCommonLockControl -> STATUS_INVALID_PARAMETER/n", 0); return STATUS_INVALID_PARAMETER; } // // Acquire exclusive access to the Fcb and enqueue the Irp if we didn't // get access // if (!FatAcquireSharedFcb( IrpContext, Fcb )) { Status = FatFsdPostRequest( IrpContext, Irp ); DebugTrace(-1, Dbg, "FatCommonLockControl -> %08lx/n", Status); return Status; } try { // // We check whether we can proceed // based on the state of the file oplocks. // Status = FsRtlCheckOplock( &Fcb->Specific.Fcb.Oplock, Irp, IrpContext, FatOplockComplete, NULL ); if (Status != STATUS_SUCCESS) { OplockPostIrp = TRUE; try_return( NOTHING ); } // // Now call the FsRtl routine to do the actual processing of the // Lock request ////.........这里部分代码省略.........
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例26: FatCommonPnpNTSTATUSFatCommonPnp ( IN PIRP_CONTEXT IrpContext, IN PIRP Irp )/*++Routine Description: This is the common routine for doing PnP operations called by both the fsd and fsp threadsArguments: Irp - Supplies the Irp to processReturn Value: NTSTATUS - The return status for the operation--*/{ NTSTATUS Status; PIO_STACK_LOCATION IrpSp; PVOLUME_DEVICE_OBJECT OurDeviceObject; PVCB Vcb; // // Get the current Irp stack location. // IrpSp = IoGetCurrentIrpStackLocation( Irp ); // // Find our Vcb. This is tricky since we have no file object in the Irp. // OurDeviceObject = (PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject; // // Make sure this device object really is big enough to be a volume device // object. If it isn't, we need to get out before we try to reference some // field that takes us past the end of an ordinary device object. // if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) || NodeType( &OurDeviceObject->Vcb ) != FAT_NTC_VCB) { // // We were called with something we don't understand. // Status = STATUS_INVALID_PARAMETER; FatCompleteRequest( IrpContext, Irp, Status ); return Status; } // // Force everything to wait. // SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT); Vcb = &OurDeviceObject->Vcb; // // Case on the minor code. // switch ( IrpSp->MinorFunction ) { case IRP_MN_QUERY_REMOVE_DEVICE: Status = FatPnpQueryRemove( IrpContext, Irp, Vcb ); break; case IRP_MN_SURPRISE_REMOVAL: Status = FatPnpSurpriseRemove( IrpContext, Irp, Vcb ); break; case IRP_MN_REMOVE_DEVICE: Status = FatPnpRemove( IrpContext, Irp, Vcb ); break; case IRP_MN_CANCEL_REMOVE_DEVICE: Status = FatPnpCancelRemove( IrpContext, Irp, Vcb ); break; default: // // Just pass the IRP on. As we do not need to be in the // way on return, ellide ourselves out of the stack.//.........这里部分代码省略.........
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
示例27: FatFsdClose//.........这里部分代码省略......... // FatDeallocateCcbStrings( Ccb ); CloseContext = &Ccb->CloseContext; CloseContext->Free = FALSE; SetFlag( Ccb->Flags, CCB_FLAG_CLOSE_CONTEXT ); } // // If the status is pending, then let's get the information we // need into the close context we already have bagged, complete // the request, and post it. It is important we allocate nothing // in the close path. // CloseContext->Vcb = Vcb; CloseContext->Fcb = Fcb; CloseContext->TypeOfOpen = TypeOfOpen; // // Send it off, either to an ExWorkerThread or to the async // close list. // FatQueueClose( CloseContext, (BOOLEAN)(Fcb && FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE))); } else { // // The close proceeded synchronously, so for the metadata objects we // can now drop the close context we preallocated. // if ((TypeOfOpen == VirtualVolumeFile) || (TypeOfOpen == DirectoryFile) || (TypeOfOpen == EaFile)) { if (TypeOfOpen == VirtualVolumeFile) { // // If the VCB was deleted during the close, the close context for this // open has already been freed. // if (!VcbDeleted) { CloseContext = Vcb->CloseContext; Vcb->CloseContext = NULL; NT_ASSERT( CloseContext != NULL ); } else { CloseContext = NULL; } } else { CloseContext = FatAllocateCloseContext( (VcbDeleted ? NULL : Vcb) ); NT_ASSERT( CloseContext != NULL ); } if (CloseContext != NULL) { ExFreePool( CloseContext ); } } } FatCompleteRequest( FatNull, Irp, Status ); } except(FatExceptionFilter( NULL, GetExceptionInformation() )) { // // We had some trouble trying to perform the requested // operation, so we'll abort the I/O request with the // error status that we get back from the execption code. // Status = FatProcessException( NULL, Irp, GetExceptionCode() ); } if (TopLevel) { IoSetTopLevelIrp( NULL ); } FsRtlExitFileSystem(); // // And return to our caller // DebugTrace(-1, Dbg, "FatFsdClose -> %08lx/n", Status); UNREFERENCED_PARAMETER( VolumeDeviceObject ); return Status;}
开发者ID:Realhram,项目名称:wdk81,代码行数:101,
示例28: FatPnpQueryRemove//.........这里部分代码省略......... if (NT_SUCCESS( Status )) { // // With the volume held locked, note that we must finalize as much // as possible right now. // FatFlushAndCleanVolume( IrpContext, Irp, Vcb, Flush ); // // We need to pass this down before starting the dismount, which // could disconnect us immediately from the stack. // // // Get the next stack location, and copy over the stack location // IoCopyCurrentIrpStackLocationToNext( Irp ); // // Set up the completion routine // KeInitializeEvent( &Event, NotificationEvent, FALSE ); IoSetCompletionRoutine( Irp, FatPnpCompletionRoutine, &Event, TRUE, TRUE, TRUE ); // // Send the request and wait. // Status = IoCallDriver(Vcb->TargetDeviceObject, Irp); if (Status == STATUS_PENDING) { KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL ); Status = Irp->IoStatus.Status; } // // Now if no one below us failed already, initiate the dismount // on this volume, make it go away. PnP needs to see our internal // streams close and drop their references to the target device. // // Since we were able to lock the volume, we are guaranteed to // move this volume into dismount state and disconnect it from // the underlying storage stack. The force on our part is actually // unnecesary, though complete. // // What is not strictly guaranteed, though, is that the closes // for the metadata streams take effect synchronously underneath // of this call. This would leave references on the target device // even though we are disconnected! // if (NT_SUCCESS( Status )) { VcbDeleted = FatCheckForDismount( IrpContext, Vcb, TRUE ); ASSERT( VcbDeleted || Vcb->VcbCondition == VcbBad ); } } } finally { // // Release the Vcb if it could still remain. // if (!VcbDeleted) { FatReleaseVcb( IrpContext, Vcb ); } if (GlobalHeld) { FatReleaseGlobal( IrpContext ); } } // // Cleanup our IrpContext and complete the IRP if neccesary. // FatCompleteRequest( IrpContext, Irp, Status ); return Status;}
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,
注:本文中的FatCompleteRequest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FatalErrorException函数代码示例 C++ Fade函数代码示例 |