Pkcs11Interop  5.1.2
Static Public Member Functions | Properties | List of all members
Net.Pkcs11Interop.Common.UnmanagedMemory Class Reference

Utility class that helps to manage unmanaged memory More...

Static Public Member Functions

static IntPtr Allocate (int size)
 Allocates unmanaged zero-filled memory More...
 
static void Free (ref IntPtr memory)
 Frees previously allocated unmanaged memory More...
 
static int SizeOf (Type structureType)
 Returns the unmanaged size of the structure in bytes More...
 
static void Write (IntPtr memory, byte[] content)
 Copies content of byte array to unmanaged memory More...
 
static void Write (IntPtr memory, object structure)
 Copies content of structure to unmanaged memory More...
 
static byte [] Read (IntPtr memory, int size)
 Creates copy of unmanaged memory contet More...
 
static object Read (IntPtr memory, Type structureType)
 Copies content of unmanaged memory to the newly allocated managed structure More...
 
static void Read (IntPtr memory, object structure)
 Copies content of unmanaged memory to the existing managed structure More...
 

Properties

static bool DebugModeEnabled [get, set]
 Flag indicating whether all memory allocations should be logged More...
 

Detailed Description

Utility class that helps to manage unmanaged memory

Member Function Documentation

◆ Allocate()

static IntPtr Net.Pkcs11Interop.Common.UnmanagedMemory.Allocate ( int  size)
static

Allocates unmanaged zero-filled memory

Parameters
sizeNumber of bytes required
Returns
Pointer to newly allocated unmanaged zero-filled memory

◆ Free()

static void Net.Pkcs11Interop.Common.UnmanagedMemory.Free ( ref IntPtr  memory)
static

Frees previously allocated unmanaged memory

Parameters
memoryPointer to the previously allocated unmanaged memory

◆ Read() [1/3]

static byte [] Net.Pkcs11Interop.Common.UnmanagedMemory.Read ( IntPtr  memory,
int  size 
)
static

Creates copy of unmanaged memory contet

Parameters
memoryMemory that should be copied
sizeNumber of bytes that should be copied
Returns
Copy of unmanaged memory contet

◆ Read() [2/3]

static object Net.Pkcs11Interop.Common.UnmanagedMemory.Read ( IntPtr  memory,
Type  structureType 
)
static

Copies content of unmanaged memory to the newly allocated managed structure

Parameters
memoryMemory that should be copied
structureTypeType of structure that should be created
Returns
Structure of requested type

◆ Read() [3/3]

static void Net.Pkcs11Interop.Common.UnmanagedMemory.Read ( IntPtr  memory,
object  structure 
)
static

Copies content of unmanaged memory to the existing managed structure

Parameters
memoryMemory that should be copied
structureObject to which data should be copied

◆ SizeOf()

static int Net.Pkcs11Interop.Common.UnmanagedMemory.SizeOf ( Type  structureType)
static

Returns the unmanaged size of the structure in bytes

Parameters
structureTypeType of structure whose size should be determined
Returns
Unmanaged size of the structure in bytes

◆ Write() [1/2]

static void Net.Pkcs11Interop.Common.UnmanagedMemory.Write ( IntPtr  memory,
byte []  content 
)
static

Copies content of byte array to unmanaged memory

Parameters
memoryPreviously allocated unmanaged memory to copy to
contentByte array to copy from

◆ Write() [2/2]

static void Net.Pkcs11Interop.Common.UnmanagedMemory.Write ( IntPtr  memory,
object  structure 
)
static

Copies content of structure to unmanaged memory

Parameters
memoryPreviously allocated unmanaged memory to copy to
structureStructure to copy from

Property Documentation

◆ DebugModeEnabled

bool Net.Pkcs11Interop.Common.UnmanagedMemory.DebugModeEnabled
staticgetset

Flag indicating whether all memory allocations should be logged


The documentation for this class was generated from the following file: