mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
sys: IRP_MJ_CREATE refactoring
This commit is contained in:
parent
26e2bf506b
commit
cd28edf6a9
@ -348,6 +348,7 @@ NTSTATUS FspFsvolCreatePrepare(
|
||||
return Result;
|
||||
}
|
||||
|
||||
/* no longer post a Close if the IRP gets cancelled */
|
||||
FspIopRequestContext(Request, RequestFileObject) = 0;
|
||||
|
||||
/* see what the MM thinks about all this */
|
||||
@ -357,8 +358,8 @@ NTSTATUS FspFsvolCreatePrepare(
|
||||
{
|
||||
FspFileContextPgioUnlock(FsContext);
|
||||
|
||||
FspFileContextClose(FsContext, FileObject);
|
||||
FspFsvolCreatePostClose(FsContext, (UINT_PTR)FileObject->FsContext2);
|
||||
FspFileContextClose(FsContext, FileObject);
|
||||
|
||||
return STATUS_USER_MAPPED_FILE;
|
||||
}
|
||||
@ -505,12 +506,11 @@ VOID FspFsvolCreateComplete(
|
||||
if (!MmFlushImageSection(&FsContext->NonPaged->SectionObjectPointers,
|
||||
MmFlushForWrite))
|
||||
{
|
||||
Result = DeleteOnClose ? STATUS_CANNOT_DELETE : STATUS_SHARING_VIOLATION;
|
||||
|
||||
FspFileContextClose(FsContext, FileObject);
|
||||
FspFsvolCreatePostClose(FsContext,
|
||||
Response->Rsp.Create.Opened.UserContext2);
|
||||
FspFileContextClose(FsContext, FileObject);
|
||||
|
||||
Result = DeleteOnClose ? STATUS_CANNOT_DELETE : STATUS_SHARING_VIOLATION;
|
||||
FSP_RETURN();
|
||||
}
|
||||
}
|
||||
@ -531,16 +531,17 @@ VOID FspFsvolCreateComplete(
|
||||
FspIrpRequest(Irp) = 0;
|
||||
FspIopDeleteRequest(Request);
|
||||
|
||||
/* create the Create2 request; MustSucceed because we must either overwrite or close */
|
||||
/* create the Overwrite request; MustSucceed because we must either overwrite or close */
|
||||
FspIopCreateRequestFunnel(Irp,
|
||||
FsvolDeviceExtension->VolumeParams.FileNameRequired ? &FsContext->FileName : 0, 0,
|
||||
FspFsvolCreateOverwriteRequestFini, TRUE,
|
||||
&Request);
|
||||
|
||||
/* associate the FsContext with the Create2 request */
|
||||
/* associate the FsContext and FileObject with the Overwrite request */
|
||||
FspIopRequestContext(Request, RequestFsContext) = FsContext;
|
||||
FspIopRequestContext(Request, RequestFileObject) = FileObject;
|
||||
|
||||
/* populate the Create2 request */
|
||||
/* populate the Overwrite request */
|
||||
Request->Kind = FspFsctlTransactOverwriteKind;
|
||||
Request->Req.Overwrite.UserContext = FsContext->UserContext;
|
||||
Request->Req.Overwrite.UserContext2 = (UINT_PTR)FileObject->FsContext2;
|
||||
@ -548,10 +549,11 @@ VOID FspFsvolCreateComplete(
|
||||
Request->Req.Overwrite.Supersede = FILE_SUPERSEDED == Response->IoStatus.Information;
|
||||
|
||||
/*
|
||||
* Post it as BestEffort.
|
||||
*
|
||||
* Note that it is still possible for this request to not be delivered,
|
||||
* if the volume device Ioq is stopped or if the IRP is canceled.
|
||||
*/
|
||||
|
||||
if (FspIoqPostIrpBestEffort(FsvolDeviceExtension->Ioq, Irp, &Result))
|
||||
Result = STATUS_PENDING;
|
||||
}
|
||||
@ -588,9 +590,6 @@ VOID FspFsvolCreateComplete(
|
||||
|
||||
FspFileContextPgioUnlock(FsContext);
|
||||
|
||||
/* disassociate the FsContext from the Overwrite request */
|
||||
FspIopRequestContext(Request, RequestFsContext) = 0;
|
||||
|
||||
/* SUCCESS! */
|
||||
Irp->IoStatus.Information = Request->Req.Overwrite.Supersede ? FILE_SUPERSEDED : FILE_OVERWRITTEN;
|
||||
Result = STATUS_SUCCESS;
|
||||
|
@ -513,8 +513,8 @@ typedef struct
|
||||
FSP_FILE_CONTEXT_NONPAGED *NonPaged;
|
||||
/* interlocked access */
|
||||
LONG RefCount;
|
||||
LONG OpenCount;
|
||||
/* locked access */
|
||||
LONG OpenCount;
|
||||
SHARE_ACCESS ShareAccess;
|
||||
/* read-only after creation (and insertion in the GenericTable) */
|
||||
PDEVICE_OBJECT FsvolDeviceObject;
|
||||
|
Loading…
x
Reference in New Issue
Block a user