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
684a594385
commit
1f0942a100
@ -78,6 +78,11 @@ typedef struct
|
|||||||
UINT32 NoSystemAccessCheck: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
|
||||||
|
{
|
||||||
|
UINT16 Offset;
|
||||||
|
UINT16 Size;
|
||||||
|
} FSP_FSCTL_TRANSACT_BUF;
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT16 Version;
|
UINT16 Version;
|
||||||
UINT16 Size;
|
UINT16 Size;
|
||||||
@ -90,8 +95,7 @@ typedef struct
|
|||||||
UINT32 CreateDisposition; /* FILE_{SUPERSEDE,CREATE,OPEN,OPEN_IF,OVERWRITE,OVERWRITE_IF} */
|
UINT32 CreateDisposition; /* FILE_{SUPERSEDE,CREATE,OPEN,OPEN_IF,OVERWRITE,OVERWRITE_IF} */
|
||||||
UINT32 CreateOptions; /* FILE_{DIRECTORY_FILE,NON_DIRECTORY_FILE,etc.} */
|
UINT32 CreateOptions; /* FILE_{DIRECTORY_FILE,NON_DIRECTORY_FILE,etc.} */
|
||||||
UINT32 FileAttributes; /* FILE_ATTRIBUTE_{NORMAL,DIRECTORY,etc.} */
|
UINT32 FileAttributes; /* FILE_ATTRIBUTE_{NORMAL,DIRECTORY,etc.} */
|
||||||
UINT16 SecurityDescriptor; /* security descriptor for new files (offset within Buffer) */
|
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor for new files */
|
||||||
UINT16 SecurityDescriptorSize; /* security descriptor size */
|
|
||||||
UINT64 AllocationSize; /* initial allocation size */
|
UINT64 AllocationSize; /* initial allocation size */
|
||||||
UINT64 AccessToken; /* (HANDLE); request access token; sent if NoAccessCheck is 0 */
|
UINT64 AccessToken; /* (HANDLE); request access token; sent if NoAccessCheck is 0 */
|
||||||
UINT32 DesiredAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
|
UINT32 DesiredAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
|
||||||
@ -114,6 +118,7 @@ typedef struct
|
|||||||
UINT64 UserContext2;
|
UINT64 UserContext2;
|
||||||
} Close;
|
} Close;
|
||||||
} Req;
|
} Req;
|
||||||
|
FSP_FSCTL_TRANSACT_BUF FileName;
|
||||||
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
||||||
} FSP_FSCTL_TRANSACT_REQ;
|
} FSP_FSCTL_TRANSACT_REQ;
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -134,8 +139,11 @@ typedef struct
|
|||||||
UINT64 UserContext; /* user context attached to an open file (unique file id) */
|
UINT64 UserContext; /* user context attached to an open file (unique file id) */
|
||||||
UINT64 UserContext2; /* user context attached to a kernel file object */
|
UINT64 UserContext2; /* user context attached to a kernel file object */
|
||||||
/* (only low 32 bits valid in 32-bit mode) */
|
/* (only low 32 bits valid in 32-bit mode) */
|
||||||
UINT16 SecurityDescriptor; /* security descriptor for existing files (offset within Buffer) */
|
union
|
||||||
UINT16 SecurityDescriptorSize; /* security descriptor size */
|
{
|
||||||
|
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor for existing files */
|
||||||
|
FSP_FSCTL_TRANSACT_BUF ReparseFileName; /* file name to use for STATUS_REPARSE */
|
||||||
|
} Buf;
|
||||||
} Create;
|
} Create;
|
||||||
} Rsp;
|
} Rsp;
|
||||||
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
||||||
|
@ -241,12 +241,14 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
|
|
||||||
/* populate the Create request */
|
/* populate the Create request */
|
||||||
Request->Kind = FspFsctlTransactCreateKind;
|
Request->Kind = FspFsctlTransactCreateKind;
|
||||||
|
Request->FileName.Offset = 0;
|
||||||
|
Request->FileName.Size = FsContext->FileName.Length + sizeof(WCHAR);
|
||||||
Request->Req.Create.CreateDisposition = CreateDisposition;
|
Request->Req.Create.CreateDisposition = CreateDisposition;
|
||||||
Request->Req.Create.CreateOptions = CreateOptions;
|
Request->Req.Create.CreateOptions = CreateOptions;
|
||||||
Request->Req.Create.FileAttributes = FileAttributes;
|
Request->Req.Create.FileAttributes = FileAttributes;
|
||||||
Request->Req.Create.SecurityDescriptor = 0 == SecurityDescriptor ? 0 :
|
Request->Req.Create.SecurityDescriptor.Offset = 0 == SecurityDescriptorSize ? 0 :
|
||||||
FSP_FSCTL_DEFAULT_ALIGN_UP(FsContext->FileName.Length + sizeof(WCHAR));
|
FSP_FSCTL_DEFAULT_ALIGN_UP(Request->FileName.Size);
|
||||||
Request->Req.Create.SecurityDescriptorSize = (UINT16)SecurityDescriptorSize;
|
Request->Req.Create.SecurityDescriptor.Size = (UINT16)SecurityDescriptorSize;
|
||||||
Request->Req.Create.AllocationSize = AllocationSize.QuadPart;
|
Request->Req.Create.AllocationSize = AllocationSize.QuadPart;
|
||||||
Request->Req.Create.AccessToken = 0;
|
Request->Req.Create.AccessToken = 0;
|
||||||
Request->Req.Create.DesiredAccess = DesiredAccess;
|
Request->Req.Create.DesiredAccess = DesiredAccess;
|
||||||
@ -262,7 +264,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
if (IsAbsoluteSecurityDescriptor)
|
if (IsAbsoluteSecurityDescriptor)
|
||||||
{
|
{
|
||||||
Result = RtlAbsoluteToSelfRelativeSD(SecurityDescriptor,
|
Result = RtlAbsoluteToSelfRelativeSD(SecurityDescriptor,
|
||||||
Request->Buffer + Request->Req.Create.SecurityDescriptor, &SecurityDescriptorSize);
|
Request->Buffer + Request->Req.Create.SecurityDescriptor.Offset, &SecurityDescriptorSize);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
{
|
{
|
||||||
FspFileContextDelete(FsContext);
|
FspFileContextDelete(FsContext);
|
||||||
@ -272,7 +274,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsSelfRelativeSecurityDescriptor)
|
else if (IsSelfRelativeSecurityDescriptor)
|
||||||
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor,
|
RtlCopyMemory(Request->Buffer + Request->Req.Create.SecurityDescriptor.Offset,
|
||||||
SecurityDescriptor, SecurityDescriptorSize);
|
SecurityDescriptor, SecurityDescriptorSize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -351,8 +353,8 @@ VOID FspFsvolCreateComplete(
|
|||||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||||
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor =
|
PSECURITY_DESCRIPTOR SecurityDescriptor =
|
||||||
(PVOID)(Response->Buffer + Response->Rsp.Create.SecurityDescriptor);
|
(PVOID)(Response->Buffer + Response->Rsp.Create.Buf.SecurityDescriptor.Offset);
|
||||||
ULONG SecurityDescriptorSize = Response->Rsp.Create.SecurityDescriptorSize;
|
ULONG SecurityDescriptorSize = Response->Rsp.Create.Buf.SecurityDescriptor.Size;
|
||||||
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;
|
||||||
ULONG Flags = IrpSp->Flags;
|
ULONG Flags = IrpSp->Flags;
|
||||||
@ -367,6 +369,27 @@ VOID FspFsvolCreateComplete(
|
|||||||
{
|
{
|
||||||
FspFileContextDelete(FileObject->FsContext);
|
FspFileContextDelete(FileObject->FsContext);
|
||||||
FileObject->FsContext = 0;
|
FileObject->FsContext = 0;
|
||||||
|
|
||||||
|
Irp->IoStatus.Information = Response->IoStatus.Information;
|
||||||
|
Result = Response->IoStatus.Status;
|
||||||
|
FSP_RETURN();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* special case STATUS_REPARSE */
|
||||||
|
if (STATUS_REPARSE == Result)
|
||||||
|
{
|
||||||
|
if (IO_REPARSE != Response->IoStatus.Information &&
|
||||||
|
IO_REMOUNT != Response->IoStatus.Information)
|
||||||
|
{
|
||||||
|
FspFileContextDelete(FileObject->FsContext);
|
||||||
|
FileObject->FsContext = 0;
|
||||||
|
FSP_RETURN(Result = STATUS_ACCESS_DENIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IO_REPARSE != Response->IoStatus.Information)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = Response->IoStatus.Information;
|
Irp->IoStatus.Information = Response->IoStatus.Information;
|
||||||
Result = Response->IoStatus.Status;
|
Result = Response->IoStatus.Status;
|
||||||
FSP_RETURN();
|
FSP_RETURN();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user