https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6ec38aa94298472c84435…
commit 6ec38aa94298472c8443558b0da8f97ab332c278
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Fri Sep 27 13:13:49 2019 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Fri Sep 27 21:29:41 2019 +0200
[HDAUDBUS] Build a device instance ID from Codec & node number. CORE-13702
---
drivers/wdm/audio/hdaudbus/hdaudbus.h | 1 +
drivers/wdm/audio/hdaudbus/pdo.cpp | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.h
b/drivers/wdm/audio/hdaudbus/hdaudbus.h
index 3a957c15062..e4412a5d133 100644
--- a/drivers/wdm/audio/hdaudbus/hdaudbus.h
+++ b/drivers/wdm/audio/hdaudbus/hdaudbus.h
@@ -6,6 +6,7 @@
#include <initguid.h>
#include <hdaudio.h>
#include <stdio.h>
+#include <ntstrsafe.h>
#define TAG_HDA 'bADH'
diff --git a/drivers/wdm/audio/hdaudbus/pdo.cpp b/drivers/wdm/audio/hdaudbus/pdo.cpp
index f93c6fa168f..ed12934d494 100644
--- a/drivers/wdm/audio/hdaudbus/pdo.cpp
+++ b/drivers/wdm/audio/hdaudbus/pdo.cpp
@@ -68,6 +68,7 @@ HDA_PDOQueryId(
PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
ULONG Length;
LPWSTR Device;
+ NTSTATUS Status;
/* get device extension */
DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
@@ -78,18 +79,23 @@ HDA_PDOQueryId(
if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
{
- UNIMPLEMENTED;
-
- // FIXME
- swprintf(DeviceName, L"%08x", 1);
- Length = wcslen(DeviceName) + 20;
+ Status = RtlStringCbPrintfW(DeviceName,
+ sizeof(DeviceName),
+ L"%02x%02x",
+ DeviceExtension->Codec->Addr,
+ DeviceExtension->AudioGroup->NodeId);
+ NT_ASSERT(NT_SUCCESS(Status));
+ Length = wcslen(DeviceName) + 1;
/* allocate result buffer*/
Device = (LPWSTR)AllocateItem(PagedPool, Length * sizeof(WCHAR));
if (!Device)
return STATUS_INSUFFICIENT_RESOURCES;
- swprintf(Device, L"%08x", 1);
+ Status = RtlStringCbCopyW(Device,
+ Length * sizeof(WCHAR),
+ DeviceName);
+ NT_ASSERT(NT_SUCCESS(Status));
DPRINT1("ID: %S\n", Device);
/* store result */