public int ReadStruct(byte[] b, int Offset)
        {
            uint method = 0x42d;

            this.TrEntry(method, new object[] { b, Offset });
            IntPtr zero      = IntPtr.Zero;
            int    hdrLength = this.GetHdrLength();

            try
            {
                zero = Marshal.AllocCoTaskMem(this.GetLength());
                if (hdrLength > (b.Length - Offset))
                {
                    hdrLength = b.Length - Offset;
                }
                Marshal.Copy(b, Offset, zero, hdrLength);
                this.spiInOut = (SPIOPENINOUTHDR)Marshal.PtrToStructure(zero, typeof(SPIOPENINOUTHDR));
                Offset       += this.GetHdrVersionLength();
                Marshal.FreeCoTaskMem(zero);
            }
            finally
            {
                base.TrExit(method, Offset);
            }
            return(Offset);
        }
 public MQSPIOpenInOut(NmqiEnvironment nmqiEnv, int version) : base(nmqiEnv)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { nmqiEnv, version });
     this.spiInOut        = new SPIOPENINOUTHDR();
     this.spiInOut.ID     = rfpVB_ID_OPEN_INOUT;
     this.spiInOut.length = this.GetHdrLength();
     this.Version         = version;
 }