diff --git a/Core/InteropServices/SafeCoTaskMemHandle.cs b/Core/InteropServices/SafeCoTaskMemHandle.cs
index affc40c3..35e6035b 100644
--- a/Core/InteropServices/SafeCoTaskMemHandle.cs
+++ b/Core/InteropServices/SafeCoTaskMemHandle.cs
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security;
using Vanara.Extensions;
+using Vanara.PInvoke;
namespace Vanara.InteropServices
{
@@ -43,12 +44,12 @@ namespace Vanara.InteropServices
/// The handle.
/// The size of memory allocated to the handle, in bytes.
/// if set to true if this class is responsible for freeing the memory on disposal.
- public SafeCoTaskMemHandle(IntPtr handle, int size, bool ownsHandle = true) : base(handle, size, ownsHandle) { }
+ public SafeCoTaskMemHandle(IntPtr handle, SizeT size, bool ownsHandle = true) : base(handle, size, ownsHandle) { }
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- public SafeCoTaskMemHandle(int size) : base(size) { }
+ public SafeCoTaskMemHandle(SizeT size) : base(size) { }
/// Allocates from unmanaged memory to represent an array of pointers and marshals the unmanaged pointers (IntPtr) to the native array equivalent.
/// Array of unmanaged pointers
diff --git a/Core/InteropServices/SafeHGlobalHandle.cs b/Core/InteropServices/SafeHGlobalHandle.cs
index 2e1660ee..c04e44d6 100644
--- a/Core/InteropServices/SafeHGlobalHandle.cs
+++ b/Core/InteropServices/SafeHGlobalHandle.cs
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security;
using Vanara.Extensions;
+using Vanara.PInvoke;
namespace Vanara.InteropServices
{
@@ -42,12 +43,12 @@ namespace Vanara.InteropServices
/// The handle.
/// The size of memory allocated to the handle, in bytes.
/// if set to true if this class is responsible for freeing the memory on disposal.
- public SafeHGlobalHandle(IntPtr handle, int size, bool ownsHandle = true) : base(handle, size, ownsHandle) { }
+ public SafeHGlobalHandle(IntPtr handle, SizeT size, bool ownsHandle = true) : base(handle, size, ownsHandle) { }
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- public SafeHGlobalHandle(int size) : base(size) { }
+ public SafeHGlobalHandle(SizeT size) : base(size) { }
/// Allocates from unmanaged memory to represent an array of pointers and marshals the unmanaged pointers (IntPtr) to the native array equivalent.
/// Array of unmanaged pointers
diff --git a/Core/InteropServices/SafeMemoryHandle.cs b/Core/InteropServices/SafeMemoryHandle.cs
index 9fb7449e..31d4de07 100644
--- a/Core/InteropServices/SafeMemoryHandle.cs
+++ b/Core/InteropServices/SafeMemoryHandle.cs
@@ -203,7 +203,7 @@ namespace Vanara.InteropServices
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- protected SafeMemoryHandle(int size = 0) : base(IntPtr.Zero, true)
+ protected SafeMemoryHandle(SizeT size = default) : base(IntPtr.Zero, true)
{
if (size < 0)
throw new ArgumentOutOfRangeException(nameof(size), "The value of this argument must be non-negative");
@@ -217,7 +217,7 @@ namespace Vanara.InteropServices
/// The handle.
/// The size of memory allocated to the handle, in bytes.
/// if set to true if this class is responsible for freeing the memory on disposal.
- protected SafeMemoryHandle(IntPtr handle, int size, bool ownsHandle) : base(handle, ownsHandle) => sz = size;
+ protected SafeMemoryHandle(IntPtr handle, SizeT size, bool ownsHandle) : base(handle, ownsHandle) => sz = size;
/// Allocates from unmanaged memory to represent an array of pointers and marshals the unmanaged pointers (IntPtr) to the native array equivalent.
/// Array of unmanaged pointers
@@ -276,13 +276,13 @@ namespace Vanara.InteropServices
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- protected SafeMemoryHandleExt(int size) : base(size) { }
+ protected SafeMemoryHandleExt(SizeT size) : base(size) { }
/// Initializes a new instance of the class.
/// The handle.
/// The size of memory allocated to the handle, in bytes.
/// if set to true if this class is responsible for freeing the memory on disposal.
- protected SafeMemoryHandleExt(IntPtr handle, int size, bool ownsHandle) : base(handle, size, ownsHandle) { }
+ protected SafeMemoryHandleExt(IntPtr handle, SizeT size, bool ownsHandle) : base(handle, size, ownsHandle) { }
/// Allocates from unmanaged memory to represent an array of pointers and marshals the unmanaged pointers (IntPtr) to the native array equivalent.
/// Array of unmanaged pointers
diff --git a/PInvoke/Kernel32/HeapApi.cs b/PInvoke/Kernel32/HeapApi.cs
index efc71aa4..67deb58f 100644
--- a/PInvoke/Kernel32/HeapApi.cs
+++ b/PInvoke/Kernel32/HeapApi.cs
@@ -1401,7 +1401,7 @@ namespace Vanara.PInvoke
/// The handle created by .
/// if set to true this safe handle disposes the handle when done.
/// The size, in bytes, of the allocated heap memory, if known.
- public SafeHeapBlock(IntPtr ptr, int size, bool ownsHandle = true) : base(ptr, size, ownsHandle)
+ public SafeHeapBlock(IntPtr ptr, SizeT size, bool ownsHandle = true) : base(ptr, size, ownsHandle)
{
}
@@ -1410,7 +1410,7 @@ namespace Vanara.PInvoke
/// The handle created by .
/// if set to true this safe handle disposes the handle when done.
/// The size, in bytes, of the allocated heap memory, if known.
- public SafeHeapBlock(HHEAP hHeap, IntPtr ptr, int size, bool ownsHandle = true) : base(ptr, size, ownsHandle)
+ public SafeHeapBlock(HHEAP hHeap, IntPtr ptr, SizeT size, bool ownsHandle = true) : base(ptr, size, ownsHandle)
{
if (hHeap.IsNull) throw new ArgumentNullException(nameof(hHeap));
mm.HeapHandle = hHeap;
@@ -1419,7 +1419,7 @@ namespace Vanara.PInvoke
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- public SafeHeapBlock(int size) : base(size)
+ public SafeHeapBlock(SizeT size) : base(size)
{
}
@@ -1461,7 +1461,7 @@ namespace Vanara.PInvoke
///
///
/// size - The value of this argument must be non-negative
- public SafeHeapBlock(HHEAP hHeap, int size = 0, HeapFlags flags = 0) : this(hHeap, IntPtr.Zero, 0)
+ public SafeHeapBlock(HHEAP hHeap, SizeT size = default, HeapFlags flags = 0) : this(hHeap, IntPtr.Zero, 0)
{
if (size < 0)
throw new ArgumentOutOfRangeException(nameof(size), "The value of this argument must be non-negative");
diff --git a/PInvoke/Kernel32/InteropServices/SafeLocalHandle.cs b/PInvoke/Kernel32/InteropServices/SafeLocalHandle.cs
index 253678d9..2be9b44c 100644
--- a/PInvoke/Kernel32/InteropServices/SafeLocalHandle.cs
+++ b/PInvoke/Kernel32/InteropServices/SafeLocalHandle.cs
@@ -51,12 +51,12 @@ namespace Vanara.InteropServices
/// The handle.
/// The size of memory allocated to the handle, in bytes.
/// if set to true if this class is responsible for freeing the memory on disposal.
- public SafeLocalHandle(HLOCAL handle, int size, bool ownsHandle = true) : base((IntPtr)handle, size, ownsHandle) { }
+ public SafeLocalHandle(HLOCAL handle, SizeT size, bool ownsHandle = true) : base((IntPtr)handle, size, ownsHandle) { }
/// Initializes a new instance of the class.
/// The size of memory to allocate, in bytes.
/// size - The value of this argument must be non-negative
- public SafeLocalHandle(int size) : base(size) { }
+ public SafeLocalHandle(SizeT size) : base(size) { }
///
/// Allocates from unmanaged memory to represent an array of pointers and marshals the unmanaged pointers (IntPtr) to the native