Change SafeHandle derived base class HANDLE to SafeHANDLE. Yes, bonehead move to not do this correctly from the beginning.

pull/47/head
David Hall 2019-02-04 09:51:08 -07:00
parent abf525fb54
commit f1085cd3a5
44 changed files with 88 additions and 88 deletions

View File

@ -1557,7 +1557,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Safe image list handle. Be aware that if this is instantiated with ownership of the handle, it will be destroyed on disposal.
/// </summary>
public class SafeHIMAGELIST : HANDLE
public class SafeHIMAGELIST : SafeHANDLE
{
private IImageList iImageList;

View File

@ -920,7 +920,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HPROPSHEETPAGE instance at disposal using DestroyPropertySheetPage.</summary>
public class SafeHPROPSHEETPAGE : HANDLE
public class SafeHPROPSHEETPAGE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HPROPSHEETPAGE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1404,7 +1404,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HDPA instance at disposal using DPA_Destroy.</summary>
public class SafeHDPA : HANDLE
public class SafeHDPA : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HDPA"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1425,7 +1425,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HDSA instance at disposal using DSA_Destroy.</summary>
public class SafeHDSA : HANDLE
public class SafeHDSA : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HDSA"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -9818,7 +9818,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="BCRYPT_ALG_HANDLE"/> that is disposed using <see cref="BCryptCloseAlgorithmProvider"/>.</summary>
public class SafeBCRYPT_ALG_HANDLE : HANDLE
public class SafeBCRYPT_ALG_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeBCRYPT_ALG_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -9845,7 +9845,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="BCRYPT_HASH_HANDLE"/> that is disposed using <see cref="BCryptDestroyHash"/>.</summary>
public class SafeBCRYPT_HASH_HANDLE : HANDLE
public class SafeBCRYPT_HASH_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeBCRYPT_HASH_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -9867,7 +9867,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="BCRYPT_KEY_HANDLE"/> that is disposed using <see cref="BCryptDestroyKey"/>.</summary>
public class SafeBCRYPT_KEY_HANDLE : HANDLE
public class SafeBCRYPT_KEY_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeBCRYPT_KEY_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -9889,7 +9889,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="BCRYPT_SECRET_HANDLE"/> that is disposed using <see cref="BCryptDestroySecret"/>.</summary>
public class SafeBCRYPT_SECRET_HANDLE : HANDLE
public class SafeBCRYPT_SECRET_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeBCRYPT_SECRET_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -9911,7 +9911,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCryptBuffer"/> that is disposed using <see cref="BCryptFreeBuffer"/>.</summary>
public class SafeBCryptBuffer : HANDLE
public class SafeBCryptBuffer : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeBCryptBuffer"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -3182,7 +3182,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCRYPT_KEY_HANDLE"/> that is disposed using <see cref="NCryptFreeObject"/>.</summary>
public class SafeNCRYPT_KEY_HANDLE : HANDLE
public class SafeNCRYPT_KEY_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNCRYPT_KEY_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -3209,7 +3209,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCRYPT_PROV_HANDLE"/> that is disposed using <see cref="NCryptFreeObject"/>.</summary>
public class SafeNCRYPT_PROV_HANDLE : HANDLE
public class SafeNCRYPT_PROV_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNCRYPT_PROV_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -3236,7 +3236,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCRYPT_SECRET_HANDLE"/> that is disposed using <see cref="NCryptFreeObject"/>.</summary>
public class SafeNCRYPT_SECRET_HANDLE : HANDLE
public class SafeNCRYPT_SECRET_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNCRYPT_SECRET_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1444,7 +1444,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCRYPT_DESCRIPTOR_HANDLE"/> that is disposed using <see cref="NCryptCloseProtectionDescriptor"/>.</summary>
public class SafeNCRYPT_DESCRIPTOR_HANDLE : HANDLE
public class SafeNCRYPT_DESCRIPTOR_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNCRYPT_DESCRIPTOR_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1466,7 +1466,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="NCRYPT_STREAM_HANDLE"/> that is disposed using <see cref="NCryptStreamClose"/>.</summary>
public class SafeNCRYPT_STREAM_HANDLE : HANDLE
public class SafeNCRYPT_STREAM_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNCRYPT_STREAM_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -136,7 +136,7 @@ namespace Vanara.PInvoke
public static extern SafeHENHMETAFILE GetEnhMetaFile(string lpName);
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HENHMETAFILE"/> that is disposed using <see cref="DeleteEnhMetaFile"/>.</summary>
public class SafeHENHMETAFILE : HANDLE
public class SafeHENHMETAFILE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHENHMETAFILE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -56,7 +56,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="System.Runtime.InteropServices.SafeHandle"/> to a graphics bitmap object that releases a created HBITMAP instance at disposal using DeleteObject.
/// </summary>
public class SafeHBITMAP : HANDLE
public class SafeHBITMAP : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHBITMAP"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -84,7 +84,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a graphics bitmap object that releases a created HBRUSH instance at disposal using DeleteObject.
/// </summary>
public class SafeHBRUSH : HANDLE
public class SafeHBRUSH : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHBRUSH"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -110,7 +110,7 @@ namespace Vanara.PInvoke
}
/// <summary>A SafeHandle to track DC handles.</summary>
public class SafeHDC : HANDLE
public class SafeHDC : SafeHANDLE
{
private readonly IDeviceContext idc;
@ -173,7 +173,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a graphics bitmap object that releases a created HFONT instance at disposal using DeleteObject.
/// </summary>
public class SafeHFONT : HANDLE
public class SafeHFONT : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHFONT"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -202,7 +202,7 @@ namespace Vanara.PInvoke
/// Provides a <see cref="SafeHandle"/> to a graphics color palette object that releases a created HPALETTE instance at disposal
/// using DeleteObject.
/// </summary>
public class SafeHPALETTE : HANDLE
public class SafeHPALETTE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPALETTE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -230,7 +230,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a graphics bitmap object that releases a created HPEN instance at disposal using DeleteObject.
/// </summary>
public class SafeHPEN : HANDLE
public class SafeHPEN : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPEN"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -258,7 +258,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a graphics bitmap object that releases a created HRGN instance at disposal using DeleteObject.
/// </summary>
public class SafeHRGN : HANDLE
public class SafeHRGN : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHRGN"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -3963,7 +3963,7 @@ namespace Vanara.PInvoke
/// FindFirstFileNameTransactedW, FindFirstFileTransacted, FindFirstStreamTransactedW, or FindFirstStreamW functions.
/// </summary>
/// <seealso cref="Vanara.InteropServices.GenericSafeHandle"/>
public class SafeSearchHandle : HANDLE
public class SafeSearchHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeSearchHandle"/> class.</summary>
/// <param name="handle">The handle.</param>
@ -3977,7 +3977,7 @@ namespace Vanara.PInvoke
/// <summary>Represents a self-closing volume search handle opened by the FindFirstVolume.</summary>
/// <seealso cref="Vanara.InteropServices.GenericSafeHandle"/>
public class SafeVolumeSearchHandle : HANDLE
public class SafeVolumeSearchHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeVolumeSearchHandle"/> class.</summary>
/// <param name="handle">The handle.</param>

View File

@ -246,12 +246,12 @@ namespace Vanara.PInvoke
public static extern bool SetHandleInformation([In] IntPtr hObject, HANDLE_FLAG dwMask, HANDLE_FLAG dwFlags);
/// <summary>Provides a <see cref="SafeHandle"/> to a handle that releases a created HANDLE instance at disposal using CloseHandle.</summary>
public abstract class SafeKernelHandle : HANDLE, IKernelHandle
public abstract class SafeKernelHandle : SafeHANDLE, IKernelHandle
{
/// <summary>Initializes a new instance of the <see cref="SafeSyncHandle"/> class.</summary>
protected SafeKernelHandle() : base() { }
/// <summary>Initializes a new instance of the <see cref="HANDLE"/> class and assigns an existing handle.</summary>
/// <summary>Initializes a new instance of the <see cref="SafeHANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle"><see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).</param>
protected SafeKernelHandle(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }

View File

@ -1078,7 +1078,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a handle to a heap.</summary>
public class HHEAP : HANDLE
public class HHEAP : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HHEAP"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1910,7 +1910,7 @@ namespace Vanara.PInvoke
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HINSTANCE instance at disposal using FreeLibrary.</summary>
[PInvokeData("LibLoaderAPI.h")]
public class SafeHINSTANCE : HANDLE
public class SafeHINSTANCE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HINSTANCE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1948,7 +1948,7 @@ namespace Vanara.PInvoke
/// <summary>Represents a loaded resource handle.</summary>
/// <seealso cref="Vanara.InteropServices.GenericSafeHandle"/>
public class SafeResourceDataHandle : HANDLE
public class SafeResourceDataHandle : SafeHANDLE
{
private IntPtr bptr;
@ -1965,7 +1965,7 @@ namespace Vanara.PInvoke
/// <summary>Represents a resource data block handle.</summary>
/// <seealso cref="Vanara.InteropServices.GenericSafeHandle"/>
public class SafeResourceHandle : HANDLE
public class SafeResourceHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeResourceHandle"/> class.</summary>
public SafeResourceHandle() : base() { }

View File

@ -2711,7 +2711,7 @@ namespace Vanara.PInvoke
// ParameterCount );
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("memoryapi.h", MSDNShortId = "5021062F-E414-49A1-8B70-BE2A57A90E54")]
public static extern IntPtr VirtualAlloc2(HANDLE Process, IntPtr BaseAddress, SizeT Size, MEM_ALLOCATION_TYPE AllocationType, MEM_PROTECTION PageProtection, MEM_EXTENDED_PARAMETER[] ExtendedParameters, uint ParameterCount);
public static extern IntPtr VirtualAlloc2(SafeHANDLE Process, IntPtr BaseAddress, SizeT Size, MEM_ALLOCATION_TYPE AllocationType, MEM_PROTECTION PageProtection, MEM_EXTENDED_PARAMETER[] ExtendedParameters, uint ParameterCount);
/// <summary>
/// <para>
@ -2952,7 +2952,7 @@ namespace Vanara.PInvoke
// *ExtendedParameters, ULONG ParameterCount );
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("memoryapi.h", MSDNShortId = "84896A75-A917-4CA1-A417-650428E1FBFD")]
public static extern IntPtr VirtualAlloc2FromApp(HANDLE Process, IntPtr BaseAddress, SizeT Size, MEM_ALLOCATION_TYPE AllocationType, MEM_PROTECTION PageProtection, MEM_EXTENDED_PARAMETER[] ExtendedParameters, uint ParameterCount);
public static extern IntPtr VirtualAlloc2FromApp(SafeHANDLE Process, IntPtr BaseAddress, SizeT Size, MEM_ALLOCATION_TYPE AllocationType, MEM_PROTECTION PageProtection, MEM_EXTENDED_PARAMETER[] ExtendedParameters, uint ParameterCount);
/// <summary>
/// <para>

View File

@ -234,7 +234,7 @@ namespace Vanara.PInvoke
/// Provides a <see cref="SafeHandle"/> to a boundary descriptor that releases a created BoundaryDescriptorHandle instance at
/// disposal using DeleteBoundaryDescriptor.
/// </summary>
public class SafeBoundaryDescriptorHandle : HANDLE
public class SafeBoundaryDescriptorHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="BoundaryDescriptorHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -256,7 +256,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created NamespaceHandle instance at disposal using CloseHandle.</summary>
public class SafeNamespaceHandle : HANDLE
public class SafeNamespaceHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="NamespaceHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -2239,7 +2239,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a wait handle created by RegisterWaitForSingleObject and closed on disposal by UnregisterWaitEx.
/// </summary>
public class SafeRegisteredWaitHandle : HANDLE
public class SafeRegisteredWaitHandle : SafeHANDLE
{
private static readonly SafeEventHandle invalidEvent = new SafeEventHandle(new IntPtr(-1), false);

View File

@ -559,7 +559,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a timer queue that releases a created TimerQueueHandle instance at disposal using CloseHandle.
/// </summary>
public class SafeTimerQueueHandle : HANDLE
public class SafeTimerQueueHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="TimerQueueHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -583,7 +583,7 @@ namespace Vanara.PInvoke
/// Provides a <see cref="SafeHandle"/> to a timer queue timer that releases a created TimerQueueTimerHandle instance at disposal
/// using DeleteTimerQueueTimer.
/// </summary>
public class SafeTimerQueueTimerHandle : HANDLE
public class SafeTimerQueueTimerHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="TimerQueueTimerHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1078,7 +1078,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to an account context that releases a created HACTCTX instance at disposal using ReleaseActCtx.</summary>
public class SafeHACTCTX : HANDLE
public class SafeHACTCTX : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HACTCTX"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -3799,7 +3799,7 @@ namespace Vanara.PInvoke
}
/// <summary>Represents a search handle used in a subsequent call to the <c>FindNextVolumeMountPoint</c> and retrieved by <c>FindFirstVolumeMountPoint</c>.</summary>
public class SafeVolumeMountPointHandle : HANDLE
public class SafeVolumeMountPointHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeVolumeMountPointHandle"/> class.</summary>
/// <param name="handle">The handle.</param>

View File

@ -7648,7 +7648,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a UMS completion list that releases a created UmsCompletionList instance at disposal using DeleteUmsCompletionList.
/// </summary>
public class SafePUMS_COMPLETION_LIST : HANDLE
public class SafePUMS_COMPLETION_LIST : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafePUMS_COMPLETION_LIST"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -7667,7 +7667,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a UMS thread context that releases a created UmsThreadContext instance at disposal using DeleteUmsThreadContext.
/// </summary>
public class SafePUMS_CONTEXT : HANDLE
public class SafePUMS_CONTEXT : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafePUMS_CONTEXT"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -3256,7 +3256,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a WNet enumeration that releases a created WNetEnumHandle instance at disposal using WNetCloseEnum.</summary>
public class SafeWNetEnumHandle : HANDLE
public class SafeWNetEnumHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeWNetEnumHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -5144,7 +5144,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to an authentication identity that releases its handle at disposal using DsFreePasswordCredentials.</summary>
public class SafeAuthIdentityHandle : HANDLE
public class SafeAuthIdentityHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeAuthIdentityHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -5191,7 +5191,7 @@ namespace Vanara.PInvoke
/// <seealso cref="Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid"/>
[SuppressUnmanagedCodeSecurity, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PInvokeData("NTDSApi.h")]
public class SafeDsHandle : HANDLE
public class SafeDsHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeDsHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -5248,7 +5248,7 @@ namespace Vanara.PInvoke
/// <summary>A <see cref="SafeHandle"/> for the results from <see cref="DsReplicaGetInfo2W(SafeDsHandle, DS_REPL_INFO_TYPE, string, Guid?, string, string, DsReplInfoFlags, uint, out SafeDsReplicaInfo)"/>.</summary>
[PInvokeData("NTDSApi.h")]
public class SafeDsReplicaInfo : HANDLE
public class SafeDsReplicaInfo : SafeHANDLE
{
internal SafeDsReplicaInfo()
{

View File

@ -4135,7 +4135,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to an object that releases a created handle at disposal using NtClose.</summary>
public abstract class SafeNtHandle : HANDLE
public abstract class SafeNtHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNtHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1277,7 +1277,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a domain controller enumeration handle that is released at disposal using DsGetDcClose.
/// </summary>
public class SafeDCEnumHandle : HANDLE
public class SafeDCEnumHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeDCEnumHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -296,7 +296,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a buffer that releases a created handle at disposal using DsRoleFreeMemory.</summary>
public class SafeDcRoleBuffer : HANDLE
public class SafeDcRoleBuffer : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeDcRoleBuffer"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -2317,7 +2317,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a buffer that releases a created handle at disposal using NetApiBufferFree.</summary>
public class SafeNetApiBuffer : HANDLE
public class SafeNetApiBuffer : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeNetApiBuffer"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1445,7 +1445,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a safe array that releases a created SAFEARRAY instance at disposal using SafeArrayDestroy.</summary>
public class SafeSAFEARRAY : HANDLE
public class SafeSAFEARRAY : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeSAFEARRAY"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1852,7 +1852,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a LSA handle that releases a created LSA_HANDLE instance at disposal using LsaClose.
/// </summary>
public class SafeLSA_HANDLE : HANDLE
public class SafeLSA_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="LSA_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1876,7 +1876,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a LSA memory handle that releases a created LsaMemoryHandle instance at disposal using LsaFreeMemory.
/// </summary>
public class SafeLsaMemoryHandle : HANDLE
public class SafeLsaMemoryHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeLsaMemoryHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1893,7 +1893,7 @@ namespace Vanara.PInvoke
}
/// <summary>A <see cref="SafeHandle"/> for values that must be freed using the <see cref="LsaFreeReturnBuffer(IntPtr)"/> function.</summary>
public sealed class SafeLsaReturnBufferHandle : HANDLE
public sealed class SafeLsaReturnBufferHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeLsaReturnBufferHandle"/> class.</summary>
/// <param name="preexistingHandle">The pointer to the memory allocated by an Lsa function.</param>

View File

@ -187,7 +187,7 @@ namespace Vanara.PInvoke
public static extern bool IsValidSid(PSID pSid);
/// <summary>Provides a <see cref="SafeHandle"/> to an allocated SID that is released at disposal using FreeSid.</summary>
public class SafeAllocatedSID : HANDLE, ISecurityObject
public class SafeAllocatedSID : SafeHANDLE, ISecurityObject
{
/// <summary>Initializes a new instance of the <see cref="SafeAllocatedSID"/> class.</summary>
private SafeAllocatedSID() : base() { }

View File

@ -2880,7 +2880,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a service that releases a created SC_HANDLE instance at disposal using CloseServiceHandle.</summary>
public class SafeSC_HANDLE : HANDLE
public class SafeSC_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SC_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1751,7 +1751,7 @@ namespace Vanara.PInvoke
/// Provides a <see cref="SafeHandle"/> to a check results value that releases a created AUTHZ_ACCESS_CHECK_RESULTS_HANDLE instance
/// at disposal using AuthzFreeHandle.
/// </summary>
public class SafeAUTHZ_ACCESS_CHECK_RESULTS_HANDLE : HANDLE
public class SafeAUTHZ_ACCESS_CHECK_RESULTS_HANDLE : SafeHANDLE
{
/// <summary>
/// Initializes a new instance of the <see cref="AUTHZ_ACCESS_CHECK_RESULTS_HANDLE"/> class and assigns an existing handle.
@ -1777,7 +1777,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to an audit event that releases a created AUTHZ_AUDIT_EVENT_HANDLE instance at disposal using AuthzFreeAuditEvent.
/// </summary>
public class SafeAUTHZ_AUDIT_EVENT_HANDLE : HANDLE
public class SafeAUTHZ_AUDIT_EVENT_HANDLE : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="AUTHZ_AUDIT_EVENT_HANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1799,7 +1799,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="AUTHZ_CLIENT_CONTEXT_HANDLE"/> that is disposed using <see cref="AuthzFreeContext"/>.</summary>
public class SafeAUTHZ_CLIENT_CONTEXT_HANDLE : HANDLE
public class SafeAUTHZ_CLIENT_CONTEXT_HANDLE : SafeHANDLE
{
/// <summary>
/// Initializes a new instance of the <see cref="SafeAUTHZ_CLIENT_CONTEXT_HANDLE"/> class and assigns an existing handle.
@ -1825,7 +1825,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> for <see cref="AUTHZ_RESOURCE_MANAGER_HANDLE"/> that is disposed using <see cref="AuthzFreeResourceManager"/>.
/// </summary>
public class SafeAUTHZ_RESOURCE_MANAGER_HANDLE : HANDLE
public class SafeAUTHZ_RESOURCE_MANAGER_HANDLE : SafeHANDLE
{
/// <summary>
/// Initializes a new instance of the <see cref="SafeAUTHZ_RESOURCE_MANAGER_HANDLE"/> class and assigns an existing handle.

View File

@ -151,7 +151,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="LsaConnectionHandle"/> that is disposed using <see cref="LsaDeregisterLogonProcess"/>.</summary>
public class SafeLsaConnectionHandle : HANDLE
public class SafeLsaConnectionHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeLsaConnectionHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -461,7 +461,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> for <see cref="PSEC_WINNT_AUTH_IDENTITY_OPAQUE"/> that is disposed using <see cref="SspiFreeAuthIdentity"/>.
/// </summary>
public class SafePSEC_WINNT_AUTH_IDENTITY_OPAQUE : HANDLE
public class SafePSEC_WINNT_AUTH_IDENTITY_OPAQUE : SafeHANDLE
{
/// <summary>
/// Initializes a new instance of the <see cref="SafePSEC_WINNT_AUTH_IDENTITY_OPAQUE"/> class and assigns an existing handle.

View File

@ -1883,19 +1883,19 @@ namespace Vanara.PInvoke
/// <seealso cref="Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid"/>
/// <seealso cref="System.IEquatable{T}"/>
/// <seealso cref="Vanara.PInvoke.IHandle"/>
public class HANDLE : SafeHandleZeroOrMinusOneIsInvalid, IEquatable<HANDLE>, IHandle
public abstract class SafeHANDLE : SafeHandleZeroOrMinusOneIsInvalid, IEquatable<SafeHANDLE>, IHandle
{
/// <summary>Initializes a new instance of the <see cref="HANDLE"/> class.</summary>
public HANDLE() : base(true)
/// <summary>Initializes a new instance of the <see cref="SafeHANDLE"/> class.</summary>
public SafeHANDLE() : base(true)
{
}
/// <summary>Initializes a new instance of the <see cref="HANDLE"/> class and assigns an existing handle.</summary>
/// <summary>Initializes a new instance of the <see cref="SafeHANDLE"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
protected HANDLE(IntPtr preexistingHandle, bool ownsHandle = true) : base(ownsHandle) => SetHandle(preexistingHandle);
protected SafeHANDLE(IntPtr preexistingHandle, bool ownsHandle = true) : base(ownsHandle) => SetHandle(preexistingHandle);
/// <summary>Gets a value indicating whether this instance is null.</summary>
/// <value><c>true</c> if this instance is null; otherwise, <c>false</c>.</value>
@ -1905,18 +1905,18 @@ namespace Vanara.PInvoke
/// <param name="h1">The first handle.</param>
/// <param name="h2">The second handle.</param>
/// <returns>The result of the operator.</returns>
public static bool operator !=(HANDLE h1, HANDLE h2) => !(h1 == h2);
public static bool operator !=(SafeHANDLE h1, SafeHANDLE h2) => !(h1 == h2);
/// <summary>Implements the operator ==.</summary>
/// <param name="h1">The first handle.</param>
/// <param name="h2">The second handle.</param>
/// <returns>The result of the operator.</returns>
public static bool operator ==(HANDLE h1, HANDLE h2) => h1 is null || h2 is null ? false : h1.Equals(h2);
public static bool operator ==(SafeHANDLE h1, SafeHANDLE h2) => h1 is null || h2 is null ? false : h1.Equals(h2);
/// <summary>Determines whether the specified <see cref="HANDLE"/>, is equal to this instance.</summary>
/// <param name="other">The <see cref="HANDLE"/> to compare with this instance.</param>
/// <returns><c>true</c> if the specified <see cref="HANDLE"/> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(HANDLE other)
/// <summary>Determines whether the specified <see cref="SafeHANDLE"/>, is equal to this instance.</summary>
/// <param name="other">The <see cref="SafeHANDLE"/> to compare with this instance.</param>
/// <returns><c>true</c> if the specified <see cref="SafeHANDLE"/> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(SafeHANDLE other)
{
if (other is null)
return false;
@ -1928,7 +1928,7 @@ namespace Vanara.PInvoke
/// <summary>Determines whether the specified <see cref="System.Object"/>, is equal to this instance.</summary>
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
/// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj) => obj is HANDLE h ? Equals(h) : base.Equals(obj);
public override bool Equals(object obj) => obj is SafeHANDLE h ? Equals(h) : base.Equals(obj);
/// <summary>Returns a hash code for this instance.</summary>
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
@ -1939,7 +1939,7 @@ namespace Vanara.PInvoke
/// zeros the handle.
/// </summary>
/// <returns><c>true</c> to indicate successful release of the handle; <c>false</c> otherwise.</returns>
protected virtual bool InternalReleaseHandle() => true;
protected abstract bool InternalReleaseHandle();
/// <inheritdoc/>
protected override bool ReleaseHandle()

View File

@ -7639,7 +7639,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPIF"/> that is disposed using <see cref="PifMgr_CloseProperties"/>.</summary>
public class SafeHPIF : HANDLE
public class SafeHPIF : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPIF"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -7661,7 +7661,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPSXA"/> that is disposed using <see cref="SHDestroyPropSheetExtArray"/>.</summary>
public class SafeHPSXA : HANDLE
public class SafeHPSXA : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPSXA"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -5777,7 +5777,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HUSKEY"/> that is disposed using <see cref="SHRegCloseUSKey"/>.</summary>
public class SafeHUSKEY : HANDLE
public class SafeHUSKEY : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHUSKEY"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -775,7 +775,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a Windows that disposes a created HCURSOR instance at disposal using DestroyCursor.</summary>
public class SafeHCURSOR : HANDLE
public class SafeHCURSOR : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HCURSOR"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1105,7 +1105,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HDESK instance at disposal using CloseDesktop.</summary>
public class SafeHDESK : HANDLE
public class SafeHDESK : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HDESK"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
@ -1128,7 +1128,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a that releases a created HWINSTA instance at disposal using CloseWindowStation.</summary>
public class SafeHWINSTA : HANDLE
public class SafeHWINSTA : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HWINSTA"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1140,7 +1140,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> to a Windows that disposes a created HICON instance at disposal using DestroyIcon.</summary>
public class SafeHICON : HANDLE
public class SafeHICON : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHICON"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -4045,7 +4045,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HMENU"/> that is disposed using <see cref="DestroyMenu"/>.</summary>
public class SafeHMENU : HANDLE
public class SafeHMENU : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHMENU"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -6011,7 +6011,7 @@ namespace Vanara.PInvoke
/// <summary>
/// Provides a <see cref="SafeHandle"/> to a window or dialog that releases a created HWND instance at disposal using DestroyWindow.
/// </summary>
public class SafeHWND : HANDLE
public class SafeHWND : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="HWND"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -1072,7 +1072,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HHOOK"/> that is disposed using <see cref="UnhookWindowsHookEx"/>.</summary>
public class SafeHHOOK : HANDLE
public class SafeHHOOK : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHHOOK"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>

View File

@ -3647,7 +3647,7 @@ namespace Vanara.PInvoke
}
/// <summary>Represents a safe handle for a theme. Use in place of HTHEME.</summary>
public class SafeHTHEME : HANDLE
public class SafeHTHEME : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHTHEME"/> class.</summary>
/// <param name="hTheme">The h theme.</param>

View File

@ -607,7 +607,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HANIMATIONBUFFER"/> that is disposed using <see cref="EndBufferedAnimation"/>.</summary>
public class SafeHANIMATIONBUFFER : HANDLE
public class SafeHANIMATIONBUFFER : SafeHANDLE
{
private readonly bool fUpdateTarget = true;
@ -632,7 +632,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPAINTBUFFER"/> that is disposed using <see cref="EndBufferedPaint"/>.</summary>
public class SafeHPAINTBUFFER : HANDLE
public class SafeHPAINTBUFFER : SafeHANDLE
{
private readonly bool fUpdateTarget = true;

View File

@ -1774,7 +1774,7 @@ namespace Vanara.PInvoke
}
/// <summary>Provides a <see cref="SafeHandle"/> that is disposed using <see cref="InternetCloseHandle"/>.</summary>
public class SafeInternetHandle : HANDLE
public class SafeInternetHandle : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeInternetHandle"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>