| 289 | } |
| 290 | |
| 291 | NTSTATUS |
| 292 | Ext2SetVolumeInformation (IN PEXT2_IRP_CONTEXT IrpContext) |
| 293 | { |
| 294 | PDEVICE_OBJECT DeviceObject; |
| 295 | NTSTATUS Status = STATUS_UNSUCCESSFUL; |
| 296 | PEXT2_VCB Vcb = NULL; |
| 297 | PIRP Irp; |
| 298 | PIO_STACK_LOCATION IoStackLocation; |
| 299 | FS_INFORMATION_CLASS FsInformationClass; |
| 300 | BOOLEAN VcbResourceAcquired = FALSE; |
| 301 | |
| 302 | __try { |
| 303 | |
| 304 | ASSERT(IrpContext != NULL); |
| 305 | |
| 306 | ASSERT((IrpContext->Identifier.Type == EXT2ICX) && |
| 307 | (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); |
| 308 | |
| 309 | DeviceObject = IrpContext->DeviceObject; |
| 310 | |
| 311 | // |
| 312 | // This request is not allowed on the main device object |
| 313 | // |
| 314 | if (IsExt2FsDevice(DeviceObject)) { |
| 315 | Status = STATUS_INVALID_DEVICE_REQUEST; |
| 316 | __leave; |
| 317 | } |
| 318 | |
| 319 | Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension; |
| 320 | ASSERT(Vcb != NULL); |
| 321 | ASSERT((Vcb->Identifier.Type == EXT2VCB) && |
| 322 | (Vcb->Identifier.Size == sizeof(EXT2_VCB))); |
| 323 | ASSERT(IsMounted(Vcb)); |
| 324 | |
| 325 | if (IsVcbReadOnly(Vcb)) { |
| 326 | Status = STATUS_MEDIA_WRITE_PROTECTED; |
| 327 | __leave; |
| 328 | } |
| 329 | |
| 330 | if (!ExAcquireResourceExclusiveLite( |
| 331 | &Vcb->MainResource, TRUE)) { |
| 332 | Status = STATUS_PENDING; |
| 333 | __leave; |
| 334 | } |
| 335 | VcbResourceAcquired = TRUE; |
| 336 | |
| 337 | Ext2VerifyVcb(IrpContext, Vcb); |
| 338 | |
| 339 | Irp = IrpContext->Irp; |
| 340 | IoStackLocation = IoGetCurrentIrpStackLocation(Irp); |
| 341 | |
| 342 | //Notes: SetVolume is not defined in ntddk.h of win2k ddk, |
| 343 | // But it's same to QueryVolume .... |
| 344 | FsInformationClass = |
| 345 | IoStackLocation->Parameters./*SetVolume*/QueryVolume.FsInformationClass; |
| 346 | |
| 347 | switch (FsInformationClass) { |
| 348 |
no test coverage detected