When I'm searching for a IsSystemSoundsSession I can't find the IconPath provided. On my system (Windows 10 1909). I'm getting IconPath @%SystemRoot%\\System32\\AudioSrv.Dll,-203
This file doesn't exist. (yes I expanded the variable for this, but that resolves to @C:\Windows\System32\AudioSrv.dll
(notice the '@').
Found a solution. The file that I'm searching for is located in C:\Windows\System32\AudioSrv.dll
. Notice how there is an @
part as first character? It looks like that is the problem. Not sure if this is a problem with NAudio or Windows API.
Code to retrieve the IconPath
MMDeviceEnumerator enumerator = new MMDeviceEnumerator(); var devices = enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active); foreach (var device in devices) { var sessions = device.AudioSessionManager.Sessions; for (int i = 0; i < sessions.Count; i++) { var session = sessions[i]; var iconPath = session.IconPath; // iconPath == '@%SystemRoot%\\System32\\AudioSrv.Dll,-203' } } }