mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-03 09:22:57 -05:00
sys, dll: extended attributes: checkpoint
This commit is contained in:
@ -278,7 +278,7 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
ACCESS_MASK GrantedAccess = AccessState->PreviouslyGrantedAccess;
|
||||
USHORT ShareAccess = IrpSp->Parameters.Create.ShareAccess;
|
||||
PFILE_FULL_EA_INFORMATION EaBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
//ULONG EaLength = IrpSp->Parameters.Create.EaLength;
|
||||
ULONG EaLength = IrpSp->Parameters.Create.EaLength;
|
||||
ULONG Flags = IrpSp->Flags;
|
||||
KPROCESSOR_MODE RequestorMode =
|
||||
FlagOn(Flags, SL_FORCE_ACCESS_CHECK) ? UserMode : Irp->RequestorMode;
|
||||
@ -302,9 +302,23 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
if (FlagOn(CreateOptions, FILE_OPEN_BY_FILE_ID))
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
/* no EA support currently */
|
||||
/* was an EA buffer specified? */
|
||||
if (0 != EaBuffer)
|
||||
return STATUS_EAS_NOT_SUPPORTED;
|
||||
{
|
||||
/* does the file system support EA? */
|
||||
if (FsvolDeviceExtension->VolumeParams.ExtendedAttributes)
|
||||
return STATUS_EAS_NOT_SUPPORTED;
|
||||
|
||||
/* do we need EA knowledge? */
|
||||
if (FlagOn(CreateOptions, FILE_NO_EA_KNOWLEDGE))
|
||||
return STATUS_ACCESS_DENIED;
|
||||
|
||||
/* is the EA buffer valid? */
|
||||
Irp->IoStatus.Information = 0;
|
||||
Result = IoCheckEaBufferValidity(EaBuffer, EaLength, (PULONG)&Irp->IoStatus.Information);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
}
|
||||
|
||||
/* cannot open a paging file */
|
||||
if (FlagOn(Flags, SL_OPEN_PAGING_FILE))
|
||||
@ -541,6 +555,10 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
SecurityDescriptorSize = 0;
|
||||
FileAttributes = 0;
|
||||
|
||||
/* cannot set EA on named stream */
|
||||
EaBuffer = 0;
|
||||
EaLength = 0;
|
||||
|
||||
/* remember the main file node */
|
||||
ASSERT(0 == FileNode->MainFileNode);
|
||||
FileNode->MainFileNode = FileDesc->MainFileObject->FsContext;
|
||||
@ -558,7 +576,9 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
}
|
||||
|
||||
/* create the user-mode file system request */
|
||||
Result = FspIopCreateRequestEx(Irp, &FileNode->FileName, SecurityDescriptorSize,
|
||||
Result = FspIopCreateRequestEx(Irp, &FileNode->FileName,
|
||||
0 != EaBuffer ?
|
||||
FSP_FSCTL_DEFAULT_ALIGN_UP(SecurityDescriptorSize) + EaLength : SecurityDescriptorSize,
|
||||
FspFsvolCreateRequestFini, &Request);
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
@ -584,19 +604,22 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
FspIopRequestContext(Request, RequestFileDesc) = FileDesc;
|
||||
|
||||
/* populate the Create request */
|
||||
#define NEXTOFS(B) ((B).Offset + FSP_FSCTL_DEFAULT_ALIGN_UP((B).Size))
|
||||
Request->Kind = FspFsctlTransactCreateKind;
|
||||
Request->Req.Create.CreateOptions = CreateOptions;
|
||||
Request->Req.Create.FileAttributes = FileAttributes;
|
||||
Request->Req.Create.SecurityDescriptor.Offset = 0 == SecurityDescriptorSize ? 0 :
|
||||
FSP_FSCTL_DEFAULT_ALIGN_UP(Request->FileName.Size);
|
||||
Request->Req.Create.SecurityDescriptor.Offset = 0 != SecurityDescriptorSize ?
|
||||
NEXTOFS(Request->FileName) : 0;
|
||||
Request->Req.Create.SecurityDescriptor.Size = (UINT16)SecurityDescriptorSize;
|
||||
Request->Req.Create.AllocationSize = AllocationSize;
|
||||
Request->Req.Create.AccessToken = 0;
|
||||
Request->Req.Create.DesiredAccess = DesiredAccess;
|
||||
Request->Req.Create.GrantedAccess = GrantedAccess;
|
||||
Request->Req.Create.ShareAccess = ShareAccess;
|
||||
Request->Req.Create.Ea.Offset = 0;
|
||||
Request->Req.Create.Ea.Size = 0;
|
||||
Request->Req.Create.Ea.Offset = 0 != EaBuffer ?
|
||||
(0 != Request->Req.Create.SecurityDescriptor.Offset ?
|
||||
NEXTOFS(Request->Req.Create.SecurityDescriptor) : NEXTOFS(Request->FileName)) : 0;
|
||||
Request->Req.Create.Ea.Size = 0 != EaBuffer ? (UINT16)EaLength : 0;
|
||||
Request->Req.Create.UserMode = UserMode == RequestorMode;
|
||||
Request->Req.Create.HasTraversePrivilege = HasTraversePrivilege;
|
||||
Request->Req.Create.HasBackupPrivilege = HasBackupPrivilege;
|
||||
@ -605,6 +628,7 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
Request->Req.Create.CaseSensitive = CaseSensitive;
|
||||
Request->Req.Create.HasTrailingBackslash = HasTrailingBackslash;
|
||||
Request->Req.Create.NamedStream = MainFileName.Length;
|
||||
#undef APPEND
|
||||
|
||||
Request->Req.Create.AcceptsSecurityDescriptor = 0 == Request->Req.Create.NamedStream &&
|
||||
!!FsvolDeviceExtension->VolumeParams.AllowOpenInKernelMode;
|
||||
@ -618,6 +642,11 @@ static NTSTATUS FspFsvolCreateNoLock(
|
||||
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor.Offset,
|
||||
SecurityDescriptor, SecurityDescriptorSize);
|
||||
|
||||
/* copy the EA buffer (if any) into the request */
|
||||
if (0 != EaBuffer)
|
||||
RtlCopyMemory(Request->Buffer + Request->Req.Create.Ea.Offset,
|
||||
EaBuffer, EaLength);
|
||||
|
||||
/* fix FileNode->FileName if we are doing SL_OPEN_TARGET_DIRECTORY */
|
||||
if (Request->Req.Create.OpenTargetDirectory)
|
||||
{
|
||||
@ -1081,6 +1110,7 @@ NTSTATUS FspFsvolCreateComplete(
|
||||
}
|
||||
|
||||
PVOID RequestDeviceObjectValue = FspIopRequestContext(Request, RequestDeviceObject);
|
||||
FSP_FSCTL_TRANSACT_BUF Ea = Request->Req.Create.Ea;
|
||||
|
||||
/* disassociate the FileDesc momentarily from the Request */
|
||||
FspIopRequestContext(Request, RequestDeviceObject) = 0;
|
||||
@ -1101,6 +1131,7 @@ NTSTATUS FspFsvolCreateComplete(
|
||||
Request->Req.Overwrite.FileAttributes = FileAttributes;
|
||||
Request->Req.Overwrite.AllocationSize = AllocationSize;
|
||||
Request->Req.Overwrite.Supersede = FILE_SUPERSEDED == Response->IoStatus.Information;
|
||||
Request->Req.Overwrite.Ea = Ea;
|
||||
|
||||
/*
|
||||
* Post it as BestEffort.
|
||||
|
Reference in New Issue
Block a user