One of the most important classes to know when porting applications from Win32 to .NET is the Marshal class.

The Marshal class contains many routines to assist in moving memory between Win32 and the CLR, converting data types from .NET to Win32 compatible ones, among others.

The most important among them, would be what I would consider the PtrToStructure, and StructureToPtr static class functions of the Marshal class.

PtrToStructure takes an IntPtr (which is the equivalent of a Win32 Pointer), and converts it to a record in .NET.  PtrToStructure doesn't accept as it's parameter, a record. However, it can be coerced to accept a parameter specifying the typeof the object to return, and this can be a record.

StructureToPtr converts a native .NET class or record into a Win32 structure. It does this by taking a record which (most of the time has) Marshal attributes declared on the record, and lays it out accordingly into the memory area specified by an IntPtr.

To be continued...