1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

windows: Properly handle return value of SetupDiOpenDevRegKey().

This fixes bug #499.
This commit is contained in:
Aurelien Jacobs 2014-11-27 17:41:23 +01:00
parent 59182fbbbf
commit b328a48b0f

View File

@ -353,9 +353,10 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
CONFIGRET cr;
/* check if this is the device we are looking for */
if (!(device_key = SetupDiOpenDevRegKey(device_info, &device_info_data,
device_key = SetupDiOpenDevRegKey(device_info, &device_info_data,
DICS_FLAG_GLOBAL, 0,
DIREG_DEV, KEY_QUERY_VALUE)))
DIREG_DEV, KEY_QUERY_VALUE);
if (device_key == INVALID_HANDLE_VALUE)
continue;
size = sizeof(value);
if (RegQueryValueExA(device_key, "PortName", NULL, &type, (LPBYTE)value,