Pkcs11Interop  4.0.0
Static Public Member Functions | 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...
 

Detailed Description

Utility class that helps to manage unmanaged memory

Member Function Documentation

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
static void Net.Pkcs11Interop.Common.UnmanagedMemory.Free ( ref IntPtr  memory)
static

Frees previously allocated unmanaged memory

Parameters
memoryPointer to the previously allocated unmanaged memory
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
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
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
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
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
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

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