[StructLayout (LayoutKind.Sequential)] public struct SAFECOMMANDREC { public uint CellIndex; public uint ValIndex; public ushort ActualCommand; public ushort ACIndex; [MarshalAs (UnmanagedType.ByValArray, SizeConst=51)] public byte[] StringVal; } [StructLayout (LayoutKind.Sequential)] public class PROD_LIST { public byte cell_address; public byte product_id; [MarshalAs (UnmanagedType.ByValArray, SizeConst=17)] public byte[] prod_name; public Int16 model; public Int16 algo1; public Int16 algo2; public Int16 password1; public Int16 password2; } [StructLayout (LayoutKind.Sequential)] public class PROD_LIST_PTR { [MarshalAs (UnmanagedType.ByValArray, SizeConst=14)] public PROD_LIST[] plists; } [DllImport("dusafe32.dll", CharSet=CharSet.Ansi, EntryPoint="GenerateUpdateStr")] public static extern ushort GenerateUpdateStr(byte[] packet, SAFECOMMANDREC[] commands, short count, byte[] updatestr, PROD_LIST_PTR products, int scrambleorder);