Ejemplo n.º 1
0
 public MQSPIGetOut(int version)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { version });
     this.spiGetOutHdr           = new SPIGETOUTHDR();
     this.spiGetOutHdr.ID        = rfpVB_ID_GET_OUT;
     this.Version                = version;
     this.spiGetOutHdr.getStatus = 0;
     this.spiGetOutHdr.msgLength = 0;
     this.spiGetOutHdr.reserved  = 0;
     this.spiGetOutHdr.inherited = 0;
     this.spiGetOutHdr.qTimeHigh = 0;
     this.spiGetOutHdr.qTimeLow  = 0;
 }
Ejemplo n.º 2
0
        public int ReadStruct(byte[] b, int Offset, bool readMessage)
        {
            uint method = 0x28b;

            this.TrEntry(method, new object[] { b, Offset, readMessage });
            IntPtr zero   = IntPtr.Zero;
            int    length = this.GetLength();
            int    result = 0;

            try
            {
                zero = Marshal.AllocCoTaskMem(length);
                if (length > (b.Length - Offset))
                {
                    length = b.Length - Offset;
                }
                Marshal.Copy(b, Offset, zero, length);
                this.spiGetOutHdr = (SPIGETOUTHDR)Marshal.PtrToStructure(zero, typeof(SPIGETOUTHDR));
                length            = this.GetVersionLength();
                if (this.spigo != null)
                {
                    this.spigo.QueueEmpty = this.GetStatus & 1;
                    if (this.Version >= 2)
                    {
                        this.spigo.Inherited = this.Inherited;
                    }
                    if (this.Version >= 3)
                    {
                        this.spigo.QTime = (ulong)(0xffffffffL * this.QTimeHigh) + this.QTimeLow;
                    }
                }
                if (readMessage)
                {
                    Offset += length;
                    length  = Math.Min(this.Msg.Length, b.Length - Offset);
                    Buffer.BlockCopy(b, Offset, this.Msg, 0, length);
                }
                Marshal.FreeCoTaskMem(zero);
                result = Offset + length;
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }