public static IntPtr AllocInterface( NI.ObjInterface iftemplate, string name )
{
byte[] nameBytes = System.Text.Encoding.UTF8.GetBytes( name );
IntPtr iface = MDL.Alloc( NI.ObjInterfaceSize + nameBytes.Length + 1 );
IntPtr nameOffset = (IntPtr) ( iface.ToInt64() + NI.ObjInterfaceSize );
iftemplate.name = nameOffset;
Marshal.StructureToPtr( iftemplate, iface, false );
Marshal.Copy( nameBytes, 0, nameOffset, nameBytes.Length );
Marshal.WriteByte( nameOffset, nameBytes.Length, 0 );
return iface;
}