diff --git a/Net/DistributedRoutingTable.cs b/Net/DistributedRoutingTable.cs index 5cfd98af..96dd0633 100644 --- a/Net/DistributedRoutingTable.cs +++ b/Net/DistributedRoutingTable.cs @@ -312,13 +312,13 @@ public class DistributedRoutingTable : IDisposable switch (pEventData.Value.type) { case DRT_EVENT_TYPE.DRT_EVENT_STATUS_CHANGED: - Drt.StatusChange?.Invoke(Drt, new(pEventData.Value)); + Drt?.StatusChange?.Invoke(Drt, new(pEventData.Value)); break; case DRT_EVENT_TYPE.DRT_EVENT_LEAFSET_KEY_CHANGED: - Drt.LeafSetKeyChange?.Invoke(Drt, new(pEventData.Value)); + Drt?.LeafSetKeyChange?.Invoke(Drt, new(pEventData.Value)); break; case DRT_EVENT_TYPE.DRT_EVENT_REGISTRATION_STATE_CHANGED: - Drt.RegistrationStateChange?.Invoke(Drt, new(pEventData.Value)); + Drt?.RegistrationStateChange?.Invoke(Drt, new(pEventData.Value)); break; } } diff --git a/PInvoke/CoreAudio/AudioClient.cs b/PInvoke/CoreAudio/AudioClient.cs index 5d0d2a6a..1e5a51aa 100644 --- a/PInvoke/CoreAudio/AudioClient.cs +++ b/PInvoke/CoreAudio/AudioClient.cs @@ -11,9 +11,13 @@ public static partial class CoreAudio /// Undocumented public const uint AMBISONICS_PARAM_VERSION_1 = 1; + /// public const uint WM_APP_GRAPHNOTIFY = 0x8002; + /// public const uint WM_APP_SESSION_DUCKED = 0x8000; + /// public const uint WM_APP_SESSION_UNDUCKED = 0x8001; + /// public const uint WM_APP_SESSION_VOLUME_CHANGED = 0x8003; /// Undocumented @@ -151,20 +155,25 @@ public static partial class CoreAudio HRESULT SetEchoCancellationRenderEndpoint([MarshalAs(UnmanagedType.LPWStr)] string endpointId); } + /// Undocumented [PInvokeData("audioclient.h")] [ComImport, Guid("28724C91-DF35-4856-9F76-D6A26413F3DF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAudioAmbisonicsControl { + /// Undocumented [PreserveSig] HRESULT SetData([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] AMBISONICS_PARAMS[] pAmbisonicsParams, uint cbAmbisonicsParams); + /// Undocumented [PreserveSig] HRESULT SetHeadTracking([MarshalAs(UnmanagedType.Bool)] bool bEnableHeadTracking); + /// Undocumented [PreserveSig] HRESULT GetHeadTracking([MarshalAs(UnmanagedType.Bool)] out bool pbEnableHeadTracking); + /// Undocumented [PreserveSig] HRESULT SetRotation(float X, float Y, float Z, float W); } diff --git a/PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs b/PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs index eaf6fc78..600cc8ee 100644 --- a/PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs +++ b/PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs @@ -508,7 +508,7 @@ namespace Vanara.PInvoke return ret | VARTYPE.VT_HRESULT; if (elemtype.IsCOMObject) { - var intf = elemtype.GetInterfaces(); + Type[] intf = elemtype.GetInterfaces(); if (intf.Contains(typeof(IStream))) return ret | VARTYPE.VT_STREAM; if (intf.Contains(typeof(IStorage))) return ret | VARTYPE.VT_STORAGE; return ret | VARTYPE.VT_UNKNOWN; diff --git a/PInvoke/User32/WindowBase.cs b/PInvoke/User32/WindowBase.cs index 20c68ac1..b92e585d 100644 --- a/PInvoke/User32/WindowBase.cs +++ b/PInvoke/User32/WindowBase.cs @@ -341,7 +341,7 @@ public class WindowBase : MarshalByRefObject, IDisposable, IWindowInstance, IWin catch (Exception ex) { if (!OnWndProcException(ex)) - throw ex; + throw; return IntPtr.Zero; } finally diff --git a/PInvoke/User32/WindowClass.cs b/PInvoke/User32/WindowClass.cs index 2e14e788..d1469e01 100644 --- a/PInvoke/User32/WindowClass.cs +++ b/PInvoke/User32/WindowClass.cs @@ -237,7 +237,7 @@ namespace Vanara.PInvoke { var cp = lParam.ToStructure().lpCreateParams; if (cp != IntPtr.Zero && GCHandle.FromIntPtr(cp).Target is IWindowInit wnd) - return wnd.InitWndProcOnNCCreate(hwnd, msg, Marshal.GetFunctionPointerForDelegate(wndProc), lParam); + return wnd.InitWndProcOnNCCreate(hwnd, msg, Marshal.GetFunctionPointerForDelegate(wndProc ?? throw new NullReferenceException()), lParam); } catch { } } diff --git a/System/Network/WindowsFirewall.cs b/System/Network/WindowsFirewall.cs index a9707bfb..8dfbc399 100644 --- a/System/Network/WindowsFirewall.cs +++ b/System/Network/WindowsFirewall.cs @@ -322,7 +322,9 @@ public class FirewallProfile /// public string[]? ExcludedInterfaces { +#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type. get => iPol.ExcludedInterfaces[type] is null ? null : (string[])Array.ConvertAll((object[])iPol.ExcludedInterfaces[type], o => o.ToString()); +#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type. set => iPol.ExcludedInterfaces[type] = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s); } @@ -624,7 +626,9 @@ public class FirewallRule : INamedEntity, IEquatable /// public string[]? InterfaceNames { +#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type. get => iRule.Interfaces is null ? null : (string[])Array.ConvertAll((object[])iRule.Interfaces, o => o.ToString()); +#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type. set => iRule.Interfaces = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s); } @@ -868,12 +872,12 @@ public class FirewallRule : INamedEntity, IEquatable private INetFwRule3 iRule3 => iRule as INetFwRule3 ?? throw new NotSupportedException(); /// - public bool Equals(FirewallRule other) => Equals(other.Name, Name) && - Equals(other.Profiles, Profiles) && - Equals(other.Direction, Direction) && - Equals(other.Enabled, Enabled) && - Equals(other.Action, Action) && - Equals(other.ApplicationName, ApplicationName); + public bool Equals(FirewallRule? other) => Equals(other?.Name, Name) && + Equals(other?.Profiles, Profiles) && + Equals(other?.Direction, Direction) && + Equals(other?.Enabled, Enabled) && + Equals(other?.Action, Action) && + Equals(other?.ApplicationName, ApplicationName); } /// Represents the rules for the Windows Firewall.