diff --git a/PInvoke/Drt/Drt.cs b/PInvoke/Drt/Drt.cs index c1e36216..e61fcc96 100644 --- a/PInvoke/Drt/Drt.cs +++ b/PInvoke/Drt/Drt.cs @@ -745,31 +745,31 @@ public static partial class Drt public static extern HRESULT DrtCreateIpv6UdpTransport(DRT_SCOPE scope, uint dwScopeId, uint dwLocalityThreshold, ref ushort pwPort, out SafeHDRT_TRANSPORT phTransport); /// - /// The DrtCreateNullSecurityProvider function creates a null security provider. This security provider does not require - /// nodes to authenticate keys. + /// The DrtCreateNullSecurityProvider function creates a null security provider. This security provider does not require nodes to + /// authenticate keys. /// /// Pointer to the DRT_SETTINGS structure. /// /// This function returns S_OK on success. Other possible values include: /// /// - /// Return code - /// Description + /// Return code + /// Description /// /// - /// E_OUTOFMEMORY - /// The system cannot allocate memory for the provider. + /// E_OUTOFMEMORY + /// The system cannot allocate memory for the provider. /// /// - /// DRT_E_INVALID_ARG - /// ppDrtSecurityProvider is NULL. + /// DRT_E_INVALID_ARG + /// ppDrtSecurityProvider is NULL. /// /// /// - // https://docs.microsoft.com/en-us/windows/win32/api/drt/nf-drt-drtcreatenullsecurityprovider HRESULT - // DrtCreateNullSecurityProvider( DRT_SECURITY_PROVIDER **ppSecurityProvider ); - [DllImport(Lib_DrtProv, SetLastError = false, ExactSpelling = true)] + // https://learn.microsoft.com/en-us/windows/win32/api/drt/nf-drt-drtcreatenullsecurityprovider + // HRESULT DrtCreateNullSecurityProvider( [out] DRT_SECURITY_PROVIDER **ppSecurityProvider ); [PInvokeData("drt.h", MSDNShortId = "NF:drt.DrtCreateNullSecurityProvider")] + [DllImport(Lib_Drt, SetLastError = false, ExactSpelling = true)] public static extern HRESULT DrtCreateNullSecurityProvider(out IntPtr ppSecurityProvider); /// @@ -1510,7 +1510,7 @@ public static partial class Drt // const DRT_SEARCH_INFO *pInfo, ULONG timeout, HANDLE hEvent, const PVOID pvContext, HDRT_SEARCH_CONTEXT *hSearchContext ); [DllImport(Lib_Drt, SetLastError = false, ExactSpelling = true)] [PInvokeData("drt.h", MSDNShortId = "NF:drt.DrtStartSearch")] - public static extern HRESULT DrtStartSearch(HDRT hDrt, in DRT_DATA pKey, in DRT_SEARCH_INFO pInfo, uint timeout, HANDLE hEvent, + public static extern HRESULT DrtStartSearch(HDRT hDrt, in DRT_DATA pKey, in DRT_SEARCH_INFO pInfo, uint timeout, HEVENT hEvent, [In, Optional] IntPtr pvContext, out HDRT_SEARCH_CONTEXT hSearchContext); /// The DrtStartSearch function searches the DRT for a key using criteria specified in the DRT_SEARCH_INFO structure. @@ -1579,7 +1579,7 @@ public static partial class Drt // const DRT_SEARCH_INFO *pInfo, ULONG timeout, HANDLE hEvent, const PVOID pvContext, HDRT_SEARCH_CONTEXT *hSearchContext ); [DllImport(Lib_Drt, SetLastError = false, ExactSpelling = true)] [PInvokeData("drt.h", MSDNShortId = "NF:drt.DrtStartSearch")] - public static extern HRESULT DrtStartSearch(HDRT hDrt, in DRT_DATA pKey, [In, Optional] IntPtr pInfo, uint timeout, HANDLE hEvent, + public static extern HRESULT DrtStartSearch(HDRT hDrt, in DRT_DATA pKey, [In, Optional] IntPtr pInfo, uint timeout, HEVENT hEvent, [In, Optional] IntPtr pvContext, out HDRT_SEARCH_CONTEXT hSearchContext); /// The DrtUnregisterKey function deregisters a key from the DRT. @@ -1781,7 +1781,7 @@ public static partial class Drt public static bool operator ==(DRT_BOOTSTRAP_RESOLVE_CONTEXT h1, DRT_BOOTSTRAP_RESOLVE_CONTEXT h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is DRT_BOOTSTRAP_RESOLVE_CONTEXT h && handle == h.handle; + public override bool Equals(object? obj) => obj is DRT_BOOTSTRAP_RESOLVE_CONTEXT h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -1806,7 +1806,7 @@ public static partial class Drt /// Performs an implicit conversion from to []. /// The instance. /// The result of the conversion. - public static implicit operator byte[](DRT_DATA d) => d.pb == IntPtr.Zero ? null : d.GetArray(); + public static implicit operator byte[]?(DRT_DATA d) => d.pb == IntPtr.Zero ? null : d.GetArray(); } /// @@ -1928,7 +1928,7 @@ public static partial class Drt public IntPtr pAddresses; /// Gets the array of SOCKADDR_STORAGE addresses returned by the bootstrap provider. - public SOCKADDR_STORAGE[] Addresses => pAddresses.ToArray((int)cntAddress); + public SOCKADDR_STORAGE[] Addresses => pAddresses.ToArray((int)cntAddress) ?? new SOCKADDR_STORAGE[0]; } } } @@ -2233,7 +2233,7 @@ public static partial class Drt public static bool operator ==(HDRT h1, HDRT h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is HDRT h && handle == h.handle; + public override bool Equals(object? obj) => obj is HDRT h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -2281,7 +2281,7 @@ public static partial class Drt public static bool operator ==(HDRT_REGISTRATION_CONTEXT h1, HDRT_REGISTRATION_CONTEXT h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is HDRT_REGISTRATION_CONTEXT h && handle == h.handle; + public override bool Equals(object? obj) => obj is HDRT_REGISTRATION_CONTEXT h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -2329,7 +2329,7 @@ public static partial class Drt public static bool operator ==(HDRT_SEARCH_CONTEXT h1, HDRT_SEARCH_CONTEXT h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is HDRT_SEARCH_CONTEXT h && handle == h.handle; + public override bool Equals(object? obj) => obj is HDRT_SEARCH_CONTEXT h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); @@ -2377,7 +2377,7 @@ public static partial class Drt public static bool operator ==(HDRT_TRANSPORT h1, HDRT_TRANSPORT h2) => h1.Equals(h2); /// - public override bool Equals(object obj) => obj is HDRT_TRANSPORT h && handle == h.handle; + public override bool Equals(object? obj) => obj is HDRT_TRANSPORT h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode();