private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext) { var device = new DirectSoundDeviceInfo(); if (lpGuid == IntPtr.Zero) { device.Guid = Guid.Empty; } else { byte[] guidBytes = new byte[16]; Marshal.Copy(lpGuid, guidBytes, 0, 16); device.Guid = new Guid(guidBytes); } device.Description = Marshal.PtrToStringAnsi(lpcstrDescription); if (lpcstrModule != null) { device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule); } devices.Add(device); return(true); }
private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext) { var device = new DirectSoundDeviceInfo(); if (lpGuid == IntPtr.Zero) { device.Guid = Guid.Empty; } else { byte[] guidBytes = new byte[16]; Marshal.Copy(lpGuid, guidBytes, 0, 16); device.Guid = new Guid(guidBytes); } device.Description = Marshal.PtrToStringAnsi(lpcstrDescription); if (lpcstrModule != null) { device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule); } devices.Add(device); return true; }