https://git.reactos.org/?p=reactos.git;a=commitdiff;h=42724f47f841846a00eb5…
commit 42724f47f841846a00eb50a55345b4804e49a70a
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sat Mar 21 14:58:36 2020 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Sun Mar 22 14:29:38 2020 +0100
[ISAPNP] Return a compatibleIDs only if defined
---
drivers/bus/isapnp/isapnp.c | 7 +++++++
drivers/bus/isapnp/isapnp.h | 1 +
drivers/bus/isapnp/pdo.c | 6 ++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c
index 35f5041d904..16fd14c489d 100644
--- a/drivers/bus/isapnp/isapnp.c
+++ b/drivers/bus/isapnp/isapnp.c
@@ -335,6 +335,7 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt)
{
UNICODE_STRING DeviceID = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0");
UNICODE_STRING HardwareIDs =
RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0\0");
+ UNICODE_STRING CompatibleIDs = RTL_CONSTANT_STRING(L"\0\0");
UNICODE_STRING InstanceID = RTL_CONSTANT_STRING(L"0\0");
PISAPNP_PDO_EXTENSION PdoExt;
@@ -367,6 +368,12 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt)
if (!NT_SUCCESS(Status))
return Status;
+ Status = IsaPnpDuplicateUnicodeString(0,
+ &CompatibleIDs,
+ &PdoExt->CompatibleIDs);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
Status = IsaPnpDuplicateUnicodeString(0,
&InstanceID,
&PdoExt->InstanceID);
diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h
index 4a68b5ee11d..8417687867b 100644
--- a/drivers/bus/isapnp/isapnp.h
+++ b/drivers/bus/isapnp/isapnp.h
@@ -51,6 +51,7 @@ typedef struct _ISAPNP_PDO_EXTENSION {
PISAPNP_FDO_EXTENSION FdoExt;
UNICODE_STRING DeviceID;
UNICODE_STRING HardwareIDs;
+ UNICODE_STRING CompatibleIDs;
UNICODE_STRING InstanceID;
} ISAPNP_PDO_EXTENSION, *PISAPNP_PDO_EXTENSION;
diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c
index 5d601c985ee..68e1714cd6f 100644
--- a/drivers/bus/isapnp/pdo.c
+++ b/drivers/bus/isapnp/pdo.c
@@ -93,7 +93,6 @@ IsaPdoQueryId(
IN PIRP Irp,
IN PIO_STACK_LOCATION IrpSp)
{
- UNICODE_STRING EmptyString = RTL_CONSTANT_STRING(L"");
PUNICODE_STRING Source;
PWCHAR Buffer;
@@ -111,7 +110,7 @@ IsaPdoQueryId(
case BusQueryCompatibleIDs:
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
- Source = &EmptyString;
+ Source = &PdoExt->CompatibleIDs;
break;
case BusQueryInstanceID:
@@ -125,6 +124,9 @@ IsaPdoQueryId(
return Irp->IoStatus.Status;
}
+ if (!Source->Buffer)
+ return Irp->IoStatus.Status;
+
Buffer = ExAllocatePool(PagedPool, Source->MaximumLength);
if (!Buffer)
return STATUS_NO_MEMORY;