diff --git a/PInvoke/Shared/Handles.cs b/PInvoke/Shared/Handles.cs index 5b3a2353..91be2306 100644 --- a/PInvoke/Shared/Handles.cs +++ b/PInvoke/Shared/Handles.cs @@ -2258,6 +2258,15 @@ namespace Vanara.PInvoke /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() => base.GetHashCode(); + /// Releases the ownership of the underlying handle and returns the current handle. + /// The value of the current handle. + public IntPtr ReleaseOwnership() + { + var ret = handle; + SetHandleAsInvalid(); + return ret; + } + /// /// Internal method that actually releases the handle. This is called by for valid handles and afterwards /// zeros the handle.