| 238 | } |
| 239 | |
| 240 | NTSTATUS |
| 241 | Ext2UnlockVolume ( |
| 242 | IN PEXT2_IRP_CONTEXT IrpContext |
| 243 | ) |
| 244 | { |
| 245 | PIO_STACK_LOCATION IrpSp = NULL; |
| 246 | PDEVICE_OBJECT DeviceObject = NULL; |
| 247 | PEXT2_VCB Vcb = NULL; |
| 248 | NTSTATUS Status; |
| 249 | BOOLEAN VcbResourceAcquired = FALSE; |
| 250 | |
| 251 | __try { |
| 252 | |
| 253 | ASSERT(IrpContext != NULL); |
| 254 | ASSERT((IrpContext->Identifier.Type == EXT2ICX) && |
| 255 | (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); |
| 256 | |
| 257 | DeviceObject = IrpContext->DeviceObject; |
| 258 | IrpSp = IoGetCurrentIrpStackLocation(IrpContext->Irp); |
| 259 | |
| 260 | // |
| 261 | // This request is not allowed on the main device object |
| 262 | // |
| 263 | if (IsExt2FsDevice(DeviceObject)) { |
| 264 | Status = STATUS_INVALID_PARAMETER; |
| 265 | __leave; |
| 266 | } |
| 267 | |
| 268 | Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension; |
| 269 | ASSERT(Vcb != NULL); |
| 270 | ASSERT((Vcb->Identifier.Type == EXT2VCB) && |
| 271 | (Vcb->Identifier.Size == sizeof(EXT2_VCB))); |
| 272 | |
| 273 | ExAcquireResourceExclusiveLite( |
| 274 | &Vcb->MainResource, |
| 275 | TRUE ); |
| 276 | VcbResourceAcquired = TRUE; |
| 277 | |
| 278 | Status = Ext2UnlockVcb(Vcb, IrpSp->FileObject); |
| 279 | |
| 280 | } __finally { |
| 281 | |
| 282 | if (VcbResourceAcquired) { |
| 283 | ExReleaseResourceLite(&Vcb->MainResource); |
| 284 | } |
| 285 | |
| 286 | if (!IrpContext->ExceptionInProgress) { |
| 287 | Ext2CompleteIrpContext(IrpContext, Status); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | return Status; |
| 292 | } |
| 293 | |
| 294 | |
| 295 | NTSTATUS |
no test coverage detected