mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	sys: create: FspFsvolCreate
Replace FspMainFileOpenCheck with inline code
This commit is contained in:
		| @@ -126,8 +126,32 @@ static NTSTATUS FspFsvolCreate( | ||||
| { | ||||
|     PAGED_CODE(); | ||||
|  | ||||
|     NTSTATUS Result = STATUS_SUCCESS; | ||||
|     BOOLEAN MainFileOpen = FspMainFileOpenCheck(Irp); | ||||
|     NTSTATUS Result; | ||||
|     PECP_LIST ExtraCreateParameters; | ||||
|     PVOID ExtraCreateParameter; | ||||
|     BOOLEAN MainFileOpen = FALSE; | ||||
|  | ||||
|     /* | ||||
|      * Check if the IRP has ECP's. | ||||
|      * | ||||
|      * We do this check for the following reason: | ||||
|      * | ||||
|      *   - To determine whether this is a "main file open", i.e. the opening | ||||
|      *     of the main file for a stream. In this case this is a reentrant open | ||||
|      *     and we should be careful not to try to acquire the rename resource, | ||||
|      *     which is already acquired (otherwise DEADLOCK). | ||||
|      */ | ||||
|     ExtraCreateParameters = 0; | ||||
|     Result = FsRtlGetEcpListFromIrp(Irp, &ExtraCreateParameters); | ||||
|     if (NT_SUCCESS(Result) && 0 != ExtraCreateParameters) | ||||
|     { | ||||
|         ExtraCreateParameter = 0; | ||||
|         MainFileOpen = | ||||
|             NT_SUCCESS(FsRtlFindExtraCreateParameter(ExtraCreateParameters, | ||||
|                 &FspMainFileOpenEcpGuid, &ExtraCreateParameter, 0)) && | ||||
|             0 != ExtraCreateParameter && | ||||
|             !FsRtlIsEcpFromUserMode(ExtraCreateParameter); | ||||
|     } | ||||
|  | ||||
|     if (!MainFileOpen) | ||||
|     { | ||||
|   | ||||
| @@ -1452,28 +1452,6 @@ NTSTATUS FspMainFileOpen( | ||||
| NTSTATUS FspMainFileClose( | ||||
|     HANDLE MainFileHandle, | ||||
|     PFILE_OBJECT MainFileObject); | ||||
| static __forceinline | ||||
| BOOLEAN FspMainFileOpenCheck(PIRP Irp) | ||||
| { | ||||
|     extern const GUID FspMainFileOpenEcpGuid; | ||||
|     NTSTATUS Result; | ||||
|     PECP_LIST ExtraCreateParameters = 0; | ||||
|     PVOID ExtraCreateParameter = 0; | ||||
|  | ||||
|     Result = FsRtlGetEcpListFromIrp(Irp, &ExtraCreateParameters); | ||||
|     if (!NT_SUCCESS(Result) || 0 == ExtraCreateParameters) | ||||
|         return FALSE; | ||||
|  | ||||
|     Result = FsRtlFindExtraCreateParameter(ExtraCreateParameters, | ||||
|         &FspMainFileOpenEcpGuid, &ExtraCreateParameter, 0); | ||||
|     if (!NT_SUCCESS(Result) || 0 == ExtraCreateParameter) | ||||
|         return FALSE; | ||||
|  | ||||
|     if (FsRtlIsEcpFromUserMode(ExtraCreateParameter)) | ||||
|         return FALSE; | ||||
|  | ||||
|     return TRUE; | ||||
| } | ||||
| #define FspFileNodeAcquireShared(N,F)   FspFileNodeAcquireSharedF(N, FspFileNodeAcquire ## F) | ||||
| #define FspFileNodeTryAcquireShared(N,F)    FspFileNodeTryAcquireSharedF(N, FspFileNodeAcquire ## F, FALSE) | ||||
| #define FspFileNodeAcquireExclusive(N,F)    FspFileNodeAcquireExclusiveF(N, FspFileNodeAcquire ## F) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user