mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:32:58 +00:00
Implement IRP_MJ_PNP / IRP_MN_QUERY_TEXT / DeviceTextDescription for ACPI devices
svn path=/trunk/; revision=18244
This commit is contained in:
parent
32cf34124f
commit
4b42aa47f1
3 changed files with 98 additions and 0 deletions
|
@ -116,6 +116,52 @@ AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
AcpiCreateDeviceDescriptionString(PUNICODE_STRING DeviceDescription,
|
||||||
|
BM_NODE *Node)
|
||||||
|
{
|
||||||
|
PWSTR Buffer;
|
||||||
|
|
||||||
|
DPRINT1("'%s', '%s', %ld\n", Node->device.id.hid, "PNP040", RtlCompareMemory(Node->device.id.hid, "PNP040", 6));
|
||||||
|
if (RtlCompareMemory(Node->device.id.hid, "PNP000", 6) == 6)
|
||||||
|
Buffer = L"Programmable interrupt controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP010", 6) == 6)
|
||||||
|
Buffer = L"System timer";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP020", 6) == 6)
|
||||||
|
Buffer = L"DMA controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP03", 5) == 5)
|
||||||
|
Buffer = L"Keyboard";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP040", 6) == 6)
|
||||||
|
Buffer = L"Parallel port";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP05", 5) == 5)
|
||||||
|
Buffer = L"Serial port";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP06", 5) ==5)
|
||||||
|
Buffer = L"Disk controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP07", 5) == 5)
|
||||||
|
Buffer = L"Disk controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP09", 5) == 5)
|
||||||
|
Buffer = L"Display adapter";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP0A0", 6) == 6)
|
||||||
|
Buffer = L"Bus controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP0E0", 6) == 6)
|
||||||
|
Buffer = L"PCMCIA controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP0F", 5) == 5)
|
||||||
|
Buffer = L"Mouse device";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNP8", 4) == 4)
|
||||||
|
Buffer = L"Network adapter";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNPA0", 5) == 5)
|
||||||
|
Buffer = L"SCSI controller";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNPB0", 5) == 5)
|
||||||
|
Buffer = L"Multimedia device";
|
||||||
|
else if (RtlCompareMemory(Node->device.id.hid, "PNPC00", 6) == 6)
|
||||||
|
Buffer = L"Modem";
|
||||||
|
else
|
||||||
|
Buffer = L"Other ACPI device";
|
||||||
|
|
||||||
|
return AcpiCreateUnicodeString(DeviceDescription, Buffer, PagedPool);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
||||||
PULONG ResourceListSize,
|
PULONG ResourceListSize,
|
||||||
|
@ -458,6 +504,15 @@ FdoQueryBusRelations(
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
// ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
|
// ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
// ErrorOccurred = TRUE;
|
// ErrorOccurred = TRUE;
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AcpiCreateDeviceDescriptionString(&PdoDeviceExtension->DeviceDescription,
|
||||||
|
Node))
|
||||||
|
{
|
||||||
|
ASSERT(FALSE);
|
||||||
|
// ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
// ErrorOccurred = TRUE;
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ typedef struct _PDO_DEVICE_EXTENSION
|
||||||
UNICODE_STRING InstanceID;
|
UNICODE_STRING InstanceID;
|
||||||
// Hardware IDs
|
// Hardware IDs
|
||||||
UNICODE_STRING HardwareIDs;
|
UNICODE_STRING HardwareIDs;
|
||||||
|
// Textual description of device
|
||||||
|
UNICODE_STRING DeviceDescription;
|
||||||
// Resource list
|
// Resource list
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
ULONG ResourceListSize;
|
ULONG ResourceListSize;
|
||||||
|
|
|
@ -42,6 +42,46 @@ AcpiDuplicateUnicodeString(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
PdoQueryDeviceText(
|
||||||
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN PIRP Irp,
|
||||||
|
PIO_STACK_LOCATION IrpSp)
|
||||||
|
{
|
||||||
|
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
PWSTR Buffer;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT("Called\n");
|
||||||
|
|
||||||
|
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
switch (IrpSp->Parameters.QueryDeviceText.DeviceTextType)
|
||||||
|
{
|
||||||
|
case DeviceTextDescription:
|
||||||
|
DPRINT("DeviceTextDescription\n");
|
||||||
|
Buffer = (PWSTR)ExAllocatePool(PagedPool, DeviceExtension->DeviceDescription.Length + sizeof(UNICODE_NULL));
|
||||||
|
if (Buffer == NULL)
|
||||||
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlCopyMemory(Buffer, DeviceExtension->DeviceDescription.Buffer, DeviceExtension->DeviceDescription.Length);
|
||||||
|
Buffer[DeviceExtension->DeviceDescription.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
Irp->IoStatus.Information = (ULONG_PTR)Buffer;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
PdoQueryId(
|
PdoQueryId(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
@ -241,6 +281,7 @@ PdoPnpControl(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_DEVICE_TEXT:
|
case IRP_MN_QUERY_DEVICE_TEXT:
|
||||||
|
Status = PdoQueryDeviceText(DeviceObject, Irp, IrpSp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue