W
Wade_Dawson
Guest
Hi All. I'm trying to set "Friendly" names for audio subdevices created in a portcls WaveCyclic miniport driver. I've created MEDIACATEGORIES entries for the pin names and am able to set the first line displayed by Windows Sounds->Playback for the device (except, of course for KSNODETYPE_SPEAKER devices). The second line however seems to be what was specified in the inf file no matter how I try to change it. I'm setting the "FriendlyName" key on the device interface instance like so, but to no avail:
NTSTATUS CAdapterCommon::WriteFriendlyName(
_In_ PCWSTR friendlyName,
_In_ LPCGUID classGuid,
_In_ PCWSTR devName
)
{
PAGED_CODE();
HANDLE hKey = 0;
NTSTATUS status;
UNICODE_STRING usReference, usFriendlyNameValue;
DECLARE_UNICODE_STRING_SIZE(usSymLinkDevPath, (MAX_PATH * sizeof(WCHAR)));
DECLARE_CONST_UNICODE_STRING(usValueName, L"FriendlyName");
DECLARE_CONST_UNICODE_STRING(usClassId, L"CLSID");
DECLARE_CONST_UNICODE_STRING(usClassIdValue, Proxy_CLSID);
RtlUnicodeStringInit(&usReference, (PCWSTR)devName);
RtlUnicodeStringInit(&usFriendlyNameValue, (PCWSTR)friendlyName);
//register device interface and extract link path
status = IoRegisterDeviceInterface(m_pPhysicalDeviceObject, classGuid, &usReference, &usSymLinkDevPath);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "IoRegisterDeviceInterface failed with status %x", status, 0, 0, 0);
goto Exit;
}
status = IoOpenDeviceInterfaceRegistryKey(&usSymLinkDevPath, GENERIC_ALL, &hKey);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "IoOpenDeviceInterfaceRegistryKey failed with status %x", status, 0, 0, 0);
goto Exit;
}
status = ZwSetValueKey(hKey, (PUNICODE_STRING)&usValueName, 0, REG_SZ, (PVOID)(usFriendlyNameValue.Buffer), usFriendlyNameValue.Length);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "ZwSetValueKey failed for FriendlyName entry with status %x for subDevice Id %d", status, 0, 0, 0);
goto Exit;
}
//write the friendly name
status = ZwSetValueKey(hKey, (PUNICODE_STRING)&usClassId, 0, REG_SZ, (PVOID)(usClassIdValue.Buffer), usClassIdValue.MaximumLength);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "ZwSetValueKey failed for CLSID entry with status %x for subDevice Id %d", status, 0, 0, 0);
goto Exit;
}
Exit:
if (hKey)
ZwClose(hKey);
return status;
}
KsStudio displays my assigned FriendlyName correctly for the filter but "Windows Sounds->Playback" does not.
I see several interesting device interface properties that I'd like to try fiddling with (DEVPKEY_DeviceInterface_FriendlyName, DEVPKEY_Name) but all the examples are using IoSetDeviceInterfacePropertyData() and I have to support back to Windows 7, which does not support this api.
1.) Is it possible or useful to set these properties without using IoSetDeviceInterfacePropertyData?
2.) If I manage to set them, will windows7 endpoint builder pay any attention to them anyway?
Any help greatly appreciated!
PS. I've read the docs on how the EP builder gets the friendly names for the endpoints, but nothing that Ive found so far indicates where the adapter name comes from or how to set it.
Continue reading...
NTSTATUS CAdapterCommon::WriteFriendlyName(
_In_ PCWSTR friendlyName,
_In_ LPCGUID classGuid,
_In_ PCWSTR devName
)
{
PAGED_CODE();
HANDLE hKey = 0;
NTSTATUS status;
UNICODE_STRING usReference, usFriendlyNameValue;
DECLARE_UNICODE_STRING_SIZE(usSymLinkDevPath, (MAX_PATH * sizeof(WCHAR)));
DECLARE_CONST_UNICODE_STRING(usValueName, L"FriendlyName");
DECLARE_CONST_UNICODE_STRING(usClassId, L"CLSID");
DECLARE_CONST_UNICODE_STRING(usClassIdValue, Proxy_CLSID);
RtlUnicodeStringInit(&usReference, (PCWSTR)devName);
RtlUnicodeStringInit(&usFriendlyNameValue, (PCWSTR)friendlyName);
//register device interface and extract link path
status = IoRegisterDeviceInterface(m_pPhysicalDeviceObject, classGuid, &usReference, &usSymLinkDevPath);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "IoRegisterDeviceInterface failed with status %x", status, 0, 0, 0);
goto Exit;
}
status = IoOpenDeviceInterfaceRegistryKey(&usSymLinkDevPath, GENERIC_ALL, &hKey);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "IoOpenDeviceInterfaceRegistryKey failed with status %x", status, 0, 0, 0);
goto Exit;
}
status = ZwSetValueKey(hKey, (PUNICODE_STRING)&usValueName, 0, REG_SZ, (PVOID)(usFriendlyNameValue.Buffer), usFriendlyNameValue.Length);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "ZwSetValueKey failed for FriendlyName entry with status %x for subDevice Id %d", status, 0, 0, 0);
goto Exit;
}
//write the friendly name
status = ZwSetValueKey(hKey, (PUNICODE_STRING)&usClassId, 0, REG_SZ, (PVOID)(usClassIdValue.Buffer), usClassIdValue.MaximumLength);
if (!NT_SUCCESS(status))
{
LOG(Flag_Error, "ZwSetValueKey failed for CLSID entry with status %x for subDevice Id %d", status, 0, 0, 0);
goto Exit;
}
Exit:
if (hKey)
ZwClose(hKey);
return status;
}
KsStudio displays my assigned FriendlyName correctly for the filter but "Windows Sounds->Playback" does not.
I see several interesting device interface properties that I'd like to try fiddling with (DEVPKEY_DeviceInterface_FriendlyName, DEVPKEY_Name) but all the examples are using IoSetDeviceInterfacePropertyData() and I have to support back to Windows 7, which does not support this api.
1.) Is it possible or useful to set these properties without using IoSetDeviceInterfacePropertyData?
2.) If I manage to set them, will windows7 endpoint builder pay any attention to them anyway?
Any help greatly appreciated!
PS. I've read the docs on how the EP builder gets the friendly names for the endpoints, but nothing that Ive found so far indicates where the adapter name comes from or how to set it.
Continue reading...