mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
sys: IRP_MJ_CREATE
This commit is contained in:
parent
0187b77f8b
commit
f0ee13b04c
@ -344,7 +344,6 @@ VOID FspFsvolCreateComplete(
|
|||||||
{
|
{
|
||||||
FSP_ENTER_IOC(PAGED_CODE());
|
FSP_ENTER_IOC(PAGED_CODE());
|
||||||
|
|
||||||
PDEVICE_OBJECT DeviceObject = IrpSp->DeviceObject;
|
|
||||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||||
|
|
||||||
/* if the user-mode file system sent us a failure code, fail the request now */
|
/* if the user-mode file system sent us a failure code, fail the request now */
|
||||||
@ -352,36 +351,48 @@ VOID FspFsvolCreateComplete(
|
|||||||
{
|
{
|
||||||
FspFileContextDelete(FileObject->FsContext);
|
FspFileContextDelete(FileObject->FsContext);
|
||||||
FileObject->FsContext = 0;
|
FileObject->FsContext = 0;
|
||||||
goto exit;
|
Irp->IoStatus.Information = Response->IoStatus.Information;
|
||||||
|
Result = Response->IoStatus.Status;
|
||||||
|
FSP_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* record the user-mode file system contexts */
|
/* record the user-mode file system contexts */
|
||||||
FSP_FILE_CONTEXT *FsContext = FileObject->FsContext;
|
FSP_FILE_CONTEXT *FsContext = FileObject->FsContext;
|
||||||
BOOLEAN Inserted;
|
|
||||||
FsContext->UserContext = Response->Rsp.Create.UserContext;
|
FsContext->UserContext = Response->Rsp.Create.UserContext;
|
||||||
FileObject->FsContext2 = (PVOID)(UINT_PTR)Response->Rsp.Create.UserContext2;
|
FileObject->FsContext2 = (PVOID)(UINT_PTR)Response->Rsp.Create.UserContext2;
|
||||||
|
|
||||||
/* insert the new FsContext into our generic table */
|
/* insert the new FsContext into our generic table */
|
||||||
FsContext = FspFsvolDeviceInsertContext(DeviceObject,
|
PDEVICE_OBJECT DeviceObject = IrpSp->DeviceObject;
|
||||||
FsContext->UserContext, FsContext, &Inserted);
|
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||||
|
BOOLEAN Inserted;
|
||||||
|
ExAcquireResourceExclusiveLite(&FsvolDeviceExtension->Base.Resource, TRUE);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FsContext = FspFsvolDeviceInsertContext(DeviceObject,
|
||||||
|
FsContext->UserContext, FsContext, &Inserted);
|
||||||
|
if (0 != FsContext)
|
||||||
|
FspFileContextOpen(FsContext);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ExReleaseResourceLite(&FsvolDeviceExtension->Base.Resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* did we fail to insert? */
|
||||||
if (0 == FsContext)
|
if (0 == FsContext)
|
||||||
{
|
{
|
||||||
FspFsvolCreateClose(Irp, Response);
|
FspFsvolCreateClose(Irp, Response);
|
||||||
FSP_RETURN(Result = STATUS_INSUFFICIENT_RESOURCES);
|
Result = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
FSP_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if it was not inserted, an FsContext with the same UserContext already exists; reuse it */
|
/* does an FsContext with the same UserContext already exist? */
|
||||||
if (!Inserted)
|
if (!Inserted)
|
||||||
{
|
{
|
||||||
FspFileContextDelete(FileObject->FsContext);
|
FspFileContextDelete(FileObject->FsContext);
|
||||||
FspFileContextOpen(FsContext);
|
|
||||||
FileObject->FsContext = FsContext;
|
FileObject->FsContext = FsContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
|
||||||
Irp->IoStatus.Information = Response->IoStatus.Information;
|
|
||||||
Result = Response->IoStatus.Status;
|
|
||||||
|
|
||||||
FSP_LEAVE_IOC(
|
FSP_LEAVE_IOC(
|
||||||
"FileObject=%p[%p:\"%wZ\"]",
|
"FileObject=%p[%p:\"%wZ\"]",
|
||||||
IrpSp->FileObject, IrpSp->FileObject->RelatedFileObject, IrpSp->FileObject->FileName);
|
IrpSp->FileObject, IrpSp->FileObject->RelatedFileObject, IrpSp->FileObject->FileName);
|
||||||
|
@ -46,7 +46,6 @@ NTSTATUS FspFileContextCreate(ULONG ExtraSize, FSP_FILE_CONTEXT **PFsContext)
|
|||||||
FsContext->Header.PagingIoResource = &NonPaged->PagingIoResource;
|
FsContext->Header.PagingIoResource = &NonPaged->PagingIoResource;
|
||||||
FsRtlSetupAdvancedHeader(&FsContext->Header, &NonPaged->HeaderFastMutex);
|
FsRtlSetupAdvancedHeader(&FsContext->Header, &NonPaged->HeaderFastMutex);
|
||||||
FsContext->NonPaged = NonPaged;
|
FsContext->NonPaged = NonPaged;
|
||||||
FsContext->OpenCount = 1;
|
|
||||||
RtlInitEmptyUnicodeString(&FsContext->FileName, FsContext->FileNameBuf, (USHORT)ExtraSize);
|
RtlInitEmptyUnicodeString(&FsContext->FileName, FsContext->FileNameBuf, (USHORT)ExtraSize);
|
||||||
|
|
||||||
*PFsContext = FsContext;
|
*PFsContext = FsContext;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user