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
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
4 changed files with 20 additions and 4 deletions

View File

@ -166,7 +166,8 @@ enum
UINT32 UmFileContextIsFullContext:1; /* user mode: FileContext parameter is FullContext */\ UINT32 UmFileContextIsFullContext:1; /* user mode: FileContext parameter is FullContext */\
UINT32 UmReservedFlags:6;\ UINT32 UmReservedFlags:6;\
/* additional kernel-mode flags */\ /* additional kernel-mode flags */\
UINT32 KmReservedFlags:8;\ UINT32 AllowOpenInKernelMode:1; /* allow kernel mode to open files when possible */\
UINT32 KmReservedFlags:7;\
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\ WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */\
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)]; WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
#define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN\ #define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN\

View File

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

View File

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

View File

@ -1897,11 +1897,20 @@ BOOLEAN FspFastIoQueryOpen(
PFILE_OBJECT FileObject = IrpSp->FileObject; PFILE_OBJECT FileObject = IrpSp->FileObject;
FSP_FSCTL_FILE_INFO FileInfoBuf; FSP_FSCTL_FILE_INFO FileInfoBuf;
if (0 != FileObject->RelatedFileObject) DeviceObject = IrpSp->DeviceObject;
/* sorry, no can do relative opens in here */
if (FspFsvolDeviceExtensionKind != FspDeviceExtension(DeviceObject)->Kind)
FSP_RETURN(Result = FALSE); 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) if (Result)
{ {
PVOID Buffer = Info; PVOID Buffer = Info;