mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
sys: FILE_ATTRIBUTE_DIRECTORY support
This commit is contained in:
parent
86bccd763c
commit
299605b8fc
@ -216,6 +216,12 @@ static NTSTATUS FspFsvolCreateNoLock(
|
|||||||
FlagOn(CreateOptions, FILE_DIRECTORY_FILE))
|
FlagOn(CreateOptions, FILE_DIRECTORY_FILE))
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
/* do not allow the temporary bit on a directory */
|
||||||
|
if (FlagOn(CreateOptions, FILE_DIRECTORY_FILE) &&
|
||||||
|
FlagOn(FileAttributes, FILE_ATTRIBUTE_TEMPORARY) &&
|
||||||
|
(FILE_CREATE == CreateDisposition || FILE_OPEN_IF == CreateDisposition))
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
/* check security descriptor validity */
|
/* check security descriptor validity */
|
||||||
if (0 != SecurityDescriptor)
|
if (0 != SecurityDescriptor)
|
||||||
{
|
{
|
||||||
@ -901,6 +907,13 @@ NTSTATUS FspFsvolCreateComplete(
|
|||||||
FileObject->PrivateCacheMap = 0;
|
FileObject->PrivateCacheMap = 0;
|
||||||
FileObject->FsContext = FileNode;
|
FileObject->FsContext = FileNode;
|
||||||
FileObject->FsContext2 = FileDesc;
|
FileObject->FsContext2 = FileDesc;
|
||||||
|
if (!FileNode->IsDirectory)
|
||||||
|
{
|
||||||
|
/* properly set temporary bit for lazy writer */
|
||||||
|
if (FlagOn(Response->Rsp.Create.Opened.FileInfo.FileAttributes,
|
||||||
|
FILE_ATTRIBUTE_TEMPORARY))
|
||||||
|
SetFlag(FileObject->Flags, FO_TEMPORARY_FILE);
|
||||||
|
}
|
||||||
if (FspTimeoutInfinity32 == FsvolDeviceExtension->VolumeParams.FileInfoTimeout &&
|
if (FspTimeoutInfinity32 == FsvolDeviceExtension->VolumeParams.FileInfoTimeout &&
|
||||||
!FlagOn(IrpSp->Parameters.Create.Options, FILE_NO_INTERMEDIATE_BUFFERING) &&
|
!FlagOn(IrpSp->Parameters.Create.Options, FILE_NO_INTERMEDIATE_BUFFERING) &&
|
||||||
!Response->Rsp.Create.Opened.DisableCache)
|
!Response->Rsp.Create.Opened.DisableCache)
|
||||||
|
@ -915,6 +915,15 @@ static NTSTATUS FspFsvolSetBasicInformation(PFILE_OBJECT FileObject,
|
|||||||
{
|
{
|
||||||
if (sizeof(FILE_BASIC_INFORMATION) > Length)
|
if (sizeof(FILE_BASIC_INFORMATION) > Length)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
PFILE_BASIC_INFORMATION Info = (PFILE_BASIC_INFORMATION)Buffer;
|
||||||
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
|
UINT32 FileAttributes = Info->FileAttributes;
|
||||||
|
|
||||||
|
/* do not allow the temporary bit on a directory */
|
||||||
|
if (FileNode->IsDirectory &&
|
||||||
|
FlagOn(FileAttributes, FILE_ATTRIBUTE_TEMPORARY))
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
else if (0 == Response)
|
else if (0 == Response)
|
||||||
{
|
{
|
||||||
@ -941,6 +950,16 @@ static NTSTATUS FspFsvolSetBasicInformation(PFILE_OBJECT FileObject,
|
|||||||
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
FSP_FILE_NODE *FileNode = FileObject->FsContext;
|
||||||
ULONG NotifyFilter = 0;
|
ULONG NotifyFilter = 0;
|
||||||
|
|
||||||
|
if (!FileNode->IsDirectory)
|
||||||
|
{
|
||||||
|
/* properly set temporary bit for lazy writer */
|
||||||
|
if (FlagOn(Response->Rsp.SetInformation.FileInfo.FileAttributes,
|
||||||
|
FILE_ATTRIBUTE_TEMPORARY))
|
||||||
|
SetFlag(FileObject->Flags, FO_TEMPORARY_FILE);
|
||||||
|
else
|
||||||
|
ClearFlag(FileObject->Flags, FO_TEMPORARY_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.SetInformation.FileInfo);
|
FspFileNodeSetFileInfo(FileNode, FileObject, &Response->Rsp.SetInformation.FileInfo);
|
||||||
|
|
||||||
if ((UINT32)-1 != Request->Req.SetInformation.Info.Basic.FileAttributes)
|
if ((UINT32)-1 != Request->Req.SetInformation.Info.Basic.FileAttributes)
|
||||||
|
@ -200,6 +200,16 @@ void create_dotest(ULONG Flags, PWSTR Prefix)
|
|||||||
CloseHandle(Handle);
|
CloseHandle(Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0",
|
||||||
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
|
Handle = CreateFileW(FilePath,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
|
||||||
|
CREATE_NEW, FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||||
|
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||||
|
CloseHandle(Handle);
|
||||||
|
|
||||||
memfs_stop(memfs);
|
memfs_stop(memfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user