mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-28 05:53:29 +01:00
Windows Driver: support returning StorageDeviceProperty through IOCTL_STORAGE_QUERY_PROPERTY.
This commit is contained in:
parent
1d36a1cd05
commit
fa66a059d9
@ -640,17 +640,35 @@ 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)
|
||||
switch (pStoragePropQuery->PropertyId)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -665,6 +683,9 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION
|
||||
Irp->IoStatus.Information = sizeof (STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user