| 54 | |
| 55 | |
| 56 | NTSTATUS |
| 57 | Ext2DeviceControlNormal (IN PEXT2_IRP_CONTEXT IrpContext) |
| 58 | { |
| 59 | PDEVICE_OBJECT DeviceObject; |
| 60 | BOOLEAN CompleteRequest = TRUE; |
| 61 | NTSTATUS Status = STATUS_UNSUCCESSFUL; |
| 62 | |
| 63 | PEXT2_VCB Vcb; |
| 64 | |
| 65 | PIRP Irp; |
| 66 | PIO_STACK_LOCATION IrpSp; |
| 67 | PIO_STACK_LOCATION NextIrpSp; |
| 68 | |
| 69 | PDEVICE_OBJECT TargetDeviceObject; |
| 70 | |
| 71 | __try { |
| 72 | |
| 73 | ASSERT(IrpContext != NULL); |
| 74 | |
| 75 | ASSERT((IrpContext->Identifier.Type == EXT2ICX) && |
| 76 | (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); |
| 77 | |
| 78 | CompleteRequest = TRUE; |
| 79 | |
| 80 | DeviceObject = IrpContext->DeviceObject; |
| 81 | |
| 82 | if (IsExt2FsDevice(DeviceObject)) { |
| 83 | Status = STATUS_INVALID_DEVICE_REQUEST; |
| 84 | __leave; |
| 85 | } |
| 86 | |
| 87 | Irp = IrpContext->Irp; |
| 88 | IrpSp = IoGetCurrentIrpStackLocation(Irp); |
| 89 | |
| 90 | Vcb = (PEXT2_VCB) IrpSp->FileObject->FsContext; |
| 91 | |
| 92 | if (!((Vcb) && (Vcb->Identifier.Type == EXT2VCB) && |
| 93 | (Vcb->Identifier.Size == sizeof(EXT2_VCB)))) { |
| 94 | Status = STATUS_INVALID_PARAMETER; |
| 95 | __leave; |
| 96 | } |
| 97 | |
| 98 | TargetDeviceObject = Vcb->TargetDeviceObject; |
| 99 | |
| 100 | // |
| 101 | // Pass on the IOCTL to the driver below |
| 102 | // |
| 103 | |
| 104 | CompleteRequest = FALSE; |
| 105 | |
| 106 | NextIrpSp = IoGetNextIrpStackLocation( Irp ); |
| 107 | *NextIrpSp = *IrpSp; |
| 108 | |
| 109 | IoSetCompletionRoutine( |
| 110 | Irp, |
| 111 | Ext2DeviceControlCompletion, |
| 112 | NULL, |
| 113 | FALSE, |
no test coverage detected