| 24 | |
| 25 | |
| 26 | NTSTATUS |
| 27 | Ext2QueryVolumeInformation (IN PEXT2_IRP_CONTEXT IrpContext) |
| 28 | { |
| 29 | PDEVICE_OBJECT DeviceObject; |
| 30 | PEXT2_VCB Vcb = NULL; |
| 31 | PIRP Irp = NULL; |
| 32 | PIO_STACK_LOCATION IoStackLocation = NULL; |
| 33 | PVOID Buffer; |
| 34 | ULONG Length; |
| 35 | NTSTATUS Status = STATUS_UNSUCCESSFUL; |
| 36 | FS_INFORMATION_CLASS FsInformationClass; |
| 37 | BOOLEAN VcbResourceAcquired = FALSE; |
| 38 | |
| 39 | __try { |
| 40 | |
| 41 | ASSERT(IrpContext != NULL); |
| 42 | ASSERT((IrpContext->Identifier.Type == EXT2ICX) && |
| 43 | (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); |
| 44 | |
| 45 | DeviceObject = IrpContext->DeviceObject; |
| 46 | |
| 47 | // |
| 48 | // This request is not allowed on the main device object |
| 49 | // |
| 50 | if (IsExt2FsDevice(DeviceObject)) { |
| 51 | Status = STATUS_INVALID_DEVICE_REQUEST; |
| 52 | __leave; |
| 53 | } |
| 54 | |
| 55 | Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension; |
| 56 | ASSERT(Vcb != NULL); |
| 57 | ASSERT((Vcb->Identifier.Type == EXT2VCB) && |
| 58 | (Vcb->Identifier.Size == sizeof(EXT2_VCB))); |
| 59 | |
| 60 | if (!IsMounted(Vcb)) { |
| 61 | Status = STATUS_VOLUME_DISMOUNTED; |
| 62 | __leave; |
| 63 | } |
| 64 | |
| 65 | if (!ExAcquireResourceSharedLite( |
| 66 | &Vcb->MainResource, |
| 67 | IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) |
| 68 | )) { |
| 69 | |
| 70 | Status = STATUS_PENDING; |
| 71 | __leave; |
| 72 | } |
| 73 | VcbResourceAcquired = TRUE; |
| 74 | |
| 75 | Irp = IrpContext->Irp; |
| 76 | IoStackLocation = IoGetCurrentIrpStackLocation(Irp); |
| 77 | FsInformationClass = |
| 78 | IoStackLocation->Parameters.QueryVolume.FsInformationClass; |
| 79 | |
| 80 | Length = IoStackLocation->Parameters.QueryVolume.Length; |
| 81 | Buffer = Irp->AssociatedIrp.SystemBuffer; |
| 82 | |
| 83 | RtlZeroMemory(Buffer, Length); |
no test coverage detected