mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
sys: IRP_MJ_CREATE: FILE_DELETE_ON_CLOSE
This commit is contained in:
parent
6c29a98e90
commit
6ea86a5e8a
@ -112,6 +112,7 @@ typedef struct
|
||||
{
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 Delete:1; /* if set, the file or directory must be deleted */
|
||||
} Cleanup;
|
||||
struct
|
||||
{
|
||||
|
@ -195,6 +195,15 @@ static NTSTATUS FspFsvolCreate(
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
||||
if (sizeof(WCHAR) == RelatedFsContext->FileName.Length &&
|
||||
0 == FileName.Length &&
|
||||
FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
{
|
||||
Result = STATUS_CANNOT_DELETE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
FSP_FILE_CONTEXT *RelatedFsContext = RelatedFileObject->FsContext;
|
||||
ASSERT(0 != RelatedFsContext);
|
||||
|
||||
@ -230,6 +239,14 @@ static NTSTATUS FspFsvolCreate(
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
||||
if (sizeof(WCHAR) == FileName.Length) &&
|
||||
FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
{
|
||||
Result = STATUS_CANNOT_DELETE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
Result = FspFileContextCreate(
|
||||
FileName.Length,
|
||||
&FsContext);
|
||||
@ -483,7 +500,8 @@ VOID FspFsvolCreateComplete(
|
||||
FSP_RETURN(Result = STATUS_ACCESS_DENIED);
|
||||
}
|
||||
else
|
||||
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
if (!FlagOn(ResponseFileAttributes, FILE_ATTRIBUTE_DIRECTORY) &&
|
||||
FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
{
|
||||
FspFsvolCreateClose(Irp, Response);
|
||||
FSP_RETURN(Result = STATUS_CANNOT_DELETE);
|
||||
@ -573,6 +591,8 @@ VOID FspFsvolCreateComplete(
|
||||
IoSetShareAccess(AccessState->PreviouslyGrantedAccess,
|
||||
ShareAccess, FileObject, &FsContext->ShareAccess);
|
||||
FspFileContextOpen(FsContext);
|
||||
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
FsContext->DeleteOnClose = TRUE;
|
||||
Result = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
@ -592,6 +612,8 @@ VOID FspFsvolCreateComplete(
|
||||
{
|
||||
FspFileContextRetain(FsContext);
|
||||
FspFileContextOpen(FsContext);
|
||||
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
|
||||
FsContext->DeleteOnClose = TRUE;
|
||||
}
|
||||
ExReleaseResourceLite(FsContext->Header.Resource);
|
||||
}
|
||||
|
@ -388,7 +388,8 @@ typedef struct
|
||||
/* protected by Header.Resource */
|
||||
LONG OpenCount;
|
||||
SHARE_ACCESS ShareAccess;
|
||||
BOOLEAN DeletePending;
|
||||
BOOLEAN DeletePending; /* FileDispositionInformation */
|
||||
BOOLEAN DeleteOnClose; /* FILE_DELETE_ON_CLOSE */
|
||||
/* read-only after creation */
|
||||
FSP_DEVICE_GENERIC_TABLE_ELEMENT ElementStorage;
|
||||
UINT64 UserContext;
|
||||
|
Loading…
x
Reference in New Issue
Block a user