Author: cgutman
Date: Sun Aug 21 00:27:58 2011
New Revision: 53349
URL:
http://svn.reactos.org/svn/reactos?rev=53349&view=rev
Log:
[PCI]
- Fix handling of IRP_MN_QUERY_DEVICE_TEXT
[PNPROOT]
- Fix registry query and returning of device description
[ACPI]
- Fix handling of IRP_MN_QUERY_DEVICE_TEXT
Modified:
trunk/reactos/drivers/bus/acpi/buspdo.c
trunk/reactos/drivers/bus/pci/pdo.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
Modified: trunk/reactos/drivers/bus/acpi/buspdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/buspdo.c?…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] Sun Aug 21 00:27:58 2011
@@ -539,9 +539,9 @@
PPDO_DEVICE_DATA DeviceData,
PIRP Irp )
{
- PWCHAR Buffer;
+ PWCHAR Buffer, Temp;
PIO_STACK_LOCATION stack;
- NTSTATUS status;
+ NTSTATUS status = Irp->IoStatus.Status;
PAGED_CODE ();
stack = IoGetCurrentIrpStackLocation (Irp);
@@ -552,80 +552,88 @@
if (!Irp->IoStatus.Information) {
if (wcsstr (DeviceData->HardwareIDs, L"PNP000") != 0)
- Buffer = L"Programmable interrupt controller";
+ Temp = L"Programmable interrupt controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP010") != 0)
- Buffer = L"System timer";
+ Temp = L"System timer";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP020") != 0)
- Buffer = L"DMA controller";
+ Temp = L"DMA controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP03") != 0)
- Buffer = L"Keyboard";
+ Temp = L"Keyboard";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP040") != 0)
- Buffer = L"Parallel port";
+ Temp = L"Parallel port";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP05") != 0)
- Buffer = L"Serial port";
+ Temp = L"Serial port";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP06") != 0)
- Buffer = L"Disk controller";
+ Temp = L"Disk controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP07") != 0)
- Buffer = L"Disk controller";
+ Temp = L"Disk controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP09") != 0)
- Buffer = L"Display adapter";
+ Temp = L"Display adapter";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A0") != 0)
- Buffer = L"Bus controller";
+ Temp = L"Bus controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0E0") != 0)
- Buffer = L"PCMCIA controller";
+ Temp = L"PCMCIA controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0F") != 0)
- Buffer = L"Mouse device";
+ Temp = L"Mouse device";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP8") != 0)
- Buffer = L"Network adapter";
+ Temp = L"Network adapter";
else if (wcsstr(DeviceData->HardwareIDs, L"PNPA0") != 0)
- Buffer = L"SCSI controller";
+ Temp = L"SCSI controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNPB0") != 0)
- Buffer = L"Multimedia device";
+ Temp = L"Multimedia device";
else if (wcsstr(DeviceData->HardwareIDs, L"PNPC00") != 0)
- Buffer = L"Modem";
+ Temp = L"Modem";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0C") != 0)
- Buffer = L"Power Button";
+ Temp = L"Power Button";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0E") != 0)
- Buffer = L"Sleep Button";
+ Temp = L"Sleep Button";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0D") != 0)
- Buffer = L"Lid Switch";
+ Temp = L"Lid Switch";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C09") != 0)
- Buffer = L"ACPI Embedded Controller";
+ Temp = L"ACPI Embedded Controller";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0B") != 0)
- Buffer = L"ACPI Fan";
+ Temp = L"ACPI Fan";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0)
- Buffer = L"PCI Root Bridge";
+ Temp = L"PCI Root Bridge";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0A") != 0)
- Buffer = L"ACPI Battery";
+ Temp = L"ACPI Battery";
else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0F") != 0)
- Buffer = L"PCI Interrupt Link";
+ Temp = L"PCI Interrupt Link";
else if (wcsstr(DeviceData->HardwareIDs, L"ACPI_PWR") != 0)
- Buffer = L"ACPI Power Resource";
+ Temp = L"ACPI Power Resource";
else if (wcsstr(DeviceData->HardwareIDs, L"Processor") != 0)
- Buffer = L"Processor";
+ Temp = L"Processor";
else if (wcsstr(DeviceData->HardwareIDs, L"ThermalZone") != 0)
- Buffer = L"ACPI Thermal Zone";
+ Temp = L"ACPI Thermal Zone";
else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0002") != 0)
- Buffer = L"Smart Battery";
+ Temp = L"Smart Battery";
else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0003") != 0)
- Buffer = L"AC Adapter";
+ Temp = L"AC Adapter";
/* Simply checking if AcpiHandle is NULL eliminates the need to check
* for the 4 different names that ACPI knows the fixed feature button as internally
*/
else if (!DeviceData->AcpiHandle)
- Buffer = L"ACPI Fixed Feature Button";
+ Temp = L"ACPI Fixed Feature Button";
else
- Buffer = L"Other ACPI device";
+ Temp = L"Other ACPI device";
+
+ Buffer = ExAllocatePoolWithTag (PagedPool, (wcslen(Temp) + 1) *
sizeof(WCHAR), 'IPCA');
+
+ if (!Buffer) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ break;
+ }
+
+ RtlCopyMemory (Buffer, Temp, (wcslen(Temp) + 1) * sizeof(WCHAR));
DPRINT("\tDeviceTextDescription :%ws\n", Buffer);
Irp->IoStatus.Information = (ULONG_PTR) Buffer;
+ status = STATUS_SUCCESS;
}
- status = STATUS_SUCCESS;
break;
default:
- status = Irp->IoStatus.Status;
break;
}
Modified: trunk/reactos/drivers/bus/pci/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=…
==============================================================================
--- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Sun Aug 21 00:27:58 2011
@@ -23,29 +23,37 @@
PIO_STACK_LOCATION IrpSp)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
+ UNICODE_STRING String;
NTSTATUS Status;
DPRINT("Called\n");
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- Status = STATUS_SUCCESS;
-
switch (IrpSp->Parameters.QueryDeviceText.DeviceTextType)
{
case DeviceTextDescription:
+ Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
+ &DeviceExtension->DeviceDescription,
+ &String);
+
DPRINT("DeviceTextDescription\n");
- Irp->IoStatus.Information =
(ULONG_PTR)DeviceExtension->DeviceDescription.Buffer;
+ Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
break;
case DeviceTextLocationInformation:
+ Status = PciDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
+ &DeviceExtension->DeviceLocation,
+ &String);
+
DPRINT("DeviceTextLocationInformation\n");
- Irp->IoStatus.Information =
(ULONG_PTR)DeviceExtension->DeviceLocation.Buffer;
+ Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
break;
default:
Irp->IoStatus.Information = 0;
Status = STATUS_INVALID_PARAMETER;
+ break;
}
return Status;
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Sun Aug 21 00:27:58 2011
@@ -331,12 +331,16 @@
UNICODE_STRING Source;
if (ValueType != REG_SZ || ValueLength == 0 || ValueLength % sizeof(WCHAR) != 0)
+ {
+ Destination->Length = 0;
+ Destination->MaximumLength = 0;
+ Destination->Buffer = NULL;
return STATUS_SUCCESS;
+ }
Source.MaximumLength = Source.Length = ValueLength;
Source.Buffer = ValueData;
- if (Source.Length > 0 && Source.Buffer[Source.Length / sizeof(WCHAR) - 1]
== UNICODE_NULL)
- Source.Length -= sizeof(WCHAR);
+
return RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
&Source, Destination);
}
@@ -914,18 +918,19 @@
UNICODE_STRING String;
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT /
DeviceTextDescription\n");
- Status = RtlDuplicateUnicodeString(
- RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
- &DeviceExtension->DeviceInfo->DeviceDescription,
- &String);
- Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
+ if (DeviceExtension->DeviceInfo->DeviceDescription.Buffer != NULL)
+ {
+ Status =
RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
+
&DeviceExtension->DeviceInfo->DeviceDescription,
+ &String);
+ Irp->IoStatus.Information = (ULONG_PTR)String.Buffer;
+ }
break;
}
case DeviceTextLocationInformation:
{
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT /
DeviceTextLocationInformation\n");
- Status = STATUS_NOT_SUPPORTED;
break;
}