[CDFS_NEW] Use CdAcquireForCreateSection from the old driver in place of the newer CdFilterCallbackAcquireForCreateSection.

This commit is contained in:
David Quintana 2017-11-24 17:27:46 +01:00
parent 13ff373b80
commit 8410d03275
3 changed files with 68 additions and 0 deletions

View file

@ -191,7 +191,9 @@ Return Value:
sizeof(FS_FILTER_CALLBACKS) ); sizeof(FS_FILTER_CALLBACKS) );
FilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS); FilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
#ifndef __REACTOS__
FilterCallbacks.PreAcquireForSectionSynchronization = CdFilterCallbackAcquireForCreateSection; FilterCallbacks.PreAcquireForSectionSynchronization = CdFilterCallbackAcquireForCreateSection;
#endif
Status = FsRtlRegisterFileSystemFilterCallbacks( DriverObject, Status = FsRtlRegisterFileSystemFilterCallbacks( DriverObject,
&FilterCallbacks ); &FilterCallbacks );
@ -357,11 +359,15 @@ Return Value:
CdFastIoDispatch.FastIoUnlockSingle = CdFastUnlockSingle; // UnlockSingle CdFastIoDispatch.FastIoUnlockSingle = CdFastUnlockSingle; // UnlockSingle
CdFastIoDispatch.FastIoUnlockAll = CdFastUnlockAll; // UnlockAll CdFastIoDispatch.FastIoUnlockAll = CdFastUnlockAll; // UnlockAll
CdFastIoDispatch.FastIoUnlockAllByKey = CdFastUnlockAllByKey; // UnlockAllByKey CdFastIoDispatch.FastIoUnlockAllByKey = CdFastUnlockAllByKey; // UnlockAllByKey
#ifndef __REACTOS__
// //
// This callback has been replaced by CdFilterCallbackAcquireForCreateSection. // This callback has been replaced by CdFilterCallbackAcquireForCreateSection.
// //
CdFastIoDispatch.AcquireFileForNtCreateSection = NULL; CdFastIoDispatch.AcquireFileForNtCreateSection = NULL;
#else
CdFastIoDispatch.AcquireFileForNtCreateSection = CdAcquireForCreateSection;
#endif
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection; CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo

View file

@ -1121,6 +1121,7 @@ CdReleaseFromCache (
_Inout_ PFCB Fcb _Inout_ PFCB Fcb
); );
#ifndef __REACTOS__
_Requires_lock_held_(_Global_critical_region_) _Requires_lock_held_(_Global_critical_region_)
NTSTATUS NTSTATUS
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
@ -1128,6 +1129,13 @@ CdFilterCallbackAcquireForCreateSection (
_In_ PFS_FILTER_CALLBACK_DATA CallbackData, _In_ PFS_FILTER_CALLBACK_DATA CallbackData,
_Unreferenced_parameter_ PVOID *CompletionContext _Unreferenced_parameter_ PVOID *CompletionContext
); );
#else
VOID
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
CdAcquireForCreateSection (
IN PFILE_OBJECT FileObject
);
#endif
_Function_class_(FAST_IO_RELEASE_FILE) _Function_class_(FAST_IO_RELEASE_FILE)
_Requires_lock_held_(_Global_critical_region_) _Requires_lock_held_(_Global_critical_region_)

View file

@ -23,7 +23,11 @@ Abstract:
#ifdef ALLOC_PRAGMA #ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, CdAcquireForCache) #pragma alloc_text(PAGE, CdAcquireForCache)
#ifndef __REACTOS__
#pragma alloc_text(PAGE, CdFilterCallbackAcquireForCreateSection) #pragma alloc_text(PAGE, CdFilterCallbackAcquireForCreateSection)
#else
#pragma alloc_text(PAGE, CdAcquireForCreateSection)
#endif
#pragma alloc_text(PAGE, CdAcquireResource) #pragma alloc_text(PAGE, CdAcquireResource)
#pragma alloc_text(PAGE, CdNoopAcquire) #pragma alloc_text(PAGE, CdNoopAcquire)
#pragma alloc_text(PAGE, CdNoopRelease) #pragma alloc_text(PAGE, CdNoopRelease)
@ -274,6 +278,7 @@ Return Value:
} }
#ifndef __REACTOS__
_Requires_lock_held_(_Global_critical_region_) _Requires_lock_held_(_Global_critical_region_)
NTSTATUS NTSTATUS
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */ NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
@ -356,6 +361,55 @@ Return Value:
UNREFERENCED_PARAMETER( CompletionContext ); UNREFERENCED_PARAMETER( CompletionContext );
} }
#else
VOID
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
CdAcquireForCreateSection (
IN PFILE_OBJECT FileObject
)
/*++
Routine Description:
This is the callback routine for MM to use to acquire the file exclusively.
Arguments:
FileObject - File object for a Cdfs stream.
Return Value:
None
--*/
{
PAGED_CODE();
//
// Get the Fcb resource exclusively.
//
ExAcquireResourceExclusiveLite( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource,
TRUE );
//
// Take the File resource shared. We need this later on when MM calls
// QueryStandardInfo to get the file size.
//
// If we don't use StarveExclusive, then we can get wedged behind an
// exclusive waiter who is waiting on someone else holding it shared in the
// read->initializecachemap path (which calls createsection) who is in turn
// waiting on us to finish the create section.
//
ExAcquireSharedStarveExclusive( ((PFCB) FileObject->FsContext)->Resource,
TRUE );
}
#endif
_Function_class_(FAST_IO_RELEASE_FILE) _Function_class_(FAST_IO_RELEASE_FILE)