mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 17:32:29 -05:00
sys: IRP_MJ_CREATE
This commit is contained in:
parent
b8d4cde102
commit
8c3f912e05
@ -75,7 +75,7 @@ typedef struct
|
|||||||
UINT32 SerialNumber;
|
UINT32 SerialNumber;
|
||||||
UINT32 EaSupported:1; /* supports extended attributes (unimplemented; set to 0) */
|
UINT32 EaSupported:1; /* supports extended attributes (unimplemented; set to 0) */
|
||||||
UINT32 FileNameRequired:1; /* FileName required for all operations (not just Create) */
|
UINT32 FileNameRequired:1; /* FileName required for all operations (not just Create) */
|
||||||
UINT32 NoAccessCheck:1; /* if set the user-mode flie system performs access checks */
|
UINT32 NoSystemAccessCheck:1; /* if set the user-mode flie system performs access checks */
|
||||||
} FSP_FSCTL_VOLUME_PARAMS;
|
} FSP_FSCTL_VOLUME_PARAMS;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = AccessState->SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = AccessState->SecurityDescriptor;
|
||||||
ULONG SecurityDescriptorSize = 0;
|
ULONG SecurityDescriptorSize = 0;
|
||||||
LARGE_INTEGER AllocationSize = Irp->Overlay.AllocationSize;
|
LARGE_INTEGER AllocationSize = Irp->Overlay.AllocationSize;
|
||||||
|
HANDLE AccessToken;
|
||||||
ACCESS_MASK DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
|
ACCESS_MASK DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
|
||||||
USHORT ShareAccess = IrpSp->Parameters.Create.ShareAccess;
|
USHORT ShareAccess = IrpSp->Parameters.Create.ShareAccess;
|
||||||
PFILE_FULL_EA_INFORMATION EaBuffer = Irp->AssociatedIrp.SystemBuffer;
|
PFILE_FULL_EA_INFORMATION EaBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
@ -215,6 +216,8 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
Request->Req.Create.HasTraversePrivilege = HasTraversePrivilege;
|
Request->Req.Create.HasTraversePrivilege = HasTraversePrivilege;
|
||||||
Request->Req.Create.OpenTargetDirectory = BooleanFlagOn(Flags, SL_OPEN_TARGET_DIRECTORY);
|
Request->Req.Create.OpenTargetDirectory = BooleanFlagOn(Flags, SL_OPEN_TARGET_DIRECTORY);
|
||||||
Request->Req.Create.CaseSensitive = BooleanFlagOn(Flags, SL_CASE_SENSITIVE);
|
Request->Req.Create.CaseSensitive = BooleanFlagOn(Flags, SL_CASE_SENSITIVE);
|
||||||
|
|
||||||
|
/* copy the security descriptor into the request */
|
||||||
if (IsAbsoluteSecurityDescriptor)
|
if (IsAbsoluteSecurityDescriptor)
|
||||||
{
|
{
|
||||||
Result = RtlAbsoluteToSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize);
|
Result = RtlAbsoluteToSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize);
|
||||||
@ -230,6 +233,22 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor,
|
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor,
|
||||||
SecurityDescriptor, SecurityDescriptorSize);
|
SecurityDescriptor, SecurityDescriptorSize);
|
||||||
|
|
||||||
|
/* if the user-mode file system is doing access checks, send it the access token */
|
||||||
|
if (FsvrtDeviceExtension->VolumeParams.NoSystemAccessCheck)
|
||||||
|
{
|
||||||
|
Result = ObOpenObjectByPointer(
|
||||||
|
SeQuerySubjectContextToken(&AccessState->SubjectSecurityContext),
|
||||||
|
OBJ_KERNEL_HANDLE, 0, TOKEN_QUERY, 0, KernelMode, &AccessToken);
|
||||||
|
if (!NT_SUCCESS(Result))
|
||||||
|
{
|
||||||
|
FspFileContextDelete(FsContext);
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* send the kernel handle and change it into a process handle at prepare time */
|
||||||
|
Request->Req.Create.AccessToken = (UINT_PTR)AccessToken;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post the IRP to our Ioq; we do this here instead of at FSP_LEAVE_MJ time,
|
* Post the IRP to our Ioq; we do this here instead of at FSP_LEAVE_MJ time,
|
||||||
* so that we can FspFileContextDelete() on failure.
|
* so that we can FspFileContextDelete() on failure.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user