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
a382db8b01
commit
8c7f790805
@ -86,6 +86,7 @@ static NTSTATUS FspFsvolCreate(
|
||||
if ((0 == RelatedFileObject || RelatedFileObject->FsContext) && 0 == FileName.Length)
|
||||
{
|
||||
if (0 != FsvolDeviceExtension->FsvrtDeviceObject)
|
||||
#pragma prefast(disable:28175, "We are a filesystem: ok to access Vpb")
|
||||
FileObject->Vpb = FsvolDeviceExtension->FsvrtDeviceObject->Vpb;
|
||||
|
||||
Irp->IoStatus.Information = FILE_OPENED;
|
||||
@ -242,7 +243,7 @@ static NTSTATUS FspFsvolCreate(
|
||||
FspFsvolCreateRequestFini, &Request);
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
FspFileContextDelete(FsContext);
|
||||
FspFileContextRelease(FsContext);
|
||||
return Result;
|
||||
}
|
||||
|
||||
@ -374,6 +375,7 @@ VOID FspFsvolCreateComplete(
|
||||
PFILE_OBJECT FileObject = IrpSp->FileObject;
|
||||
FSP_FSCTL_TRANSACT_REQ *Request = FspIrpRequest(Irp);
|
||||
FSP_FILE_CONTEXT *FsContext = FspIopRequestContext(Request, RequestFsContext);
|
||||
FSP_FILE_CONTEXT *OpenedFsContext;
|
||||
UNICODE_STRING ReparseFileName;
|
||||
BOOLEAN DeleteOnClose;
|
||||
|
||||
@ -451,6 +453,7 @@ VOID FspFsvolCreateComplete(
|
||||
|
||||
/* set up the FileObject */
|
||||
if (0 != FsvolDeviceExtension->FsvrtDeviceObject)
|
||||
#pragma prefast(disable:28175, "We are a filesystem: ok to access Vpb")
|
||||
FileObject->Vpb = FsvolDeviceExtension->FsvrtDeviceObject->Vpb;
|
||||
FileObject->SectionObjectPointer = &FsContext->NonPaged->SectionObjectPointers;
|
||||
FileObject->PrivateCacheMap = 0;
|
||||
@ -460,11 +463,10 @@ VOID FspFsvolCreateComplete(
|
||||
DeleteOnClose = BooleanFlagOn(Request->Req.Create.CreateOptions, FILE_DELETE_ON_CLOSE);
|
||||
|
||||
/* open the FsContext */
|
||||
FsContext = FspFileContextOpen(FsContext, FileObject,
|
||||
OpenedFsContext = FspFileContextOpen(FsContext, FileObject,
|
||||
Response->Rsp.Create.Opened.GrantedAccess, IrpSp->Parameters.Create.ShareAccess,
|
||||
&Result);
|
||||
FspIopRequestContext(Request, RequestFsContext) = FsContext;
|
||||
if (0 == FsContext)
|
||||
if (0 == OpenedFsContext)
|
||||
{
|
||||
/* unable to open the FsContext; post a close Create2 request */
|
||||
FspFsvolCreatePostClose(FsvolDeviceObject,
|
||||
@ -473,9 +475,16 @@ VOID FspFsvolCreateComplete(
|
||||
Response->Rsp.Create.Opened.UserContext2,
|
||||
Result);
|
||||
|
||||
FspFileContextRelease(FsContext);
|
||||
|
||||
FSP_RETURN();
|
||||
}
|
||||
|
||||
if (OpenedFsContext != FsContext)
|
||||
FspFileContextRelease(FsContext);
|
||||
|
||||
FspIopRequestContext(Request, RequestFsContext) = FsContext = OpenedFsContext;
|
||||
|
||||
if (FILE_OPENED == Response->IoStatus.Information)
|
||||
{
|
||||
/*
|
||||
|
@ -25,11 +25,7 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject);
|
||||
static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject);
|
||||
static IO_TIMER_ROUTINE FspFsvolDeviceTimerRoutine;
|
||||
static WORKER_THREAD_ROUTINE FspFsvolDeviceExpirationRoutine;
|
||||
_IRQL_raises_(APC_LEVEL)
|
||||
_IRQL_saves_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceLockContextTable(PDEVICE_OBJECT DeviceObject);
|
||||
_IRQL_requires_(APC_LEVEL)
|
||||
_IRQL_restores_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject);
|
||||
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier);
|
||||
PVOID FspFsvolDeviceInsertContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier, PVOID Context,
|
||||
@ -295,7 +291,7 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject)
|
||||
FsvolDeviceExtension->InitDoneIoq = 1;
|
||||
|
||||
/* initialize our generic table */
|
||||
ExInitializeFastMutex(&FsvolDeviceExtension->GenericTableFastMutex);
|
||||
KeInitializeGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
||||
RtlInitializeGenericTableAvl(&FsvolDeviceExtension->GenericTable,
|
||||
FspFsvolDeviceCompareElement, FspFsvolDeviceAllocateElement, FspFsvolDeviceFreeElement, 0);
|
||||
FsvolDeviceExtension->InitDoneGenTab = 1;
|
||||
@ -412,24 +408,20 @@ static VOID FspFsvolDeviceExpirationRoutine(PVOID Context)
|
||||
FspDeviceRelease(DeviceObject);
|
||||
}
|
||||
|
||||
_IRQL_raises_(APC_LEVEL)
|
||||
_IRQL_saves_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceLockContextTable(PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||
ExAcquireFastMutex(&FsvolDeviceExtension->GenericTableFastMutex);
|
||||
KeAcquireGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
||||
}
|
||||
|
||||
_IRQL_requires_(APC_LEVEL)
|
||||
_IRQL_restores_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject);
|
||||
ExReleaseFastMutex(&FsvolDeviceExtension->GenericTableFastMutex);
|
||||
KeReleaseGuardedMutex(&FsvolDeviceExtension->GenericTableMutex);
|
||||
}
|
||||
|
||||
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier)
|
||||
|
@ -433,7 +433,7 @@ typedef struct
|
||||
KSPIN_LOCK ExpirationLock;
|
||||
WORK_QUEUE_ITEM ExpirationWorkItem;
|
||||
BOOLEAN ExpirationInProgress;
|
||||
FAST_MUTEX GenericTableFastMutex;
|
||||
KGUARDED_MUTEX GenericTableMutex;
|
||||
RTL_AVL_TABLE GenericTable;
|
||||
PVOID GenericTableElementStorage;
|
||||
UNICODE_STRING VolumeName;
|
||||
@ -461,11 +461,7 @@ NTSTATUS FspDeviceInitialize(PDEVICE_OBJECT DeviceObject);
|
||||
VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject);
|
||||
BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject);
|
||||
VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject);
|
||||
_IRQL_raises_(APC_LEVEL)
|
||||
_IRQL_saves_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceLockContextTable(PDEVICE_OBJECT DeviceObject);
|
||||
_IRQL_requires_(APC_LEVEL)
|
||||
_IRQL_restores_global_(OldIrql, DeviceObject)
|
||||
VOID FspFsvolDeviceUnlockContextTable(PDEVICE_OBJECT DeviceObject);
|
||||
PVOID FspFsvolDeviceLookupContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier);
|
||||
PVOID FspFsvolDeviceInsertContext(PDEVICE_OBJECT DeviceObject, UINT64 Identifier, PVOID Context,
|
||||
|
@ -112,7 +112,7 @@ FSP_FILE_CONTEXT *FspFileContextOpen(FSP_FILE_CONTEXT *FsContext, PFILE_OBJECT F
|
||||
* opening a prior FsContext that we found in the table.
|
||||
*
|
||||
* First check and update the share access. If successful then retain the
|
||||
* prior FsContext for our caller and release the original FsContext.
|
||||
* prior FsContext for our caller.
|
||||
*/
|
||||
ASSERT(OpenedFsContext != FsContext);
|
||||
|
||||
@ -150,9 +150,6 @@ FSP_FILE_CONTEXT *FspFileContextOpen(FSP_FILE_CONTEXT *FsContext, PFILE_OBJECT F
|
||||
|
||||
FspFsvolDeviceUnlockContextTable(FsvolDeviceObject);
|
||||
|
||||
if (!Inserted)
|
||||
FspFileContextRelease(FsContext);
|
||||
|
||||
return OpenedFsContext;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user