mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 09:23:37 -05:00
sys: IRP_MJ_CREATE
This commit is contained in:
parent
0fb9de1ebd
commit
23b4956488
@ -96,7 +96,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.} */
|
||||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor for new files */
|
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor for new files */
|
||||||
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.} */
|
||||||
@ -104,8 +104,8 @@ typedef struct
|
|||||||
UINT16 Ea; /* reserved; not currently implemented */
|
UINT16 Ea; /* reserved; not currently implemented */
|
||||||
UINT16 EaSize; /* reserved; not currently implemented */
|
UINT16 EaSize; /* reserved; not currently implemented */
|
||||||
UINT32 UserMode:1; /* request originated in user mode */
|
UINT32 UserMode:1; /* request originated in user mode */
|
||||||
UINT32 HasTraversePrivilege:1; /* requestor has TOKEN_HAS_TRAVERSE_PRIVILEGE */
|
UINT32 HasTraversePrivilege:1; /* requestor has TOKEN_HAS_TRAVERSE_PRIVILEGE */
|
||||||
UINT32 OpenTargetDirectory:1; /* open target dir and report FILE_{EXISTS,DOES_NOT_EXIST} */
|
UINT32 OpenTargetDirectory:1; /* open target dir and report FILE_{EXISTS,DOES_NOT_EXIST} */
|
||||||
UINT32 CaseSensitive:1; /* filename comparisons should be case-sensitive */
|
UINT32 CaseSensitive:1; /* filename comparisons should be case-sensitive */
|
||||||
} Create;
|
} Create;
|
||||||
struct
|
struct
|
||||||
@ -135,16 +135,21 @@ typedef struct
|
|||||||
} IoStatus;
|
} IoStatus;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
union
|
||||||
{
|
{
|
||||||
UINT64 UserContext; /* user context attached to an open file (unique file id) */
|
/* IoStatus.Status == STATUS_SUCCESS */
|
||||||
UINT64 UserContext2; /* user context attached to a kernel file object */
|
struct
|
||||||
/* (only low 32 bits valid in 32-bit mode) */
|
|
||||||
union
|
|
||||||
{
|
{
|
||||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor for existing files */
|
UINT64 UserContext; /* open file user context (unique file id) */
|
||||||
FSP_FSCTL_TRANSACT_BUF ReparseFileName; /* file name to use for STATUS_REPARSE */
|
UINT64 UserContext2; /* kernel file object user context (only low 32 bits valid) */
|
||||||
} Buf;
|
UINT32 FileAttributes; /* FILE_ATTRIBUTE_{NORMAL,DIRECTORY,etc.} */
|
||||||
|
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* security descriptor */
|
||||||
|
} Opened;
|
||||||
|
/* IoStatus.Status == STATUS_REPARSE */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
FSP_FSCTL_TRANSACT_BUF FileName; /* file name to use for STATUS_REPARSE */
|
||||||
|
} Reparse;
|
||||||
} Create;
|
} Create;
|
||||||
} Rsp;
|
} Rsp;
|
||||||
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
||||||
|
@ -116,6 +116,14 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* impossible create options set? */
|
||||||
|
if (FlagOn(CreateOptions, FILE_NON_DIRECTORY_FILE) &&
|
||||||
|
FlagOn(CreateOptions, FILE_DIRECTORY_FILE))
|
||||||
|
{
|
||||||
|
Result = STATUS_INVALID_PARAMETER;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/* check security descriptor validity */
|
/* check security descriptor validity */
|
||||||
if (0 != SecurityDescriptor)
|
if (0 != SecurityDescriptor)
|
||||||
{
|
{
|
||||||
@ -392,9 +400,9 @@ VOID FspFsvolCreateComplete(
|
|||||||
if (STATUS_REPARSE == Result)
|
if (STATUS_REPARSE == Result)
|
||||||
{
|
{
|
||||||
ReparseFileName.Buffer =
|
ReparseFileName.Buffer =
|
||||||
(PVOID)(Response->Buffer + Response->Rsp.Create.Buf.ReparseFileName.Offset);
|
(PVOID)(Response->Buffer + Response->Rsp.Create.Reparse.FileName.Offset);
|
||||||
ReparseFileName.Length = ReparseFileName.MaximumLength =
|
ReparseFileName.Length = ReparseFileName.MaximumLength =
|
||||||
Response->Rsp.Create.Buf.ReparseFileName.Size;
|
Response->Rsp.Create.Reparse.FileName.Size;
|
||||||
|
|
||||||
Result = STATUS_ACCESS_DENIED;
|
Result = STATUS_ACCESS_DENIED;
|
||||||
if (IO_REPARSE == Response->IoStatus.Information)
|
if (IO_REPARSE == Response->IoStatus.Information)
|
||||||
@ -439,8 +447,8 @@ VOID FspFsvolCreateComplete(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SecurityDescriptor =
|
SecurityDescriptor =
|
||||||
(PVOID)(Response->Buffer + Response->Rsp.Create.Buf.SecurityDescriptor.Offset);
|
(PVOID)(Response->Buffer + Response->Rsp.Create.Opened.SecurityDescriptor.Offset);
|
||||||
SecurityDescriptorSize = Response->Rsp.Create.Buf.SecurityDescriptor.Size;
|
SecurityDescriptorSize = Response->Rsp.Create.Opened.SecurityDescriptor.Size;
|
||||||
|
|
||||||
/* are we doing access checks? */
|
/* are we doing access checks? */
|
||||||
if (FsvrtDeviceExtension->VolumeParams.NoSystemAccessCheck &&
|
if (FsvrtDeviceExtension->VolumeParams.NoSystemAccessCheck &&
|
||||||
@ -485,8 +493,8 @@ VOID FspFsvolCreateComplete(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* record the user-mode file system contexts */
|
/* record the user-mode file system contexts */
|
||||||
FsContext->UserContext = Response->Rsp.Create.UserContext;
|
FsContext->UserContext = Response->Rsp.Create.Opened.UserContext;
|
||||||
FileObject->FsContext2 = (PVOID)(UINT_PTR)Response->Rsp.Create.UserContext2;
|
FileObject->FsContext2 = (PVOID)(UINT_PTR)Response->Rsp.Create.Opened.UserContext2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following must be done under the file system volume device Resource,
|
* The following must be done under the file system volume device Resource,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user