您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ try_return函数代码示例

51自学网 2021-06-03 08:59:17
  C++
这篇教程C++ try_return函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中try_return函数的典型用法代码示例。如果您正苦于以下问题:C++ try_return函数的具体用法?C++ try_return怎么用?C++ try_return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了try_return函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MsCreateClientEnd

//.........这里部分代码省略.........                                       &Privileges,                                       IoGetFileObjectGenericMapping(),                                       RequestorMode,                                       &grantedAccess,                                       &iosb.Status );        if (Privileges != NULL) {              (VOID) SeAppendPrivileges(                         AccessState,                         Privileges                         );            SeFreePrivileges( Privileges );        }        if (accessGranted) {            AccessState->PreviouslyGrantedAccess |= grantedAccess;            AccessState->RemainingDesiredAccess &= ~grantedAccess;        }        RtlInitUnicodeString( &name, L"Mailslot" );        SeOpenObjectAuditAlarm( &name,                                NULL,                                &FileObject->FileName,                                Fcb->SecurityDescriptor,                                AccessState,                                FALSE,                                accessGranted,                                RequestorMode,                                &AccessState->GenerateOnClose );        SeUnlockSubjectContext( &AccessState->SubjectSecurityContext );        if (!accessGranted) {            DebugTrace(0, Dbg, "Access Denied/n", 0 );            try_return( iosb.Status );        }        //        // Now make sure our share access is okay.        //        if (!NT_SUCCESS(iosb.Status = IoCheckShareAccess( DesiredAccess,                                                          ShareAccess,                                                          FileObject,                                                          &Fcb->ShareAccess,                                                          TRUE ))) {            DebugTrace(0, Dbg, "Sharing violation/n", 0);            try_return( NOTHING );        }        shareAccessUpdated = TRUE;        //        // Create a CCB for this client.        //        ccb = MsCreateCcb( Fcb );        //        // Set the file object back pointers and our pointer to the        // server file object.        //        MsSetFileObject( FileObject,                         ccb,                         NULL );        ccb->FileObject = FileObject;        //        //  And set our return status        //        iosb.Status = STATUS_SUCCESS;        iosb.Information = FILE_OPENED;    try_exit: NOTHING;    } finally {        DebugTrace(-1, Dbg, "MsCreateClientEnd -> %08lx/n", iosb.Status);        if (!NT_SUCCESS(iosb.Status) || AbnormalTermination()) {            if (shareAccessUpdated) {                IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );            }        }    }    return iosb;}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,


示例2: FatFastUnlockAllByKey

