sys: hardcode AlwaysUseDoubleBuffering for Reads

This commit is contained in:
Bill Zissimopoulos 2017-02-25 11:22:22 -08:00
parent 6774c34422
commit 4c0386bf8d
2 changed files with 12 additions and 4 deletions

View File

@ -1139,12 +1139,10 @@ BOOLEAN FspWriteIrpShouldUseProcessBuffer(PIRP Irp, SIZE_T BufferSize)
{
ASSERT(0 != Irp);
#if DBG
return DEBUGTEST(50) ||
return DEBUGTEST(50);
#else
return FspProcessBufferSizeMax >= BufferSize ||
return FspProcessBufferSizeMax >= BufferSize;
#endif
FspFsvolDeviceExtension(IoGetCurrentIrpStackLocation(Irp)->DeviceObject)->
VolumeParams.AlwaysUseDoubleBuffering;
}
static inline
BOOLEAN FspQueryDirectoryIrpShouldUseProcessBuffer(PIRP Irp, SIZE_T BufferSize)

View File

@ -171,6 +171,16 @@ static NTSTATUS FspVolumeCreateNoLock(
}
VolumeParams.FileSystemName[sizeof VolumeParams.FileSystemName / sizeof(WCHAR) - 1] = L'\0';
#if !DBG
/*
* In Release builds we hardcode AlwaysUseDoubleBuffering for Reads as we do not want someone
* to use WinFsp to crash Windows.
*
* See http://www.osronline.com/showthread.cfm?link=282037
*/
VolumeParams.AlwaysUseDoubleBuffering = 1;
#endif
/* create volume guid */
Result = FspCreateGuid(&Guid);
if (!NT_SUCCESS(Result))