inc, sys, dotnet: FSP_FSCTL_VOLUME_PARAMS::AllowOpenInKernelMode

This commit is contained in:
Bill Zissimopoulos
2018-10-02 11:47:51 -07:00
parent 02a4d3641e
commit 1aab4662e5
4 changed files with 20 additions and 4 deletions

View File

@ -208,6 +208,11 @@ namespace Fsp
get { return 0 != (_VolumeParams.Flags & VolumeParams.DeviceControl); }
set { _VolumeParams.Flags |= (value ? VolumeParams.DeviceControl : 0); }
}
public Boolean AllowOpenInKernelMode
{
get { return 0 != (_VolumeParams.Flags & VolumeParams.AllowOpenInKernelMode); }
set { _VolumeParams.Flags |= (value ? VolumeParams.AllowOpenInKernelMode : 0); }
}
/// <summary>
/// Gets or sets the prefix for a network file system.
/// </summary>

View File

@ -51,6 +51,7 @@ namespace Fsp.Interop
internal const UInt32 DeviceControl = 0x00008000;
internal const UInt32 UmFileContextIsUserContext2 = 0x00010000;
internal const UInt32 UmFileContextIsFullContext = 0x00020000;
internal const UInt32 AllowOpenInKernelMode = 0x01000000;
internal const int PrefixSize = 192;
internal const int FileSystemNameSize = 16;

View File

@ -1897,11 +1897,20 @@ BOOLEAN FspFastIoQueryOpen(
PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FSCTL_FILE_INFO FileInfoBuf;
if (0 != FileObject->RelatedFileObject)
/* sorry, no can do relative opens in here */
DeviceObject = IrpSp->DeviceObject;
if (FspFsvolDeviceExtensionKind != FspDeviceExtension(DeviceObject)->Kind)
FSP_RETURN(Result = FALSE);
Result = FspFileNodeTryGetFileInfoByName(IrpSp->DeviceObject, &FileObject->FileName, &FileInfoBuf);
/* do we allow kernel mode opens? */
if (!FspFsvolDeviceExtension(DeviceObject)->VolumeParams.AllowOpenInKernelMode)
FSP_RETURN(Result = FALSE);
/* is this a relative file open? */
if (0 != FileObject->RelatedFileObject)
FSP_RETURN(Result = FALSE);
Result = FspFileNodeTryGetFileInfoByName(DeviceObject, &FileObject->FileName, &FileInfoBuf);
if (Result)
{
PVOID Buffer = Info;