mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 09:23:37 -05:00
sys: WIP
This commit is contained in:
parent
f188bddb3b
commit
44654617e3
@ -26,7 +26,6 @@ NTSTATUS FspDeviceCopyList(
|
||||
PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount);
|
||||
VOID FspDeviceDeleteList(
|
||||
PDEVICE_OBJECT *DeviceObjects, ULONG DeviceObjectCount);
|
||||
NTSTATUS FspDeviceOwned(PDEVICE_OBJECT DeviceObject);
|
||||
VOID FspDeviceDeleteAll(VOID);
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
@ -41,7 +40,6 @@ VOID FspDeviceDeleteAll(VOID);
|
||||
#pragma alloc_text(PAGE, FspFsvolDeviceFini)
|
||||
#pragma alloc_text(PAGE, FspDeviceCopyList)
|
||||
#pragma alloc_text(PAGE, FspDeviceDeleteList)
|
||||
#pragma alloc_text(PAGE, FspDeviceOwned)
|
||||
#pragma alloc_text(PAGE, FspDeviceDeleteAll)
|
||||
#endif
|
||||
|
||||
@ -149,7 +147,7 @@ VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject)
|
||||
}
|
||||
|
||||
ExDeleteResourceLite(&DeviceExtension->Resource);
|
||||
RtlZeroMemory(DeviceExtension, DeviceObject->Size - sizeof DEVICE_OBJECT);
|
||||
RtlZeroMemory(DeviceExtension, DeviceObject->Size - sizeof(DEVICE_OBJECT));
|
||||
|
||||
IoDeleteDevice(DeviceObject);
|
||||
}
|
||||
@ -279,30 +277,6 @@ VOID FspDeviceDeleteList(
|
||||
ExFreePoolWithTag(DeviceObjects, FSP_TAG);
|
||||
}
|
||||
|
||||
NTSTATUS FspDeviceOwned(PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
NTSTATUS Result = STATUS_NO_SUCH_DEVICE;
|
||||
PDEVICE_OBJECT *DeviceObjects = 0;
|
||||
ULONG DeviceObjectCount = 0;
|
||||
|
||||
Result = FspDeviceCopyList(&DeviceObjects, &DeviceObjectCount);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
for (ULONG i = 0; DeviceObjectCount > i; i++)
|
||||
if (DeviceObjects[i] == DeviceObject)
|
||||
{
|
||||
Result = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
FspDeviceDeleteList(DeviceObjects, DeviceObjectCount);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
VOID FspDeviceDeleteAll(VOID)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
@ -314,7 +314,6 @@ NTSTATUS FspDeviceCopyList(
|
||||
PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount);
|
||||
VOID FspDeviceDeleteList(
|
||||
PDEVICE_OBJECT *DeviceObjects, ULONG DeviceObjectCount);
|
||||
NTSTATUS FspDeviceOwned(PDEVICE_OBJECT DeviceObject);
|
||||
VOID FspDeviceDeleteAll(VOID);
|
||||
|
||||
/* I/O processing */
|
||||
|
@ -177,6 +177,8 @@ static NTSTATUS FspFsctlMountVolume(
|
||||
ExAcquireResourceExclusiveLite(&FsctlDeviceExtension->Base.Resource, TRUE);
|
||||
try
|
||||
{
|
||||
PDEVICE_OBJECT *DeviceObjects = 0;
|
||||
ULONG DeviceObjectCount = 0;
|
||||
PVPB Vpb = IrpSp->Parameters.MountVolume.Vpb;
|
||||
PDEVICE_OBJECT FsvrtDeviceObject = Vpb->RealDevice;
|
||||
PDEVICE_OBJECT FsvolDeviceObject;
|
||||
@ -185,25 +187,27 @@ static NTSTATUS FspFsctlMountVolume(
|
||||
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension;
|
||||
|
||||
/* check the passed in volume object; it must be one of our own and not marked Deleted */
|
||||
Result = FspDeviceOwned(FsvrtDeviceObject);
|
||||
Result = FspDeviceCopyList(&DeviceObjects, &DeviceObjectCount);
|
||||
if (NT_SUCCESS(Result))
|
||||
{
|
||||
Result = STATUS_UNRECOGNIZED_VOLUME;
|
||||
for (ULONG i = 0; DeviceObjectCount > i; i++)
|
||||
if (DeviceObjects[i] == FsvrtDeviceObject)
|
||||
{
|
||||
if (FspDeviceRetain(FsvrtDeviceObject))
|
||||
{
|
||||
if (!FsvrtDeviceExtension->Deleted &&
|
||||
FILE_DEVICE_VIRTUAL_DISK == FsvrtDeviceObject->DeviceType)
|
||||
Result = STATUS_SUCCESS;
|
||||
else
|
||||
FspDeviceRelease(FsvrtDeviceObject);
|
||||
}
|
||||
break;
|
||||
}
|
||||
FspDeviceDeleteList(DeviceObjects, DeviceObjectCount);
|
||||
}
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
if (STATUS_NO_SUCH_DEVICE == Result)
|
||||
Result = STATUS_UNRECOGNIZED_VOLUME;
|
||||
goto exit;
|
||||
}
|
||||
if (!FspDeviceRetain(FsvrtDeviceObject))
|
||||
{
|
||||
Result = STATUS_UNRECOGNIZED_VOLUME;
|
||||
goto exit;
|
||||
}
|
||||
if (FsvrtDeviceExtension->Deleted ||
|
||||
FILE_DEVICE_VIRTUAL_DISK != FsvrtDeviceObject->DeviceType)
|
||||
{
|
||||
FspDeviceRelease(FsvrtDeviceObject);
|
||||
Result = STATUS_UNRECOGNIZED_VOLUME;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* create the file system device object */
|
||||
Result = FspDeviceCreate(FspFsvolDeviceExtensionKind, 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user