Arkadiusz Hiler : winepulse.drv: Set device path for all devices.
Alexandre Julliard
julliard at winehq.org
Tue Jun 28 15:54:15 CDT 2022
Module: wine
Branch: master
Commit: 3180ed32377a5109c6d986e291d28053562360a4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3180ed32377a5109c6d986e291d28053562360a4
Author: Arkadiusz Hiler <ahiler at codeweavers.com>
Date: Mon Jun 27 16:57:32 2022 +0300
winepulse.drv: Set device path for all devices.
Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
---
dlls/winepulse.drv/pulse.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index 0e504b6b6dd..42d73db45f9 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -2207,27 +2207,26 @@ static BOOL get_device_path(PhysDevice *dev, struct get_prop_value_params *param
{
const GUID *guid = params->guid;
UINT serial_number;
- const char *fmt;
char path[128];
int len;
+ /* As hardly any audio devices have serial numbers, Windows instead
+ appears to use a persistent random number. We emulate this here
+ by instead using the last 8 hex digits of the GUID. */
+ serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7];
+
switch (dev->bus_type) {
case phys_device_bus_pci:
- fmt = "{1}.HDAUDIO\\FUNC_01&VEN_%04X&DEV_%04X\\%u&%08X";
+ len = sprintf(path, "{1}.HDAUDIO\\FUNC_01&VEN_%04X&DEV_%04X\\%u&%08X", dev->vendor_id, dev->product_id, dev->index, serial_number);
break;
case phys_device_bus_usb:
- fmt = "{1}.USB\\VID_%04X&PID_%04X\\%u&%08X";
+ len = sprintf(path, "{1}.USB\\VID_%04X&PID_%04X\\%u&%08X", dev->vendor_id, dev->product_id, dev->index, serial_number);
break;
default:
- return FALSE;
+ len = sprintf(path, "{1}.ROOT\\MEDIA\\%04u", dev->index);
+ break;
}
- /* As hardly any audio devices have serial numbers, Windows instead
- appears to use a persistent random number. We emulate this here
- by instead using the last 8 hex digits of the GUID. */
- serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7];
-
- len = sprintf(path, fmt, dev->vendor_id, dev->product_id, dev->index, serial_number);
ntdll_umbstowcs(path, len + 1, params->wstr, ARRAY_SIZE(params->wstr));
params->vt = VT_LPWSTR;
More information about the wine-cvs
mailing list