[HDAUDBUS] Build a device instance ID from Codec & node number. CORE-13702

This commit is contained in:
Thomas Faber 2019-09-27 13:13:49 +02:00
parent 96ee4509e5
commit 6ec38aa942
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
2 changed files with 13 additions and 6 deletions

View file

@ -6,6 +6,7 @@
#include <initguid.h>
#include <hdaudio.h>
#include <stdio.h>
#include <ntstrsafe.h>
#define TAG_HDA 'bADH'

View file

@ -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 */