Implemented IRP_MJ_QUERY_VOLUME_INFORMATION/FileFsDeviceInformation. Msvcrt needs to detect the device type.

svn path=/trunk/; revision=17292
This commit is contained in:
Hartmut Birr 2005-08-11 19:07:11 +00:00
parent 77b9c0a70d
commit 2acde8450d

View file

@ -100,6 +100,35 @@ NullDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
break; break;
} }
case IRP_MJ_QUERY_VOLUME_INFORMATION:
switch(piosStack->Parameters.QueryVolume.FsInformationClass)
{
case FileFsDeviceInformation:
{
ULONG BufferLength = piosStack->Parameters.QueryVolume.Length;
PFILE_FS_DEVICE_INFORMATION FsDeviceInfo = (PFILE_FS_DEVICE_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
if (BufferLength >= sizeof(FILE_FS_DEVICE_INFORMATION))
{
FsDeviceInfo->DeviceType = FILE_DEVICE_NULL;
FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */
Irp->IoStatus.Information = sizeof(FILE_FS_DEVICE_INFORMATION);
nErrCode = STATUS_SUCCESS;
}
else
{
Irp->IoStatus.Information = 0;
nErrCode = STATUS_BUFFER_OVERFLOW;
}
}
break;
default:
Irp->IoStatus.Information = 0;
nErrCode = STATUS_NOT_IMPLEMENTED;
}
break;
default: default:
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
nErrCode = STATUS_NOT_IMPLEMENTED; nErrCode = STATUS_NOT_IMPLEMENTED;
@ -135,16 +164,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
DriverObject->DriverUnload = NullUnload; DriverObject->DriverUnload = NullUnload;
/* create null device */ /* create null device */
nErrCode = IoCreateDevice nErrCode = IoCreateDevice(DriverObject,
(
DriverObject,
sizeof(NULL_EXTENSION), sizeof(NULL_EXTENSION),
&wstrNullDeviceName, &wstrNullDeviceName,
FILE_DEVICE_NULL, FILE_DEVICE_NULL,
0, 0,
FALSE, FALSE,
&pdoNullDevice &pdoNullDevice);
);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) if(!NT_SUCCESS(nErrCode))
@ -155,16 +181,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
pdoNullDevice->DeviceExtension = (PVOID)&nxNull; pdoNullDevice->DeviceExtension = (PVOID)&nxNull;
/* create zero device */ /* create zero device */
nErrCode = IoCreateDevice nErrCode = IoCreateDevice(DriverObject,
(
DriverObject,
sizeof(NULL_EXTENSION), sizeof(NULL_EXTENSION),
&wstrZeroDeviceName, &wstrZeroDeviceName,
FILE_DEVICE_NULL, FILE_DEVICE_NULL,
FILE_READ_ONLY_DEVICE, /* zero device is read-only */ FILE_READ_ONLY_DEVICE, /* zero device is read-only */
FALSE, FALSE,
&pdoZeroDevice &pdoZeroDevice);
);
/* failure */ /* failure */
if(!NT_SUCCESS(nErrCode)) if(!NT_SUCCESS(nErrCode))