mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-11-04 04:58:05 -06:00 
			
		
		
		
	sys: create: FspFsvolCreate
Only check reparse point ECP if running on OS prior to RS4
This commit is contained in:
		@@ -169,46 +169,49 @@ static NTSTATUS FspFsvolCreate(
 | 
				
			|||||||
            !FsRtlIsEcpFromUserMode(ExtraCreateParameter);
 | 
					            !FsRtlIsEcpFromUserMode(ExtraCreateParameter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(FSP_CREATE_REPARSE_POINT_ECP)
 | 
					#if defined(FSP_CREATE_REPARSE_POINT_ECP)
 | 
				
			||||||
        // {73d5118a-88ba-439f-92f4-46d38952d250}
 | 
					        if (!HasReparsePointCaseSensitivityFix)
 | 
				
			||||||
        static const GUID FspReparsePointEcpGuid =
 | 
					 | 
				
			||||||
            { 0x73d5118a, 0x88ba, 0x439f, { 0x92, 0xf4, 0x46, 0xd3, 0x89, 0x52, 0xd2, 0x50 } };
 | 
					 | 
				
			||||||
        typedef struct _REPARSE_POINT_ECP
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            USHORT UnparsedNameLength;
 | 
					            // {73d5118a-88ba-439f-92f4-46d38952d250}
 | 
				
			||||||
            USHORT Flags;
 | 
					            static const GUID FspReparsePointEcpGuid =
 | 
				
			||||||
            USHORT DeviceNameLength;
 | 
					                { 0x73d5118a, 0x88ba, 0x439f, { 0x92, 0xf4, 0x46, 0xd3, 0x89, 0x52, 0xd2, 0x50 } };
 | 
				
			||||||
            PVOID Reserved;
 | 
					            typedef struct _REPARSE_POINT_ECP
 | 
				
			||||||
            UNICODE_STRING Name;
 | 
					 | 
				
			||||||
        } REPARSE_POINT_ECP;
 | 
					 | 
				
			||||||
        REPARSE_POINT_ECP *ReparsePointEcp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ExtraCreateParameter = 0;
 | 
					 | 
				
			||||||
        ReparsePointEcp =
 | 
					 | 
				
			||||||
            NT_SUCCESS(FsRtlFindExtraCreateParameter(ExtraCreateParameters,
 | 
					 | 
				
			||||||
                &FspReparsePointEcpGuid, &ExtraCreateParameter, 0)) &&
 | 
					 | 
				
			||||||
            0 != ExtraCreateParameter &&
 | 
					 | 
				
			||||||
            !FsRtlIsEcpFromUserMode(ExtraCreateParameter) ?
 | 
					 | 
				
			||||||
                ExtraCreateParameter : 0;
 | 
					 | 
				
			||||||
        if (0 != ReparsePointEcp)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            //DEBUGLOG("%hu %wZ", ReparsePointEcp->UnparsedNameLength, ReparsePointEcp->Name);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            UNICODE_STRING FileName = IrpSp->FileObject->FileName;
 | 
					 | 
				
			||||||
            if (0 != ReparsePointEcp->UnparsedNameLength &&
 | 
					 | 
				
			||||||
                FileName.Length == ReparsePointEcp->UnparsedNameLength &&
 | 
					 | 
				
			||||||
                ReparsePointEcp->Name.Length > ReparsePointEcp->UnparsedNameLength)
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                /*
 | 
					                USHORT UnparsedNameLength;
 | 
				
			||||||
                 * If the ReparsePointEcp name and our file name differ only in case,
 | 
					                USHORT Flags;
 | 
				
			||||||
                 * go ahead and overwrite our file name.
 | 
					                USHORT DeviceNameLength;
 | 
				
			||||||
                 */
 | 
					                PVOID Reserved;
 | 
				
			||||||
 | 
					                UNICODE_STRING Name;
 | 
				
			||||||
 | 
					            } REPARSE_POINT_ECP;
 | 
				
			||||||
 | 
					            REPARSE_POINT_ECP *ReparsePointEcp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                UNICODE_STRING UnparsedName;
 | 
					            ExtraCreateParameter = 0;
 | 
				
			||||||
                UnparsedName.Length = UnparsedName.MaximumLength = ReparsePointEcp->UnparsedNameLength;
 | 
					            ReparsePointEcp =
 | 
				
			||||||
                UnparsedName.Buffer = (PWCH)((UINT8 *)ReparsePointEcp->Name.Buffer +
 | 
					                NT_SUCCESS(FsRtlFindExtraCreateParameter(ExtraCreateParameters,
 | 
				
			||||||
                    (ReparsePointEcp->Name.Length - UnparsedName.Length));
 | 
					                    &FspReparsePointEcpGuid, &ExtraCreateParameter, 0)) &&
 | 
				
			||||||
                if (0 == FspFileNameCompare(&UnparsedName, &FileName, TRUE, 0))
 | 
					                0 != ExtraCreateParameter &&
 | 
				
			||||||
                    RtlMoveMemory(FileName.Buffer, UnparsedName.Buffer, UnparsedName.Length);
 | 
					                !FsRtlIsEcpFromUserMode(ExtraCreateParameter) ?
 | 
				
			||||||
 | 
					                    ExtraCreateParameter : 0;
 | 
				
			||||||
 | 
					            if (0 != ReparsePointEcp)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //DEBUGLOG("%hu %wZ", ReparsePointEcp->UnparsedNameLength, ReparsePointEcp->Name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                UNICODE_STRING FileName = IrpSp->FileObject->FileName;
 | 
				
			||||||
 | 
					                if (0 != ReparsePointEcp->UnparsedNameLength &&
 | 
				
			||||||
 | 
					                    FileName.Length == ReparsePointEcp->UnparsedNameLength &&
 | 
				
			||||||
 | 
					                    ReparsePointEcp->Name.Length > ReparsePointEcp->UnparsedNameLength)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    /*
 | 
				
			||||||
 | 
					                     * If the ReparsePointEcp name and our file name differ only in case,
 | 
				
			||||||
 | 
					                     * go ahead and overwrite our file name.
 | 
				
			||||||
 | 
					                     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    UNICODE_STRING UnparsedName;
 | 
				
			||||||
 | 
					                    UnparsedName.Length = UnparsedName.MaximumLength = ReparsePointEcp->UnparsedNameLength;
 | 
				
			||||||
 | 
					                    UnparsedName.Buffer = (PWCH)((UINT8 *)ReparsePointEcp->Name.Buffer +
 | 
				
			||||||
 | 
					                        (ReparsePointEcp->Name.Length - UnparsedName.Length));
 | 
				
			||||||
 | 
					                    if (0 == FspFileNameCompare(&UnparsedName, &FileName, TRUE, 0))
 | 
				
			||||||
 | 
					                        RtlMoveMemory(FileName.Buffer, UnparsedName.Buffer, UnparsedName.Length);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -233,6 +233,9 @@ static VOID FspDriverMultiVersionInitialize(VOID)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN8))
 | 
					    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN8))
 | 
				
			||||||
        FspMvMdlMappingNoWrite = MdlMappingNoWrite;
 | 
					        FspMvMdlMappingNoWrite = MdlMappingNoWrite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (RtlIsNtDdiVersionAvailable(0x0A000005/*NTDDI_WIN10_RS4*/))
 | 
				
			||||||
 | 
					        HasReparsePointCaseSensitivityFix = TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(FSP_UNLOAD)
 | 
					#if defined(FSP_UNLOAD)
 | 
				
			||||||
@@ -270,3 +273,4 @@ CACHE_MANAGER_CALLBACKS FspCacheManagerCallbacks;
 | 
				
			|||||||
ULONG FspProcessorCount;
 | 
					ULONG FspProcessorCount;
 | 
				
			||||||
FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
 | 
					FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
 | 
				
			||||||
ULONG FspMvMdlMappingNoWrite = 0;
 | 
					ULONG FspMvMdlMappingNoWrite = 0;
 | 
				
			||||||
 | 
					BOOLEAN HasReparsePointCaseSensitivityFix = FALSE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1577,6 +1577,7 @@ extern const GUID FspMainFileOpenEcpGuid;
 | 
				
			|||||||
extern ULONG FspProcessorCount;
 | 
					extern ULONG FspProcessorCount;
 | 
				
			||||||
extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
 | 
					extern FSP_MV_CcCoherencyFlushAndPurgeCache *FspMvCcCoherencyFlushAndPurgeCache;
 | 
				
			||||||
extern ULONG FspMvMdlMappingNoWrite;
 | 
					extern ULONG FspMvMdlMappingNoWrite;
 | 
				
			||||||
 | 
					extern BOOLEAN HasReparsePointCaseSensitivityFix;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Fixes
 | 
					 * Fixes
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user