public static IEnumerable <KSJACK_DESCRIPTION> GetJackDescriptions(this IMMDevice device) { try { var deviceTopology = device.DeviceTopology(); var connector = deviceTopology.GetConnector(); var part = connector.GetConnectedToAsPart(); var jackDescription = part.KsJackDescription(); if (jackDescription == null) { return(null); } jackDescription.GetJackCount(out var conCount); if (conCount <= 0) { return(null); } var result = new List <KSJACK_DESCRIPTION>(); for (uint index = 0; index < conCount; index++) { result.Add(jackDescription.GetJackDescription(index)); } return(result); } catch { return(null); } }