BOOLEANFatFastUnlockAllByKey (    IN PFILE_OBJECT FileObject,    PVOID ProcessId,    ULONG Key,    OUT PIO_STATUS_BLOCK IoStatus,    IN PDEVICE_OBJECT DeviceObject)/*++Routine Description:    This is a call back routine for doing the fast unlock all by key call.Arguments:    FileObject - Supplies the file object used in this operation    ProcessId - Supplies the process ID used in this operation    Key - Supplies the key used in this operation    Status - Receives the Status if this operation is successfulReturn Value:    BOOLEAN - TRUE if this operation completed and FALSE if caller        needs to take the long route.--*/{    BOOLEAN Results;    PVCB Vcb;    PFCB Fcb;    PCCB Ccb;    DebugTrace(+1, Dbg, "FatFastUnlockAllByKey/n", 0);    IoStatus->Information = 0;    //    //  Decode the type of file object we're being asked to process and make sure    //  it is only a user file open.    //    if (FatDecodeFileObject( FileObject, &Vcb, &Fcb, &Ccb ) != UserFileOpen) {        IoStatus->Status = STATUS_INVALID_PARAMETER;        DebugTrace(-1, Dbg, "FatFastUnlockAll -> TRUE (STATUS_INVALID_PARAMETER)/n", 0);        return TRUE;    }    //    //  Acquire exclusive access to the Fcb this operation can always wait    //    FsRtlEnterFileSystem();    (VOID) ExAcquireResourceSharedLite( Fcb->Header.Resource, TRUE );    try {        //        //  We check whether we can proceed based on the state of the file oplocks.        //        if (!FsRtlOplockIsFastIoPossible( &(Fcb)->Specific.Fcb.Oplock )) {            try_return( Results = FALSE );        }        //        //  Now call the FsRtl routine to do the actual processing of the        //  Lock request.  The call will always succeed.        //        Results = TRUE;        IoStatus->Status = FsRtlFastUnlockAllByKey( &Fcb->Specific.Fcb.FileLock,                           FileObject,                           ProcessId,                           Key,                           NULL );        //        //  Set the flag indicating if Fast I/O is possible        //        Fcb->Header.IsFastIoPossible = FatIsFastIoPossible( Fcb );try_exit:        NOTHING;    }    finally {        DebugUnwind( FatFastUnlockAllByKey );        ////.........这里部分代码省略.........
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,


示例3: GenerateFileName

NTSTATUS GenerateFileName(IN PFLT_INSTANCE  Instance,    IN PFILE_OBJECT  FileObject,    IN PFLT_CALLBACK_DATA  CallbackData,    IN FLT_FILE_NAME_OPTIONS  NameOptions,    OUT PBOOLEAN  CacheFileNameInformation,    OUT PFLT_NAME_CONTROL  FileName) //上层的minifilter过滤驱动的名字请求进行处理{	NTSTATUS Status = STATUS_UNSUCCESSFUL;	PFILE_OBJECT StreamObject = FileObject;	PFLT_FILE_NAME_INFORMATION FileNameInformation = NULL;	BOOLEAN bEncryptResource = FALSE;	PFCB Fcb = FileObject->FsContext;	PCCB Ccb = FileObject->FsContext2;	FsRtlEnterFileSystem();	try	{		if(IsMyFakeFcb(FileObject))		{						ExAcquireResourceSharedLite(Fcb->EncryptResource,TRUE);			bEncryptResource = TRUE;			if(BooleanFlagOn(Fcb->FcbState,SCB_STATE_SHADOW_CLOSE) || Ccb->StreamFileInfo.StreamObject == NULL)			{				try_return (Status = STATUS_FILE_DELETED);			}			else			{							StreamObject = Ccb->StreamFileInfo.StreamObject;			}		}		ClearFlag(NameOptions,FLT_FILE_NAME_REQUEST_FROM_CURRENT_PROVIDER);		if(FlagOn(NameOptions,FLT_FILE_NAME_NORMALIZED))		{			ClearFlag(NameOptions,FLT_FILE_NAME_NORMALIZED);			SetFlag(NameOptions,FLT_FILE_NAME_OPENED);		}				if (CallbackData) 		{			PFILE_OBJECT TemFileObject = CallbackData->Iopb->TargetFileObject;			CallbackData->Iopb->TargetFileObject = StreamObject;			FltSetCallbackDataDirty(CallbackData);			Status = FltGetFileNameInformation(CallbackData,NameOptions, &FileNameInformation);						CallbackData->Iopb->TargetFileObject = TemFileObject;			FltClearCallbackDataDirty(CallbackData);		} 		else 		{			Status = FltGetFileNameInformationUnsafe(StreamObject,Instance, NameOptions, &FileNameInformation);		}		if(!NT_SUCCESS(Status))		{			try_return (Status);		}		Status = FltCheckAndGrowNameControl(FileName, FileNameInformation->Name.Length);		if(!NT_SUCCESS(Status))		{			try_return (Status);		}		RtlCopyUnicodeString(&FileName->Name, &FileNameInformation->Name);		if(FileNameInformation != NULL)		{			FltReleaseFileNameInformation(FileNameInformation);		}		Status = STATUS_SUCCESS;try_exit: NOTHING;	}	finally	{		if(bEncryptResource)		{			ExReleaseResourceLite( Fcb->EncryptResource );		}	}	FsRtlExitFileSystem();	return Status;}
开发者ID:wyrover,项目名称:X70FSD,代码行数:90,


示例4: UDFVerifyVolume

/*Routine Description:    This routine performs the verify volume operation.  It is responsible for    either completing of enqueuing the input Irp.Arguments:    Irp - Supplies the Irp to processReturn Value:    NTSTATUS - The return status for the operation--*/NTSTATUSUDFVerifyVolume(    IN PIRP Irp    ){    PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );    PVPB Vpb = IrpSp->Parameters.VerifyVolume.Vpb;    PVCB Vcb = (PVCB)IrpSp->Parameters.VerifyVolume.DeviceObject->DeviceExtension;    PVCB NewVcb = NULL;    IO_STATUS_BLOCK Iosb;    ULONG MediaChangeCount = 0;    NTSTATUS RC;    ULONG Mode;    BOOLEAN UnsafeIoctl = (Vcb->VCBFlags & UDF_VCB_FLAGS_UNSAFE_IOCTL) ? TRUE : FALSE;    //  Update the real device in the IrpContext from the Vpb.  There was no available    //  file object when the IrpContext was created.    //    IrpContext->RealDevice = Vpb->RealDevice;    KdPrint(("UDFVerifyVolume:/n"));    //  Acquire shared global access, the termination handler for the    //  following try statement will free the access.    UDFAcquireResourceShared(&(UDFGlobalData.GlobalDataResource),TRUE);    UDFAcquireResourceExclusive(&(Vcb->VCBResource),TRUE);    _SEH2_TRY {        KdPrint(("UDFVerifyVolume: Modified=%d/n", Vcb->Modified));        // Check if the real device still needs to be verified.  If it doesn't        // then obviously someone beat us here and already did the work        // so complete the verify irp with success.  Otherwise reenable        // the real device and get to work.        if( !(Vpb->RealDevice->Flags & DO_VERIFY_VOLUME) &&            ((Vcb->VCBFlags & UDF_VCB_FLAGS_MEDIA_LOCKED) && !UnsafeIoctl) ) {            KdPrint(("UDFVerifyVolume: STATUS_SUCCESS (1)/n"));            try_return(RC = STATUS_SUCCESS);        }        Vcb->VCBFlags &= ~UDF_VCB_FLAGS_UNSAFE_IOCTL;        // Verify that there is a disk here.        RC = UDFPhSendIOCTL( IOCTL_STORAGE_CHECK_VERIFY,                                 Vcb->TargetDeviceObject,                                 NULL,0,                                 &MediaChangeCount,sizeof(ULONG),                                 TRUE,&Iosb );        if(!NT_SUCCESS( RC )) {            // If we will allow a raw mount then return WRONG_VOLUME to            // allow the volume to be mounted by raw.            if(FlagOn( IrpSp->Flags, SL_ALLOW_RAW_MOUNT )) {                KdPrint(("UDFVerifyVolume: STATUS_WRONG_VOLUME (1)/n"));                RC = STATUS_WRONG_VOLUME;            }            if(UDFIsRawDevice(RC)) {                KdPrint(("UDFVerifyVolume: STATUS_WRONG_VOLUME (2)/n"));                RC = STATUS_WRONG_VOLUME;            }            try_return( RC );        }        if(Iosb.Information != sizeof(ULONG)) {            // Be safe about the count in case the driver didn't fill it in            MediaChangeCount = 0;        }        KdPrint(("UDFVerifyVolume: Modified=%d/n", Vcb->Modified));        KdPrint(("UDFVerifyVolume: MediaChangeCount=%x, Vcb->MediaChangeCount=%x, UnsafeIoctl=%x/n",            MediaChangeCount, Vcb->MediaChangeCount, UnsafeIoctl));        // Verify that the device actually saw a change. If the driver does not        // support the MCC, then we must verify the volume in any case.        if(MediaChangeCount == 0 ||            (Vcb->MediaChangeCount != MediaChangeCount) ||           UnsafeIoctl ) {            KdPrint(("UDFVerifyVolume: compare/n"));            NewVcb = (PVCB)MyAllocatePool__(NonPagedPool,sizeof(VCB));            if(!NewVcb)                try_return(RC=STATUS_INSUFFICIENT_RESOURCES);            RtlZeroMemory(NewVcb,sizeof(VCB));            NewVcb->TargetDeviceObject = Vcb->TargetDeviceObject;            NewVcb->Vpb = Vpb;            // Set the removable media flag based on the real device's//.........这里部分代码省略.........
开发者ID:GYGit,项目名称:reactos,代码行数:101,


示例5: FatCheckFileAccess

BOOLEANFatCheckFileAccess (    PIRP_CONTEXT IrpContext,    IN UCHAR DirentAttributes,    IN ULONG DesiredAccess    )/*++Routine Description:    This routine checks if a desired access is allowed to a file represented    by the specified DirentAttriubutes.Arguments:    DirentAttributes - Supplies the Dirent attributes to check access for    DesiredAccess - Supplies the desired access mask that we are checking forReturn Value:    BOOLEAN - TRUE if access is allowed and FALSE otherwise--*/{    BOOLEAN Result;    DebugTrace(+1, Dbg, "FatCheckFileAccess/n", 0);    DebugTrace( 0, Dbg, "DirentAttributes = %8lx/n", DirentAttributes);    DebugTrace( 0, Dbg, "DesiredAccess    = %8lx/n", DesiredAccess);    //    //  This procedures is programmed like a string of filters each    //  filter checks to see if some access is allowed,  if it is not allowed    //  the filter return FALSE to the user without further checks otherwise    //  it moves on to the next filter.  The filter check is to check for    //  desired access flags that are not allowed for a particular dirent    //    Result = TRUE;    try {        //        //  Check for Volume ID or Device Dirents, these are not allowed user        //  access at all        //        if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_VOLUME_ID) ||            FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DEVICE)) {            DebugTrace(0, Dbg, "Cannot access volume id or device/n", 0);            try_return( Result = FALSE );        }        //        //  Check for a directory Dirent or non directory dirent        //        if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DIRECTORY)) {            //            //  check the desired access for directory dirent            //            if (FlagOn(DesiredAccess, ~(DELETE |                                        READ_CONTROL |                                        WRITE_OWNER |                                        WRITE_DAC |                                        SYNCHRONIZE |                                        ACCESS_SYSTEM_SECURITY |                                        FILE_WRITE_DATA |                                        FILE_READ_EA |                                        FILE_WRITE_EA |                                        FILE_READ_ATTRIBUTES |                                        FILE_WRITE_ATTRIBUTES |                                        FILE_LIST_DIRECTORY |                                        FILE_TRAVERSE |                                        FILE_DELETE_CHILD |                                        FILE_APPEND_DATA))) {                DebugTrace(0, Dbg, "Cannot open directory/n", 0);                try_return( Result = FALSE );            }        } else {            //            //  check the desired access for a non-directory dirent, we            //  blackball            //  FILE_LIST_DIRECTORY, FILE_ADD_FILE, FILE_TRAVERSE,            //  FILE_ADD_SUBDIRECTORY, and FILE_DELETE_CHILD            //            if (FlagOn(DesiredAccess, ~(DELETE |                                        READ_CONTROL |//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,


示例6: FatCheckFileAccess

BOOLEANFatCheckFileAccess (    PIRP_CONTEXT IrpContext,    IN UCHAR DirentAttributes,    IN PACCESS_MASK DesiredAccess    )/*++Routine Description:    This routine checks if a desired access is allowed to a file represented    by the specified DirentAttriubutes.Arguments:    DirentAttributes - Supplies the Dirent attributes to check access for    DesiredAccess - Supplies the desired access mask that we are checking forReturn Value:    BOOLEAN - TRUE if access is allowed and FALSE otherwise--*/{    BOOLEAN Result;    DebugTrace(+1, Dbg, "FatCheckFileAccess/n", 0);    DebugTrace( 0, Dbg, "DirentAttributes = %8lx/n", DirentAttributes);    DebugTrace( 0, Dbg, "DesiredAccess    = %8lx/n", *DesiredAccess);    PAGED_CODE();    //    //  This procedures is programmed like a string of filters each    //  filter checks to see if some access is allowed,  if it is not allowed    //  the filter return FALSE to the user without further checks otherwise    //  it moves on to the next filter.  The filter check is to check for    //  desired access flags that are not allowed for a particular dirent    //    Result = TRUE;    _SEH2_TRY {        //        //  Check for Volume ID or Device Dirents, these are not allowed user        //  access at all        //        if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_VOLUME_ID) ||            FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DEVICE)) {            DebugTrace(0, Dbg, "Cannot access volume id or device/n", 0);            try_return( Result = FALSE );        }        //        //  Check the desired access for the object - we only blackball that        //  we do not understand.  The model of filesystems using ACLs is that        //  they do not type the ACL to the object the ACL is on.  Permissions        //  are not checked for consistency vs. the object type - dir/file.        //        if (FlagOn(*DesiredAccess, ~(DELETE |                                     READ_CONTROL |                                     WRITE_OWNER |                                     WRITE_DAC |                                     SYNCHRONIZE |                                     ACCESS_SYSTEM_SECURITY |                                     FILE_WRITE_DATA |                                     FILE_READ_EA |                                     FILE_WRITE_EA |                                     FILE_READ_ATTRIBUTES |                                     FILE_WRITE_ATTRIBUTES |                                     FILE_LIST_DIRECTORY |                                     FILE_TRAVERSE |                                     FILE_DELETE_CHILD |                                     FILE_APPEND_DATA |                                     MAXIMUM_ALLOWED))) {            DebugTrace(0, Dbg, "Cannot open object/n", 0);            try_return( Result = FALSE );        }        //        //  Check for a read-only Dirent        //        if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_READ_ONLY)) {            //            //  Check the desired access for a read-only dirent.  AccessMask will contain            //  the flags we're going to allow.            ////.........这里部分代码省略.........
开发者ID:Moteesh,项目名称:reactos,代码行数:101,


示例7: AFSFlushBuffers

NTSTATUSAFSFlushBuffers( IN PDEVICE_OBJECT LibDeviceObject,                 IN PIRP Irp){    UNREFERENCED_PARAMETER(LibDeviceObject);    AFSDeviceExt *pRDRDevExt = (AFSDeviceExt *) AFSRDRDeviceObject->DeviceExtension;    NTSTATUS           ntStatus = STATUS_SUCCESS;    IO_STACK_LOCATION *pIrpSp = IoGetCurrentIrpStackLocation( Irp);    PFILE_OBJECT       pFileObject = pIrpSp->FileObject;    AFSFcb            *pFcb = (AFSFcb *)pFileObject->FsContext;    AFSCcb            *pCcb = (AFSCcb *)pFileObject->FsContext2;    IO_STATUS_BLOCK    iosb = {0};    BOOLEAN            bReleaseSectionObject = FALSE;    pIrpSp = IoGetCurrentIrpStackLocation( Irp);    __Enter    {        if( pFcb == NULL)        {            AFSDbgTrace(( AFS_SUBSYSTEM_FILE_PROCESSING,                          AFS_TRACE_LEVEL_ERROR,                          "AFSFlushBuffers Attempted access (%p) when pFcb == NULL/n",                          Irp));            try_return( ntStatus = STATUS_INVALID_DEVICE_REQUEST);        }        if( pFcb->Header.NodeTypeCode == AFS_ROOT_FCB ||            pFcb->Header.NodeTypeCode == AFS_ROOT_ALL )        {            //            // Once we support ADS's on directories we need to perform a flush ehre            //            try_return( ntStatus = STATUS_SUCCESS);        }        else if (pFcb->Header.NodeTypeCode != AFS_FILE_FCB)        {            //            // Nothing to flush Everything but files are write through            //            try_return( ntStatus = STATUS_INVALID_PARAMETER);        }	AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING|AFS_SUBSYSTEM_SECTION_OBJECT,                      AFS_TRACE_LEVEL_VERBOSE,                      "AFSFlushBuffers Acquiring Fcb SectionObject lock %p SHARED %08lX/n",                      &pFcb->NPFcb->SectionObjectResource,                      PsGetCurrentThread()));        AFSAcquireShared( &pFcb->NPFcb->SectionObjectResource,                          TRUE);        bReleaseSectionObject = TRUE;        //        // The flush consists of two parts.  We firstly flush our        // cache (if we have one), then we tell the service to write        // to the remote server        //        __try        {            CcFlushCache( &pFcb->NPFcb->SectionObjectPointers, NULL, 0, &iosb);            if (!NT_SUCCESS( iosb.Status ))            {                AFSDbgTrace(( AFS_SUBSYSTEM_IO_PROCESSING,                              AFS_TRACE_LEVEL_ERROR,                              "AFSFlushBuffers CcFlushCache [1] failure FID %08lX-%08lX-%08lX-%08lX Status 0x%08lX Bytes 0x%08lX/n",                              pFcb->ObjectInformation->FileId.Cell,                              pFcb->ObjectInformation->FileId.Volume,                              pFcb->ObjectInformation->FileId.Vnode,                              pFcb->ObjectInformation->FileId.Unique,                              iosb.Status,                              iosb.Information));                try_return( ntStatus = iosb.Status );            }        }	__except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation()))        {            try_return( ntStatus = GetExceptionCode());        }	if( !BooleanFlagOn( pRDRDevExt->DeviceFlags, AFS_DEVICE_FLAG_DIRECT_SERVICE_IO))	{	    AFSDbgTrace(( AFS_SUBSYSTEM_LOCK_PROCESSING|AFS_SUBSYSTEM_SECTION_OBJECT,			  AFS_TRACE_LEVEL_VERBOSE,			  "AFSFlushBuffers Releasing Fcb SectionObject lock %p SHARED %08lX/n",			  &pFcb->NPFcb->SectionObjectResource,//.........这里部分代码省略.........
开发者ID:bagdxk,项目名称:openafs,代码行数:101,


示例8: xixfs_FCBTLBFindPrefix

PXIXFS_LCBxixfs_FCBTLBFindPrefix (    IN PXIXFS_IRPCONTEXT IrpContext,    IN OUT PXIXFS_FCB *CurrentFcb,    IN OUT PUNICODE_STRING RemainingName,	IN BOOLEAN	bIgnoreCase    ){	UNICODE_STRING LocalRemainingName;	UNICODE_STRING FinalName;		PXIXFS_LCB	NameLink;	PXIXFS_LCB	CurrentLcb = NULL;	BOOLEAN		Waitable = FALSE;	PAGED_CODE();	DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_CREATE|DEBUG_TARGET_CLOSE| DEBUG_TARGET_FCB),		("Enter xixfs_FCBTLBFindPrefix /n" ));   	//	//  Check inputs.	//	ASSERT_IRPCONTEXT( IrpContext );	ASSERT_FCB( *CurrentFcb );	ASSERT_EXCLUSIVE_FCB( *CurrentFcb );		Waitable =  XIXCORE_TEST_FLAGS(IrpContext->IrpContextFlags, XIFSD_IRP_CONTEXT_WAIT);	try{		//		//  Make a local copy of the input strings.		//		LocalRemainingName = *RemainingName;		//		//  Loop until we find the longest matching prefix.		//		while (TRUE) {			//			//  If there are no characters left or we are not at an IndexFcb then			//  return immediately.			//			if ((LocalRemainingName.Length == 0) ||				(XifsSafeNodeType( *CurrentFcb ) != XIFS_NODE_FCB)) {				try_return(TRUE); 				// return CurrentLcb;			}			if((*CurrentFcb)->XixcoreFcb.FCBType != FCB_TYPE_DIR){				try_return(TRUE); 				//return CurrentLcb;			}			//			//  Split off the next component from the name.			//			FsRtlDissectName( LocalRemainingName,								&FinalName,								&LocalRemainingName);			//			//  Check if this name is in the splay tree for this Fcb.			//			if(bIgnoreCase){				NameLink = xixfs_NLFindNameLinkIgnoreCase( IrpContext,											&(*CurrentFcb)->IgnoreCaseRoot,											&FinalName );			}else{				NameLink = xixfs_NLFindNameLink( IrpContext,											&(*CurrentFcb)->Root,											&FinalName );			}			//			//  If we didn't find a match then exit.			//			if (NameLink == NULL) { 				break;			}			//			////.........这里部分代码省略.........
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:101,


示例9: NdasFatSecondaryQueryDirectory

//.........这里部分代码省略.........													 &volDo->SessionResource, 													 BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );				if (FlagOn(volDo->Secondary->Thread.Flags, SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED)) {			NDASFAT_ASSERT( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );			SetFlag( IrpContext->NdasFatFlags, NDAS_FAT_IRP_CONTEXT_FLAG_DONT_POST_REQUEST );			FatRaiseStatus( IrpContext, STATUS_CANT_WAIT );		}		queryDirectory.FileIndex			= IrpSp->Parameters.QueryDirectory.FileIndex;		queryDirectory.FileInformationClass = IrpSp->Parameters.QueryDirectory.FileInformationClass;		queryDirectory.FileName				= IrpSp->Parameters.QueryDirectory.FileName;		queryDirectory.Length				= IrpSp->Parameters.QueryDirectory.Length;		inputBuffer			= (queryDirectory.FileName) ? (queryDirectory.FileName->Buffer) : NULL;		inputBufferLength	= (queryDirectory.FileName) ? (queryDirectory.FileName->Length) : 0;		if (queryDirectory.FileName) {			DebugTrace2( 0, Dbg, ("NdNtfsSecondaryQueryDirectory: queryFileName = %wZ/n", queryDirectory.FileName) );		}		ASSERT( inputBufferLength <= volDo->Secondary->Thread.SessionContext.PrimaryMaxDataSize );		ASSERT( UserBufferLength <= volDo->Secondary->Thread.SessionContext.SecondaryMaxDataSize );		secondaryRequest = AllocateWinxpSecondaryRequest( volDo->Secondary, 														  IRP_MJ_DIRECTORY_CONTROL,														  ((inputBufferLength > UserBufferLength) ? inputBufferLength : UserBufferLength) );		if (secondaryRequest == NULL) {			try_return( Status = STATUS_INSUFFICIENT_RESOURCES );		}		ndfsRequestHeader = &secondaryRequest->NdfsRequestHeader;		INITIALIZE_NDFS_REQUEST_HEADER(	ndfsRequestHeader, 										NDFS_COMMAND_EXECUTE, 										volDo->Secondary, 										IRP_MJ_DIRECTORY_CONTROL, 										inputBufferLength );		ndfsWinxpRequestHeader = (PNDFS_WINXP_REQUEST_HEADER)(ndfsRequestHeader+1);		ASSERT( ndfsWinxpRequestHeader == (PNDFS_WINXP_REQUEST_HEADER)secondaryRequest->NdfsRequestData );		INITIALIZE_NDFS_WINXP_REQUEST_HEADER( ndfsWinxpRequestHeader, Irp, IrpSp, Ccb->PrimaryFileHandle );		ndfsWinxpRequestHeader->QueryDirectory.Length				= UserBufferLength;		ndfsWinxpRequestHeader->QueryDirectory.FileInformationClass	= queryDirectory.FileInformationClass;		ndfsWinxpRequestHeader->QueryDirectory.FileIndex			= queryDirectory.FileIndex;		ndfsWinxpRequestData = (_U8 *)(ndfsWinxpRequestHeader+1);		if (inputBufferLength)			RtlCopyMemory( ndfsWinxpRequestData, inputBuffer, inputBufferLength );		secondaryRequest->RequestType = SECONDARY_REQ_SEND_MESSAGE;		QueueingSecondaryRequest( volDo->Secondary, secondaryRequest );		timeOut.QuadPart = -NDASFAT_TIME_OUT;				Status = KeWaitForSingleObject( &secondaryRequest->CompleteEvent, Executive, KernelMode, FALSE, &timeOut );				KeClearEvent( &secondaryRequest->CompleteEvent );		if (Status != STATUS_SUCCESS) {			secondaryRequest = NULL;
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:67,


示例10: MsOpenMailslotRootDirectory

IO_STATUS_BLOCKMsOpenMailslotRootDirectory(    IN PROOT_DCB RootDcb,    IN PFILE_OBJECT FileObject,    IN ACCESS_MASK DesiredAccess,    IN USHORT ShareAccess    ){    IO_STATUS_BLOCK iosb;    PAGED_CODE();    DebugTrace( +1,                Dbg,                "MsOpenMailslotRootDirectory, RootDcb = %08lx/n",                (ULONG)RootDcb);    try {        //        // Set the new share access.        //        if (!NT_SUCCESS(iosb.Status = IoCheckShareAccess(                                          DesiredAccess,                                          ShareAccess,                                          FileObject,                                          &RootDcb->ShareAccess,                                          TRUE ))) {            DebugTrace(0, Dbg, "bad share access/n", 0);            try_return( NOTHING );        }        //        // Supply the file object with a referenced pointer to the root DCB.        //        MsAcquireGlobalLock();        MsReferenceNode( &RootDcb->Header );        MsReleaseGlobalLock();        MsSetFileObject( FileObject,                         RootDcb,                         MsCreateRootDcbCcb() );        //        // Set the return status.        //        iosb.Status = STATUS_SUCCESS;        iosb.Information = FILE_OPENED;    try_exit: NOTHING;    } finally {        DebugTrace(-1, Dbg, "MsOpenMailslotRootDirectory -> iosb.Status = %08lx/n", iosb.Status);    }    //    // Return to the caller.    //    return iosb;}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:67,


示例11: MsOpenMailslotFileSystem

IO_STATUS_BLOCKMsOpenMailslotFileSystem (    IN PVCB Vcb,    IN PFILE_OBJECT FileObject,    IN ACCESS_MASK DesiredAccess,    IN USHORT ShareAccess    ){    IO_STATUS_BLOCK iosb;    PAGED_CODE();    DebugTrace(+1, Dbg, "MsOpenMailslotFileSystem, Vcb = %08lx/n", (ULONG)Vcb);    try {        //        //  Set the new share access        //        if (!NT_SUCCESS(iosb.Status = IoCheckShareAccess( DesiredAccess,                                                       ShareAccess,                                                       FileObject,                                                       &Vcb->ShareAccess,                                                       TRUE ))) {            DebugTrace(0, Dbg, "bad share access/n", 0);            try_return( NOTHING );        }        //        // Supply the file object with a referenced pointer to the VCB.        //        MsAcquireGlobalLock();        MsReferenceNode( &Vcb->Header );        if (Vcb->Header.ReferenceCount == 2) {            //            // Set the driver paging back to normal            //            MmResetDriverPaging(MsOpenMailslotFileSystem);        }        MsReleaseGlobalLock();        MsSetFileObject( FileObject, Vcb, NULL );        //        // Set the return status.        //        iosb.Status = STATUS_SUCCESS;        iosb.Information = FILE_OPENED;    try_exit: NOTHING;    } finally {        DebugTrace(-1, Dbg, "MsOpenMailslotFileSystem -> Iosb.Status = %08lx/n", iosb.Status);    }    //    // Return to the caller.    //    return iosb;}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:66,


示例12: Ext2PassDownSingleReadWriteIRP

NTSTATUS NTAPI Ext2PassDownSingleReadWriteIRP(	PtrExt2IrpContext	PtrIrpContext,	PIRP				PtrIrp, 	PtrExt2VCB			PtrVCB,	LARGE_INTEGER		ByteOffset, 	uint32				ReadWriteLength, 	BOOLEAN				SynchronousIo){	NTSTATUS				RC = STATUS_SUCCESS;	PEXT2_IO_CONTEXT		PtrIoContext = NULL;	PKEVENT					PtrSyncEvent = NULL;	PIO_STACK_LOCATION	PtrIrpNextSp = NULL;	try	{		if( !PtrIrp->MdlAddress )		{			Ext2LockCallersBuffer( PtrIrp, TRUE, ReadWriteLength );		}		if( SynchronousIo )		{			PtrSyncEvent = Ext2AllocatePool( NonPagedPool, Ext2QuadAlign( sizeof(KEVENT) )  );			if ( !PtrSyncEvent )			{				RC = STATUS_INSUFFICIENT_RESOURCES;				try_return();			}			KeInitializeEvent( PtrSyncEvent, SynchronizationEvent, FALSE );		}		//		//	Allocate and initialize a completion context		//		PtrIoContext = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(EXT2_IO_CONTEXT) )  );		if ( !PtrIoContext )		{			RC = STATUS_INSUFFICIENT_RESOURCES;			try_return();		}		RtlZeroMemory( PtrIoContext, sizeof(EXT2_IO_CONTEXT) );		PtrIoContext->Count = 1;		PtrIoContext->NodeIdentifier.NodeType = EXT2_NODE_TYPE_IO_CONTEXT;		PtrIoContext->NodeIdentifier.NodeSize = sizeof( EXT2_IO_CONTEXT );		PtrIoContext->PtrMasterIrp = NULL;		PtrIoContext->PtrSyncEvent = PtrSyncEvent;		PtrIoContext->ReadWriteLength = ReadWriteLength; 		IoSetCompletionRoutine( PtrIrp, 			SynchronousIo ?				Ext2SingleSyncCompletionRoutine: 			Ext2SingleAsyncCompletionRoutine,			PtrIoContext, TRUE, TRUE, TRUE );		//		//  Setup the next IRP stack location in the associated Irp for the disk		//  driver beneath us.		//		PtrIrpNextSp = IoGetNextIrpStackLocation( PtrIrp );		//		//  Setup the Stack location to do a read from the disk driver.		//		PtrIrpNextSp->MajorFunction = PtrIrpContext->MajorFunction;		if( PtrIrpContext->MajorFunction == IRP_MJ_READ )		{			PtrIrpNextSp->Parameters.Read.Length = ReadWriteLength;			PtrIrpNextSp->Parameters.Read.ByteOffset = ByteOffset;		}		else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )		{			PtrIrpNextSp->Parameters.Write.Length = ReadWriteLength;			PtrIrpNextSp->Parameters.Write.ByteOffset = ByteOffset;		}		//		//  Issue the read / write request		//		RC = IoCallDriver(PtrVCB->TargetDeviceObject, PtrIrp);		if( SynchronousIo )		{			//			//	Wait for completion...			//			RC = KeWaitForSingleObject( &PtrIoContext->PtrSyncEvent,						Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );			RC = STATUS_SUCCESS;		}		else		{			RC = STATUS_PENDING;		}		try_exit:	NOTHING;	}//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,


示例13: Ext2PassDownMultiReadWriteIRP

/*************************************************************************** Function: Ext2PassDownMultiReadWriteIRP()** Description:*	pass down multiple read IRPs as Associated IRPs** Expected Interrupt Level (for execution) :**  ?** Return Value: STATUS_SUCCESS / STATUS_PENDING / Error**************************************************************************/NTSTATUS NTAPI Ext2PassDownMultiReadWriteIRP( 	PEXT2_IO_RUN			PtrIoRuns, 	UINT					Count, 	ULONG					TotalReadWriteLength,	PtrExt2IrpContext		PtrIrpContext,	PtrExt2FCB				PtrFCB,	BOOLEAN					SynchronousIo){	PIRP				PtrMasterIrp;	PIRP				PtrAssociatedIrp;    PIO_STACK_LOCATION	PtrIrpSp;    PMDL				PtrMdl;	PtrExt2VCB			PtrVCB;	UINT				i;	ULONG				BufferOffset;	PEXT2_IO_CONTEXT	PtrIoContext = NULL;	PKEVENT				PtrSyncEvent = NULL;	ULONG				LogicalBlockSize;	ULONG				ReadWriteLength;	NTSTATUS RC = STATUS_SUCCESS;	PtrVCB = PtrFCB->PtrVCB;	PtrMasterIrp = PtrIrpContext->Irp;	LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;	try	{		if( !SynchronousIo )		{			IoMarkIrpPending( PtrIrpContext->Irp );			//	We will be returning STATUS_PENDING...		}		if( !PtrMasterIrp->MdlAddress )		{			Ext2LockCallersBuffer( PtrMasterIrp, TRUE, TotalReadWriteLength );		}		if( SynchronousIo )		{			PtrSyncEvent = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(KEVENT) )  );			if ( !PtrSyncEvent )			{				RC = STATUS_INSUFFICIENT_RESOURCES;				try_return();			}			KeInitializeEvent( PtrSyncEvent, SynchronizationEvent, FALSE );		}		//		//	Allocate and initialize a completion context		//		PtrIoContext = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(EXT2_IO_CONTEXT) )  );		if ( !PtrIoContext )		{			RC = STATUS_INSUFFICIENT_RESOURCES;			try_return();		}		RtlZeroMemory( PtrIoContext, sizeof(EXT2_IO_CONTEXT) );		PtrIoContext->Count = Count;		PtrIoContext->NodeIdentifier.NodeType = EXT2_NODE_TYPE_IO_CONTEXT;		PtrIoContext->NodeIdentifier.NodeSize = sizeof( EXT2_IO_CONTEXT );		PtrIoContext->PtrMasterIrp = PtrMasterIrp;		PtrIoContext->PtrSyncEvent = PtrSyncEvent;		PtrIoContext->ReadWriteLength = TotalReadWriteLength;				for( ReadWriteLength = 0, BufferOffset = 0, i = 0; i < Count; i++, BufferOffset += ReadWriteLength )		{						ReadWriteLength = PtrIoRuns[ i].EndOffset - PtrIoRuns[ i].StartOffset;						//			//	Allocating an Associated IRP...			//			PtrAssociatedIrp = IoMakeAssociatedIrp( PtrMasterIrp,					(CCHAR) (PtrVCB->TargetDeviceObject->StackSize + 1 ) );			PtrIoRuns[ i].PtrAssociatedIrp = PtrAssociatedIrp;			ASSERT ( PtrAssociatedIrp );			PtrMasterIrp->AssociatedIrp.IrpCount ++;						//			//	Allocating a Memory Descriptor List...			////.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,


示例14: AFSQueryEA

NTSTATUSAFSQueryEA( IN PDEVICE_OBJECT DeviceObject,            IN PIRP Irp){    NTSTATUS ntStatus = STATUS_EAS_NOT_SUPPORTED;    AFSDeviceExt *pControlDeviceExt = (AFSDeviceExt *)AFSDeviceObject->DeviceExtension;    __try    {        if( DeviceObject == AFSDeviceObject)        {            AFSCompleteRequest( Irp,                                ntStatus);            try_return( ntStatus);        }        //        // Check the state of the library        //        ntStatus = AFSCheckLibraryState( Irp);        if( !NT_SUCCESS( ntStatus) ||            ntStatus == STATUS_PENDING)        {            if( ntStatus != STATUS_PENDING)            {                AFSCompleteRequest( Irp, ntStatus);            }            try_return( ntStatus);        }        IoSkipCurrentIrpStackLocation( Irp);        ntStatus = IoCallDriver( pControlDeviceExt->Specific.Control.LibraryDeviceObject,                                 Irp);        //        // Indicate the library is done with the request        //        AFSClearLibraryRequest();try_exit:        NOTHING;    }    __except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation()) )    {        AFSDbgLogMsg( 0,                      0,                      "EXCEPTION - AFSQueryEA/n");        AFSDumpTraceFilesFnc();    }    return ntStatus;}
开发者ID:jisqyv,项目名称:openafs,代码行数:65,


示例15: AFSWrite

NTSTATUSAFSWrite( IN PDEVICE_OBJECT DeviceObject,          IN PIRP Irp){    NTSTATUS ntStatus = STATUS_SUCCESS;    AFSDeviceExt *pControlDeviceExt = (AFSDeviceExt *)AFSDeviceObject->DeviceExtension;    __try    {        if( DeviceObject == AFSDeviceObject)        {            ntStatus = STATUS_INVALID_DEVICE_REQUEST;            AFSCompleteRequest( Irp,                                ntStatus);            try_return( ntStatus);        }        //        // Check the state of the library        //        ntStatus = AFSCheckLibraryState( Irp);        if( !NT_SUCCESS( ntStatus) ||            ntStatus == STATUS_PENDING)        {            if( ntStatus != STATUS_PENDING)            {                AFSCompleteRequest( Irp, ntStatus);            }            try_return( ntStatus);        }        //        // Increment the outstanding IO count again - this time for the        // completion routine.        //        ntStatus = AFSCheckLibraryState( Irp);        if( !NT_SUCCESS( ntStatus) ||            ntStatus == STATUS_PENDING)        {            AFSClearLibraryRequest();            if( ntStatus != STATUS_PENDING)            {                AFSCompleteRequest( Irp, ntStatus);            }            try_return( ntStatus);        }        //        // And send it down, but arrange to capture the comletion        // so we can free our lock against unloading.        //        IoCopyCurrentIrpStackLocationToNext( Irp);        AFSDbgTrace(( AFS_SUBSYSTEM_IO_PROCESSING,                      AFS_TRACE_LEVEL_VERBOSE,                      "Setting AFSWriteComplete as IoCompletion Routine Irp %p/n",                      Irp));        IoSetCompletionRoutine( Irp, AFSWriteComplete, NULL, TRUE, TRUE, TRUE);        ntStatus = IoCallDriver( pControlDeviceExt->Specific.Control.LibraryDeviceObject,                                 Irp);        //        // Indicate the library/thread pair is done with the request        //        AFSClearLibraryRequest();try_exit:        NOTHING;    }    __except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation()) )    {        ntStatus = STATUS_INSUFFICIENT_RESOURCES;        AFSDumpTraceFilesFnc();    }    return ntStatus;}
开发者ID:bagdxk,项目名称:openafs,代码行数:100,


示例16: FatFastLock

BOOLEANFatFastLock (    IN PFILE_OBJECT FileObject,    IN PLARGE_INTEGER FileOffset,    IN PLARGE_INTEGER Length,    PEPROCESS ProcessId,    ULONG Key,    BOOLEAN FailImmediately,    BOOLEAN ExclusiveLock,    OUT PIO_STATUS_BLOCK IoStatus,    IN PDEVICE_OBJECT DeviceObject)/*++Routine Description:    This is a call back routine for doing the fast lock call.Arguments:    FileObject - Supplies the file object used in this operation    FileOffset - Supplies the file offset used in this operation    Length - Supplies the length used in this operation    ProcessId - Supplies the process ID used in this operation    Key - Supplies the key used in this operation    FailImmediately - Indicates if the request should fail immediately        if the lock cannot be granted.    ExclusiveLock - Indicates if this is a request for an exclusive or        shared lock    IoStatus - Receives the Status if this operation is successfulReturn Value:    BOOLEAN - TRUE if this operation completed and FALSE if caller        needs to take the long route.--*/{    BOOLEAN Results;    PVCB Vcb;    PFCB Fcb;    PCCB Ccb;    DebugTrace(+1, Dbg, "FatFastLock/n", 0);    //    //  Decode the type of file object we're being asked to process and make    //  sure it is only a user file open.    //    if (FatDecodeFileObject( FileObject, &Vcb, &Fcb, &Ccb ) != UserFileOpen) {        IoStatus->Status = STATUS_INVALID_PARAMETER;        IoStatus->Information = 0;        DebugTrace(-1, Dbg, "FatFastLock -> TRUE (STATUS_INVALID_PARAMETER)/n", 0);        return TRUE;    }    //    //  Acquire exclusive access to the Fcb this operation can always wait    //    FsRtlEnterFileSystem();    try {        //        //  We check whether we can proceed        //  based on the state of the file oplocks.        //        if (!FsRtlOplockIsFastIoPossible( &(Fcb)->Specific.Fcb.Oplock )) {            try_return( Results = FALSE );        }        //        //  Now call the FsRtl routine to do the actual processing of the        //  Lock request        //        if (Results = FsRtlFastLock( &Fcb->Specific.Fcb.FileLock,                                     FileObject,                                     FileOffset,                                     Length,                                     ProcessId,                                     Key,                                     FailImmediately,                                     ExclusiveLock,                                     IoStatus,//.........这里部分代码省略.........
开发者ID:derfsubterfuge,项目名称:CSE451,代码行数:101,


示例17: FatCommonClose

//.........这里部分代码省略.........    } else {        SetFlag(Vcb->VcbState, VCB_STATE_FLAG_CLOSE_IN_PROGRESS);        RecursiveClose = FALSE;        //        //  Since we are at the top of the close chain, we need to add        //  a reference to the VCB.  This will keep it from going away        //  on us until we are ready to check for a dismount below.        //        Vcb->OpenFileCount += 1;    }    try {        //        //  Case on the type of open that we are trying to close.        //        switch (TypeOfOpen) {        case VirtualVolumeFile:            DebugTrace(0, Dbg, "Close VirtualVolumeFile/n", 0);            //            //  Remove this internal, residual open from the count.            //            InterlockedDecrement( &(Vcb->InternalOpenCount) );            InterlockedDecrement( &(Vcb->ResidualOpenCount) );            try_return( Status = STATUS_SUCCESS );            break;        case UserVolumeOpen:            DebugTrace(0, Dbg, "Close UserVolumeOpen/n", 0);#if __NDAS_FAT_SECONDARY__			if (Fcb && FlagOn(Fcb->NdasFatFlags, ND_FAT_FCB_FLAG_SECONDARY)) {				volDoCcb = TRUE;				if (FlagOn(Ccb->NdasFatFlags, ND_FAT_CCB_FLAG_UNOPENED)) {					if ( FlagOn(Ccb->NdasFatFlags, ND_FAT_CCB_FLAG_CORRUPTED) )						Fcb->CorruptedCcbCloseCount --;					send2Primary = FALSE;							} else					send2Primary = TRUE;								primaryFileHandle = Ccb->PrimaryFileHandle;				ExAcquireFastMutex( &volDo->Secondary->RecoveryCcbQMutex );				RemoveEntryList( &Ccb->ListEntry );				ExReleaseFastMutex( &volDo->Secondary->RecoveryCcbQMutex );				InitializeListHead( &Ccb->ListEntry );				Ccb->FileObject = NULL;				if (Ccb->Buffer)
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:67,


示例18: FatCommonLockControl

NTSTATUSFatCommonLockControl (    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,


示例19: Ext2MountVolume

//.........这里部分代码省略.........		PtrVPB = IrpSp->Parameters.MountVolume.Vpb;	TargetDeviceObject = IrpSp->Parameters.MountVolume.DeviceObject;		try	{		//		//	1. Reading in Volume meta data		//		//	Temporarily clear the DO_VERIFY_VOLUME Flag		WeClearedVerifyRequiredBit = 0;		if ( Ext2IsFlagOn( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME ) ) 		{            Ext2ClearFlag( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME );            WeClearedVerifyRequiredBit = 1;        }		//	Allocating memory for reading in Boot Sector...		NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), TargetDeviceObject->SectorSize );		BootSector = Ext2AllocatePool( PagedPool, NumberOfBytesToRead  );		RtlZeroMemory( BootSector, NumberOfBytesToRead );		//	Reading in Boot Sector		StartingOffset = 0L;		Ext2PerformVerifyDiskRead ( TargetDeviceObject,			BootSector, StartingOffset, NumberOfBytesToRead );		// Reject a volume that contains fat artifacts				DebugTrace(DEBUG_TRACE_MOUNT, "OEM[%s]", BootSector->Oem);		if (BootSector->Oem[0])		{		    try_return();		}		//	Allocating memory for reading in Super Block...				SuperBlock = Ext2AllocatePool( PagedPool, NumberOfBytesToRead  );		RtlZeroMemory( SuperBlock, NumberOfBytesToRead );		StartingOffset = 1024;		//	Reading in the Super Block...		Ext2PerformVerifyDiskRead ( TargetDeviceObject,			SuperBlock, StartingOffset, NumberOfBytesToRead );		//	Resetting the DO_VERIFY_VOLUME Flag		if( WeClearedVerifyRequiredBit ) 		{			PtrVPB->RealDevice->Flags |= DO_VERIFY_VOLUME;		}		// Verifying the Super Block..		if( SuperBlock->s_magic == EXT2_SUPER_MAGIC )		{			//			//	Found a valid super block.			//	No more tests for now.			//	Assuming that this is an ext2 partition...			//	Going ahead with mount.			//			DebugTrace(DEBUG_TRACE_MOUNT,   "Valid Ext2 partition detected/nMounting %s...", SuperBlock->s_volume_name);			//			//	2. Creating a volume device object			//	        if (!NT_SUCCESS( IoCreateDevice( 
开发者ID:hoangduit,项目名称:reactos,代码行数:67,


示例20: LfsTerminateLogQuery

VOIDLfsTerminateLogQuery (    IN LFS_LOG_HANDLE LogHandle,    IN LFS_LOG_CONTEXT Context    )/*++Routine Description:    This routine is called when a client has completed his query operation    and wishes to deallocate any resources acquired by the Lfs to    perform the log file query.Arguments:    LogHandle - Pointer to private Lfs structure used to identify this                client.    Context - Supplies the address to store a pointer to the Lfs created              context structure.Return Value:    None--*/{    PLCH Lch;    PLfsLCB Lcb;    PLFCB Lfcb;    PAGED_CODE();    LfsDebugTrace( +1, Dbg, "LfsTerminateLogQuery:  Entered/n", 0 );    LfsDebugTrace(  0, Dbg, "Log Handle    -> %08lx/n", LogHandle );    LfsDebugTrace(  0, Dbg, "Context       -> %08lx/n", Context );    Lch = (PLCH) LogHandle;    Lcb = (PLfsLCB) Context;    //    //  Check that the structure is a valid log handle structure.    //    LfsValidateLch( Lch );    //    //  Use a try-finally to facilitate cleanup.    //    try {        //        //  Acquire the log file control block for this log file.        //        LfsAcquireLch( Lch );        Lfcb = Lch->Lfcb;        //        //  If the Log file has been closed then refuse access.        //        if (Lfcb == NULL) {            try_return( NOTHING );        }        //        //  Check that the client Id is valid.        //        LfsValidateClientId( Lfcb, Lch );        //        //  Check that the context structure is valid.        //        LfsValidateLcb( Lcb, Lch );        //        //  Deallocate the context block.        //        LfsDeallocateLcb( Lcb );    try_exit:  NOTHING;    } finally {        DebugUnwind( LfsTerminateLogQuery );        //        //  Release the Lfcb if acquired.        //        LfsReleaseLch( Lch );//.........这里部分代码省略.........
开发者ID:340211173,项目名称:hf-2011,代码行数:101,


示例21: NdasFatSecondaryUserFsCtrl

//.........这里部分代码省略.........	ASSERT( IrpSp->Parameters.FileSystemControl.InputBufferLength ? (inputBuffer != NULL) : (inputBuffer == NULL) );	ASSERT( IrpSp->Parameters.FileSystemControl.OutputBufferLength ? (outputBuffer != NULL) : (outputBuffer == NULL) );	ASSERT( KeGetCurrentIrql() == PASSIVE_LEVEL );	if (!FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {		return FatFsdPostRequest( IrpContext, Irp );	}	try {		secondarySessionResourceAcquired 			= SecondaryAcquireResourceExclusiveLite( IrpContext, 													 &volDo->SessionResource, 													 BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );		if (FlagOn(volDo->Secondary->Thread.Flags, SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED) ) {			PrintIrp( Dbg2, "SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED", NULL, IrpContext->OriginatingIrp );			NDAS_ASSERT( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );			SetFlag( IrpContext->NdasFatFlags, NDAS_FAT_IRP_CONTEXT_FLAG_DONT_POST_REQUEST );			FatRaiseStatus( IrpContext, STATUS_CANT_WAIT );			}		ASSERT( IS_SECONDARY_FILEOBJECT(IrpSp->FileObject) );				typeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &vcb, &fcb, &ccb );		if (FlagOn(ccb->NdasFatFlags, ND_FAT_CCB_FLAG_UNOPENED)) {			ASSERT( FlagOn(ccb->NdasFatFlags, ND_FAT_CCB_FLAG_CORRUPTED) );			try_return( Status = STATUS_FILE_CORRUPT_ERROR );		}				fileSystemControl.FsControlCode			= IrpSp->Parameters.FileSystemControl.FsControlCode;		fileSystemControl.InputBufferLength		= IrpSp->Parameters.FileSystemControl.InputBufferLength;		fileSystemControl.OutputBufferLength	= IrpSp->Parameters.FileSystemControl.OutputBufferLength;		if (inputBuffer == NULL)			fileSystemControl.InputBufferLength = 0;		if (outputBuffer == NULL)			fileSystemControl.OutputBufferLength = 0;		outputBufferLength	= fileSystemControl.OutputBufferLength;				if (fileSystemControl.FsControlCode == FSCTL_MOVE_FILE) {			// 29					inputBufferLength = 0;							} else if (fileSystemControl.FsControlCode == FSCTL_MARK_HANDLE) {		// 63					inputBufferLength = 0;							} else {					inputBufferLength  = fileSystemControl.InputBufferLength;		}				bufferLength = (inputBufferLength >= outputBufferLength) ? inputBufferLength : outputBufferLength;		secondaryRequest = AllocateWinxpSecondaryRequest( volDo->Secondary, 														  IRP_MJ_FILE_SYSTEM_CONTROL,														  bufferLength );
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:66,


示例22: NdNtfsSecondaryCommonSetQuota

NTSTATUSNdNtfsSecondaryCommonSetQuota (    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;	TYPE_OF_OPEN				typeOfOpen;	PVCB						vcb;	PFCB						fcb;	PSCB						scb;	PCCB						ccb;	PSECONDARY_REQUEST			secondaryRequest = NULL;	PNDFS_REQUEST_HEADER		ndfsRequestHeader;	PNDFS_WINXP_REQUEST_HEADER	ndfsWinxpRequestHeader;	PNDFS_WINXP_REPLY_HEADER	ndfsWinxpReplytHeader;	_U8							*ndfsWinxpRequestData;	LARGE_INTEGER				timeOut;	struct SetQuota				setQuota;	PVOID						inputBuffer;	ULONG						inputBufferLength;	ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );	if(volDo->Secondary == NULL) {		status = Irp->IoStatus.Status = STATUS_IO_DEVICE_ERROR;		Irp->IoStatus.Information = 0;		return status;	}	try {		secondarySessionResourceAcquired 			= SecondaryAcquireResourceExclusiveLite( IrpContext, 													 &volDo->Secondary->SessionResource, 													 BooleanFlagOn(IrpContext->State, IRP_CONTEXT_STATE_WAIT) );		if (FlagOn(volDo->Secondary->Thread.Flags, SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED) ) {			PrintIrp( Dbg2, "SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED", NULL, IrpContext->OriginatingIrp );			NtfsRaiseStatus( IrpContext, STATUS_CANT_WAIT, NULL, NULL );			}		typeOfOpen = NtfsDecodeFileObject( IrpContext, fileObject, &vcb, &fcb, &scb, &ccb, TRUE );		if(FlagOn(ccb->NdNtfsFlags, ND_NTFS_CCB_FLAG_UNOPENED)) {			ASSERT( FlagOn(ccb->NdNtfsFlags, ND_NTFS_CCB_FLAG_CORRUPTED) );			try_return( status = STATUS_FILE_CORRUPT_ERROR );		}		setQuota.Length = irpSp->Parameters.SetQuota.Length;		inputBuffer			= NtfsMapUserBuffer( Irp );		inputBufferLength	= setQuota.Length;		secondaryRequest = ALLOC_WINXP_SECONDARY_REQUEST( volDo->Secondary, 														  IRP_MJ_SET_QUOTA,														  inputBufferLength );		if(secondaryRequest == NULL) {			status = Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;			Irp->IoStatus.Information = 0;			try_return( status );		}		ndfsRequestHeader = &secondaryRequest->NdfsRequestHeader;		INITIALIZE_NDFS_REQUEST_HEADER(	ndfsRequestHeader, 									    NDFS_COMMAND_EXECUTE, 										volDo->Secondary, 										IRP_MJ_SET_QUOTA, 										inputBufferLength );		ndfsWinxpRequestHeader = (PNDFS_WINXP_REQUEST_HEADER)(ndfsRequestHeader+1);		ASSERT( ndfsWinxpRequestHeader == (PNDFS_WINXP_REQUEST_HEADER)secondaryRequest->NdfsRequestData );		INITIALIZE_NDFS_WINXP_REQUEST_HEADER( ndfsWinxpRequestHeader, Irp, irpSp, ccb->PrimaryFileHandle );		ndfsWinxpRequestHeader->SetQuota.Length	= inputBufferLength;		ndfsWinxpRequestData = (_U8 *)(ndfsWinxpRequestHeader+1);		RtlCopyMemory(ndfsWinxpRequestData, inputBuffer, inputBufferLength) ;		secondaryRequest->RequestType = SECONDARY_REQ_SEND_MESSAGE;		QueueingSecondaryRequest( volDo->Secondary, secondaryRequest );		timeOut.QuadPart = -NDNTFS_TIME_OUT;		status = KeWaitForSingleObject( &secondaryRequest->CompleteEvent, Executive, KernelMode, FALSE, &timeOut );//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,


示例23: MsCommonCreate

NTSTATUSMsCommonCreate (    IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,    IN PIRP Irp    )/*++Routine Description:    This is the common routine for creating/opening a file.Arguments:    Irp - Supplies the Irp to processReturn Value:    NTSTATUS - the return status for the operation.--*/{    NTSTATUS status;    PIO_STACK_LOCATION irpSp;    PFILE_OBJECT fileObject;    PFILE_OBJECT relatedFileObject;    UNICODE_STRING fileName;    ACCESS_MASK desiredAccess;    USHORT shareAccess;    BOOLEAN caseInsensitive = TRUE; //**** Make all searches case insensitive    PVCB vcb;    PFCB fcb;    UNICODE_STRING remainingPart;    PAGED_CODE();    //    // Make local copies of our input parameters to make things easier.    //    irpSp             = IoGetCurrentIrpStackLocation( Irp );    fileObject        = irpSp->FileObject;    relatedFileObject = irpSp->FileObject->RelatedFileObject;    fileName          = *(PUNICODE_STRING)&irpSp->FileObject->FileName;    desiredAccess     = irpSp->Parameters.Create.SecurityContext->DesiredAccess;    shareAccess       = irpSp->Parameters.Create.ShareAccess;    DebugTrace(+1, Dbg, "MsCommonCreate/n", 0 );    DebugTrace( 0, Dbg, "MsfsDeviceObject  = %08lx/n", (ULONG)MsfsDeviceObject );    DebugTrace( 0, Dbg, "Irp               = %08lx/n", (ULONG)Irp );    DebugTrace( 0, Dbg, "FileObject        = %08lx/n", (ULONG)fileObject );    DebugTrace( 0, Dbg, "relatedFileObject = %08lx/n", (ULONG)relatedFileObject );    DebugTrace( 0, Dbg, "FileName          = %wZ/n",   (ULONG)&fileName );    DebugTrace( 0, Dbg, "DesiredAccess     = %08lx/n", desiredAccess );    DebugTrace( 0, Dbg, "ShareAccess       = %08lx/n", shareAccess );    //    // Get the VCB we are trying to access.    //    vcb = &MsfsDeviceObject->Vcb;    //    // Acquire exclusive access to the VCB.    //    MsAcquireExclusiveVcb( vcb );    try {        //        // Check if we are trying to open the mailslot file system        // (i.e., the Vcb).        //        if ((fileName.Length == 0) &&            ((relatedFileObject == NULL) || (                NodeType(relatedFileObject->FsContext) == MSFS_NTC_VCB))) {            DebugTrace(0, Dbg, "Open mailslot file system/n", 0);            Irp->IoStatus = MsOpenMailslotFileSystem( vcb,                                                      fileObject,                                                      desiredAccess,                                                      shareAccess );            status = Irp->IoStatus.Status;            MsCompleteRequest( Irp, status );            try_return( NOTHING );        }        //        // Check if we are trying to open the root directory.        ////.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:101,



注:本文中的try_return函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ try_val_to_str函数代码示例
C++ try_module_get函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。