VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-14 01:14:26 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-08-14 01:58:42 +0200
commitfa66a059d9b8bdabf558d1d48db60f0a12d28e38 (patch)
tree5aeef162af432669aa7dc9ef90e9b73d0409fd5e /src/Driver
parent1d36a1cd05f5e693d441807317ea561dad8811c3 (diff)
downloadVeraCrypt-fa66a059d9b8bdabf558d1d48db60f0a12d28e38.tar.gz
VeraCrypt-fa66a059d9b8bdabf558d1d48db60f0a12d28e38.zip
Windows Driver: support returning StorageDeviceProperty through IOCTL_STORAGE_QUERY_PROPERTY.
Diffstat (limited to 'src/Driver')
-rw-r--r--src/Driver/Ntdriver.c53
1 files changed, 37 insertions, 16 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index 53bb9699..d292acb9 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -640,29 +640,50 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
Irp->IoStatus.Information = 0;
- if (type == PropertyExistsQuery)
+ if ( (pStoragePropQuery->PropertyId == StorageAccessAlignmentProperty)
+ || (pStoragePropQuery->PropertyId == StorageDeviceProperty)
+ )
{
- if (pStoragePropQuery->PropertyId == StorageAccessAlignmentProperty)
+ if (type == PropertyExistsQuery)
{
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
}
- }
- else if (type == PropertyStandardQuery)
- {
- if (pStoragePropQuery->PropertyId == StorageAccessAlignmentProperty)
+ else if (type == PropertyStandardQuery)
{
- if (ValidateIOBufferSize (Irp, sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR), ValidateOutput))
+ switch (pStoragePropQuery->PropertyId)
{
- PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR outputBuffer = (PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR) Irp->AssociatedIrp.SystemBuffer;
-
- outputBuffer->Version = sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
- outputBuffer->Size = sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
- outputBuffer->BytesPerLogicalSector = Extension->BytesPerSector;
- outputBuffer->BytesPerPhysicalSector = Extension->HostBytesPerPhysicalSector;
- outputBuffer->BytesOffsetForSectorAlignment = Extension->BytesOffsetForSectorAlignment;
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
+ case StorageDeviceProperty:
+ {
+ if (ValidateIOBufferSize (Irp, sizeof (STORAGE_DEVICE_DESCRIPTOR), ValidateOutput))
+ {
+ PSTORAGE_DEVICE_DESCRIPTOR outputBuffer = (PSTORAGE_DEVICE_DESCRIPTOR) Irp->AssociatedIrp.SystemBuffer;
+
+ outputBuffer->Version = sizeof(STORAGE_DEVICE_DESCRIPTOR);
+ outputBuffer->Size = sizeof(STORAGE_DEVICE_DESCRIPTOR);
+ outputBuffer->DeviceType = FILE_DEVICE_DISK;
+ outputBuffer->RemovableMedia = Extension->bRemovable? TRUE : FALSE;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof (STORAGE_DEVICE_DESCRIPTOR);
+ }
+ }
+ break;
+ case StorageAccessAlignmentProperty:
+ {
+ if (ValidateIOBufferSize (Irp, sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR), ValidateOutput))
+ {
+ PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR outputBuffer = (PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR) Irp->AssociatedIrp.SystemBuffer;
+
+ outputBuffer->Version = sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
+ outputBuffer->Size = sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
+ outputBuffer->BytesPerLogicalSector = Extension->BytesPerSector;
+ outputBuffer->BytesPerPhysicalSector = Extension->HostBytesPerPhysicalSector;
+ outputBuffer->BytesOffsetForSectorAlignment = Extension->BytesOffsetForSectorAlignment;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
+ }
+ }
+ break;
}
}
}