Implement IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocationInformation

This commit is contained in:
Eric Kohl 2020-12-06 12:42:50 +01:00
parent f722be93d5
commit cac7b003c0

View file

@ -185,10 +185,12 @@ PdoHandleQueryDeviceText(
PIO_STACK_LOCATION IoStack; PIO_STACK_LOCATION IoStack;
UINT32 Offset = 0; UINT32 Offset = 0;
PINQUIRYDATA InquiryData; PINQUIRYDATA InquiryData;
CHAR LocalBuffer[sizeof(InquiryData->VendorId) + sizeof(InquiryData->ProductId) + 2]; CHAR LocalBuffer[40];
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
UNICODE_STRING DeviceDescription; UNICODE_STRING DeviceDescription;
DPRINT("PdoHandleQueryDeviceText\n");
IoStack = IoGetCurrentIrpStackLocation(Irp); IoStack = IoGetCurrentIrpStackLocation(Irp);
InquiryData = &DeviceExtension->InquiryData; InquiryData = &DeviceExtension->InquiryData;
@ -196,9 +198,8 @@ PdoHandleQueryDeviceText(
switch (IoStack->Parameters.QueryDeviceText.DeviceTextType) switch (IoStack->Parameters.QueryDeviceText.DeviceTextType)
{ {
case DeviceTextDescription: case DeviceTextDescription:
case DeviceTextLocationInformation:
{ {
DPRINT("PdoHandleQueryDeviceText\n"); DPRINT("DeviceTextDescription\n");
Offset += CopyFieldTruncate(InquiryData->VendorId, Offset += CopyFieldTruncate(InquiryData->VendorId,
&LocalBuffer[Offset], &LocalBuffer[Offset],
@ -227,6 +228,33 @@ PdoHandleQueryDeviceText(
Irp->IoStatus.Information = (ULONG_PTR)DeviceDescription.Buffer; Irp->IoStatus.Information = (ULONG_PTR)DeviceDescription.Buffer;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
case DeviceTextLocationInformation:
{
DPRINT("DeviceTextLocationInformation\n");
sprintf(LocalBuffer, "Bus Number %d, Target ID %d, LUN %d",
DeviceExtension->PathId, DeviceExtension->TargetId, DeviceExtension->Lun);
RtlInitAnsiString(&AnsiString, (PCSZ)&LocalBuffer);
DeviceDescription.Length = 0;
DeviceDescription.MaximumLength = (USHORT)((strlen(LocalBuffer) + 1) * sizeof(WCHAR));
DeviceDescription.Buffer = ExAllocatePoolWithTag(PagedPool,
DeviceDescription.MaximumLength,
TAG_SCSIPORT);
if (!DeviceDescription.Buffer)
{
Irp->IoStatus.Information = 0;
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlAnsiStringToUnicodeString(&DeviceDescription, &AnsiString, FALSE);
Irp->IoStatus.Information = (ULONG_PTR)DeviceDescription.Buffer;
return STATUS_SUCCESS;
}
default: default:
{ {
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;