Ejemplo n.º 1
0
 private void UnpackCallData()
 {
     this.callResult  = MarshalingUtils.GetUInt64FromBigEndianBytes(this.callData, 0);
     this.ReturnValue = MarshalingUtils.GetUInt64FromBigEndianBytes(this.callData, MarshalingUtils.SizeOf(typeof(ulong)));
     if (this.Options.PostMethodCall != XDRPCPostMethodCall.None)
     {
         this.PostMethodCallReturnValue = MarshalingUtils.GetUInt64FromBigEndianBytes(this.callData, 2 * MarshalingUtils.SizeOf(typeof(ulong)));
     }
     for (int index1 = 0; index1 < this.IntegerArguments.Length; ++index1)
     {
         int index2 = index1 + 2;
         if (this.bufferData[index2].BufferSize > 0)
         {
             byte[] data = new byte[this.bufferData[index2].BufferSize];
             Array.Copy((Array)this.callData, this.bufferData[index2].BufferOffset, (Array)data, 0, data.Length);
             this.IntegerArguments[index1].UnpackBufferData(data);
         }
     }
     for (int index = 0; index < this.IntegerArguments.Length; ++index)
     {
         if (this.referenceData[index].BufferSize > 0)
         {
             byte[] data = new byte[this.referenceData[index].BufferSize];
             Array.Copy((Array)this.callData, this.referenceData[index].BufferOffset, (Array)data, 0, data.Length);
             this.IntegerArguments[index].UnpackReferenceData(data);
         }
     }
 }
Ejemplo n.º 2
0
        private void WaitForCallCompletion(TimeSpan timeout)
        {
            if (this.NoDevkit)
            {
                return;
            }
            byte[]   numArray = new byte[XDRPCExecutionState.ArgumentSize];
            DateTime now1     = DateTime.Now;
            ulong    fromBigEndianBytes;

            do
            {
                uint BytesReceived;
                this.Console.ReceiveBinary(this.connectionId, numArray, (uint)numArray.Length, out BytesReceived);
                if ((long)BytesReceived != (long)XDRPCExecutionState.ArgumentSize)
                {
                    throw new XDRPCInvalidResponseException("Unexpected binary chunk size received from console");
                }
                fromBigEndianBytes = MarshalingUtils.GetUInt64FromBigEndianBytes(numArray, 0);
                if (fromBigEndianBytes == 997UL)
                {
                    DateTime now2 = DateTime.Now;
                    if (now2.Subtract(now1) > timeout)
                    {
                        throw new XDRPCTimeoutException("Timed out while waiting for function to execute, try setting a longer executionTimeoutPeriod in XDRPCExecutionOptions if longer timeout period is needed", now1, now2, timeout);
                    }
                }
            }while (fromBigEndianBytes == 997UL);
            if (fromBigEndianBytes != 0UL)
            {
                throw new XDRPCInvalidResponseException(string.Format("Received invalid status from console: {0}", (object)fromBigEndianBytes));
            }
        }
Ejemplo n.º 3
0
 internal static byte[] GetBigEndianBytes(ulong v)
 {
     byte[] bytes = BitConverter.GetBytes(v);
     if (BitConverter.IsLittleEndian)
     {
         MarshalingUtils.ReverseBytes(bytes);
     }
     return(bytes);
 }
Ejemplo n.º 4
0
 public void UnpackBufferData(byte[] data)
 {
     if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out)
     {
         return;
     }
     if (BitConverter.IsLittleEndian)
     {
         MarshalingUtils.ReverseBytes(data);
     }
     this.Value = (T)(XDRPCArgumentInfo <T> .GetValue(data) ?? (object)default(T));
 }
Ejemplo n.º 5
0
 public void UnpackBufferData(byte[] data)
 {
     if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out)
     {
         return;
     }
     if (BitConverter.IsLittleEndian && this.Encoding == Encoding.Unicode)
     {
         MarshalingUtils.ReverseBytes(data, 2);
     }
     this.Value = this.Encoding.GetString(data, 0, this.GetReturnedStringLength(data));
 }
Ejemplo n.º 6
0
        public int GetRequiredBufferSize()
        {
            switch (this.PassBy)
            {
            case ArgumentType.ByRef:
            case ArgumentType.Out:
                return(MarshalingUtils.SizeOf(typeof(T)));

            default:
                return(0);
            }
        }
Ejemplo n.º 7
0
        public byte[] PackBufferData()
        {
            if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out)
            {
                return((byte[])null);
            }
            byte[] bytes = XDRPCArgumentInfo <T> .GetBytes((object)this.Value);

            if (BitConverter.IsLittleEndian)
            {
                MarshalingUtils.ReverseBytes(bytes);
            }
            return(bytes);
        }
Ejemplo n.º 8
0
        private void FillPointerBufferData(
            out XDRPCStructArgumentInfo <T> .StructBufferData data,
            List <XDRPCStructArgumentInfo <T> .StructBufferData> bufferDataList,
            int packAttribute)
        {
            data = new XDRPCStructArgumentInfo <T> .StructBufferData();

            data.BufferSize = MarshalingUtils.SizeOf(typeof(uint));
            int packAlignment = this.CalculatePackAlignment(packAttribute, data.BufferSize);

            data.BufferOffset   = this.GetCurrentOffset(bufferDataList, packAlignment);
            data.ReferenceIndex = this._referenceBufferDataList.Count;
            data.Info           = (XDRPCArgumentInfo)null;
        }
Ejemplo n.º 9
0
        private int GetArrayElementCount(Type type)
        {
            int num1 = 0;

            if (type.IsArray)
            {
                int num2 = MarshalingUtils.SizeOf(type.GetElementType());
                if (num2 != 0)
                {
                    num1 = this.BufferSize / num2;
                }
            }
            return(num1);
        }
Ejemplo n.º 10
0
 public byte[] PackBufferData()
 {
     byte[] buffer = (byte[])null;
     if (this.MaxArrayLength > 0)
     {
         int offset = 0;
         buffer = new byte[this._elementSize * this.MaxArrayLength];
         for (int index = 0; index < this.MaxArrayLength; ++index)
         {
             MarshalingUtils.PushBufferData(this._arrayElementData[index].Info.PackBufferData(), buffer, ref offset);
         }
     }
     return(buffer);
 }
Ejemplo n.º 11
0
        public ulong GetArgumentValue(ulong bufferAddress)
        {
            switch (this.PassBy)
            {
            case ArgumentType.ByValue:
                return(MarshalingUtils.ConvertToUInt64((object)this.Value));

            case ArgumentType.ByRef:
            case ArgumentType.Out:
                return(bufferAddress);

            default:
                return(0);
            }
        }
Ejemplo n.º 12
0
        internal static int SizeOf(Type type)
        {
            int num = 0;

            if (MarshalingUtils.ValueTypeSizeMap.ContainsKey(type))
            {
                num = MarshalingUtils.ValueTypeSizeMap[type];
            }
            else if (XDRPCMarshaler.IsValidStructType(type))
            {
                MarshalingUtils.GetStructSizes(type);
                num = MarshalingUtils.ValueTypeSizeMap[type];
            }
            return(num);
        }
Ejemplo n.º 13
0
        internal static ulong GetUInt64FromBigEndianBytes(byte[] buffer, int start)
        {
            int length = MarshalingUtils.SizeOf(typeof(ulong));

            if (start + length > buffer.Length)
            {
                throw new XDRPCException("Error de-serializing UInt64 from buffer");
            }
            byte[] buffer1 = new byte[length];
            Array.Copy((Array)buffer, start, (Array)buffer1, 0, length);
            if (BitConverter.IsLittleEndian)
            {
                MarshalingUtils.ReverseBytes(buffer1);
            }
            return(BitConverter.ToUInt64(buffer1, 0));
        }
Ejemplo n.º 14
0
 public byte[] PackReferenceData()
 {
     byte[] buffer = (byte[])null;
     if (this._referenceSize > 0)
     {
         buffer = new byte[this._referenceSize];
         for (int index = 0; index < this.MaxArrayLength; ++index)
         {
             byte[] numArray = this._arrayElementData[index].Info.PackReferenceData();
             if (numArray != null)
             {
                 int referenceOffset = this._arrayElementData[index].ReferenceOffset;
                 MarshalingUtils.PushBufferData(numArray, buffer, ref referenceOffset);
             }
         }
     }
     return(buffer);
 }
Ejemplo n.º 15
0
        internal static int AlignmentOf(Type type)
        {
            int num = 0;

            if (MarshalingUtils.StructPrimitiveSizeMap.ContainsKey(type))
            {
                num = MarshalingUtils.StructPrimitiveSizeMap[type];
            }
            else if (XDRPCMarshaler.IsValidStructType(type))
            {
                MarshalingUtils.GetStructSizes(type);
                num = MarshalingUtils.StructPrimitiveSizeMap[type];
            }
            else if (type.IsPrimitive)
            {
                num = MarshalingUtils.SizeOf(type);
            }
            return(num);
        }
Ejemplo n.º 16
0
 public byte[] PackBufferData()
 {
     byte[] buffer = (byte[])null;
     if (this._maxBufferSize > 0)
     {
         if (this.Value != null)
         {
             buffer = this.Encoding.GetBytes(this.Value);
             if (BitConverter.IsLittleEndian && this.Encoding == Encoding.Unicode)
             {
                 MarshalingUtils.ReverseBytes(buffer, 2);
             }
         }
         else
         {
             buffer = new byte[this._maxBufferSize];
         }
     }
     return(buffer);
 }
Ejemplo n.º 17
0
        public XDRPCArrayArgumentInfo(T v, ArgumentType t, int maxArrayLength)
        {
            Type t1 = typeof(T);

            if (!t1.IsArray)
            {
                throw new XDRPCInvalidTypeException(t1, "Array type must be provided for XDRPCArrayArgumentInfo.");
            }
            if (!XDRPCMarshaler.IsValidArrayType(t1))
            {
                throw new XDRPCInvalidTypeException(t1, string.Format("Array type {0} is not supported by XDRPC.", (object)t1.Name));
            }
            this.Value        = v;
            this._arrayLength = (object)this.Value == null ? 0 : ((object)this.Value as Array).Length;
            if (t == ArgumentType.Out && maxArrayLength <= 0)
            {
                throw new XDRPCException("The max array length must be specified for an Out type array.");
            }
            this.PassBy         = t;
            this._elementSize   = MarshalingUtils.SizeOf(t1.GetElementType());
            this.MaxArrayLength = this.PassBy != ArgumentType.ByRef ? (this.PassBy != ArgumentType.Out ? this._arrayLength : maxArrayLength) : Math.Max(this._arrayLength, maxArrayLength);
            this.ConstructArgumentInfoArray();
        }
Ejemplo n.º 18
0
 internal static void PushCallData(ulong value, byte[] buffer, ref int offset)
 {
     byte[] bigEndianBytes = MarshalingUtils.GetBigEndianBytes(value);
     Array.Copy((Array)bigEndianBytes, 0, (Array)buffer, offset, bigEndianBytes.Length);
     offset += bigEndianBytes.Length;
 }
Ejemplo n.º 19
0
        private int PopulateStructBufferRecursive(
            Type structType,
            object structToMarshal,
            List <XDRPCStructArgumentInfo <T> .StructBufferData> bufferDataList,
            int depth,
            string unionWritingField)
        {
            if (depth > 3)
            {
                throw new XDRPCInvalidTypeException(structType, string.Format("Struct of type {0} has too many nested structs (more than {1} deep) which is not supported.", (object)typeof(T).Name, (object)3));
            }
            if (!((IEnumerable <Type>)XDRPCStructArgumentInfo <T> .builtInStructAllowlist).Contains <Type>(structType))
            {
                object[] customAttributes = structType.GetCustomAttributes(typeof(XDRPCStructAttribute), false);
                if (customAttributes == null || customAttributes.Length == 0)
                {
                    throw new XDRPCInvalidTypeException(structType, string.Format("Struct of type {0} doesn't have the XDRPCStruct attribute.", (object)structType.Name));
                }
            }
            FieldInfo[] fields        = structType.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            int         packAttribute = structType.StructLayoutAttribute.Value == LayoutKind.Sequential ? 8 : structType.StructLayoutAttribute.Pack;
            int         num1          = 0;
            int         num2          = 0;
            bool        flag1         = false;

            foreach (FieldInfo fieldInfo in fields)
            {
                Type fieldType = fieldInfo.FieldType;
                MarshalAsAttribute marshalAsAttribute = (MarshalAsAttribute)null;
                XDRPCStructArgumentInfo <T> .StructBufferData data = new XDRPCStructArgumentInfo <T> .StructBufferData();

                object[] customAttributes1 = fieldInfo.GetCustomAttributes(typeof(MarshalAsAttribute), false);
                if (customAttributes1 != null && customAttributes1.Length != 0)
                {
                    marshalAsAttribute = (MarshalAsAttribute)customAttributes1[0];
                }
                if (fieldType == typeof(string) || fieldType.IsArray)
                {
                    if (marshalAsAttribute == null)
                    {
                        throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} of type {1} in struct type {2} doesn't have the required MarshalAsAttribute.", (object)fieldInfo.Name, (object)fieldType.Name, (object)structType.Name));
                    }
                    if (marshalAsAttribute.Value != UnmanagedType.ByValArray && marshalAsAttribute.Value != UnmanagedType.LPArray)
                    {
                        throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} of type {1} in struct type {2} with its MarshalAs attribute not using the required UnmanagedType.ByValArray or UnmanagedType.LPArray.", (object)fieldInfo.Name, (object)fieldType.Name, (object)structType.Name));
                    }
                    bool flag2 = marshalAsAttribute.Value == UnmanagedType.LPArray;
                    int  size  = marshalAsAttribute.SizeConst;
                    int  num3;
                    int  cMax;
                    if (fieldType.IsArray)
                    {
                        if (fieldType.GetArrayRank() > 1)
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is a multidimensional array which is not supported by XDRPCStructArgumentInfo.", (object)fieldInfo.Name, (object)structType.Name));
                        }
                        Type elementType = fieldType.GetElementType();
                        if (!XDRPCMarshaler.IsValidValueType(elementType))
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is an array of type {2} which is not supported by XDRPCStructArgumentInfo.", (object)fieldInfo.Name, (object)structType.Name, (object)elementType.Name));
                        }
                        int num4 = MarshalingUtils.SizeOf(elementType);
                        if (num4 == 0)
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is an array of type {2} which is not supported by XDRPCStructArgumentInfo.", (object)fieldInfo.Name, (object)structType.Name, (object)elementType.Name));
                        }
                        num3 = num4;
                        if (XDRPCMarshaler.IsValidStructType(elementType))
                        {
                            num3 = MarshalingUtils.AlignmentOf(elementType);
                        }
                        Array array = (Array)fieldInfo.GetValue(structToMarshal);
                        if (flag2)
                        {
                            if (array != null && size < array.Length)
                            {
                                size = array.Length;
                            }
                        }
                        else if (size == 0)
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is an array being passed by value that doesn't have the required SizeConst part of the attribute defined.", (object)fieldInfo.Name, (object)structType.Name));
                        }
                        cMax      = num4 * size;
                        data.Info = XDRPCMarshaler.GenerateArgumentInfo(fieldType, (object)array, ArgumentType.ByRef, size);
                    }
                    else
                    {
                        if (!XDRPCStructArgumentInfo <T> .EncodingMap.ContainsKey(marshalAsAttribute.ArraySubType))
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is a string with a MarshalAs attribute without a string UnmanagedType for its ArraySubType.", (object)fieldInfo.Name, (object)structType.Name));
                        }
                        Encoding encoding = XDRPCStructArgumentInfo <T> .EncodingMap[marshalAsAttribute.ArraySubType];
                        int      num4     = encoding == Encoding.Unicode ? 2 : 1;
                        num3 = num4;
                        cMax = size * num4;
                        string v = (string)fieldInfo.GetValue(structToMarshal);
                        if (flag2)
                        {
                            int num5 = 0;
                            if (v != null)
                            {
                                num5 = encoding.GetByteCount(v + "\0");
                            }
                            if (cMax < num5)
                            {
                                cMax = num5;
                            }
                        }
                        else if (cMax == 0)
                        {
                            throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is a string being passed by value that doesn't have the required SizeConst part of the attribute defined.", (object)fieldInfo.Name, (object)structType.Name));
                        }
                        data.Info = (XDRPCArgumentInfo) new XDRPCStringArgumentInfo(v, encoding, ArgumentType.ByRef, cMax, CountType.Byte);
                    }
                    int requiredReferenceSize = data.Info.GetRequiredReferenceSize();
                    if (requiredReferenceSize > 0)
                    {
                        XDRPCStructArgumentInfo <T> .StructBufferData structBufferData = new XDRPCStructArgumentInfo <T> .StructBufferData();

                        structBufferData.BufferOffset   = this.GetCurrentOffset(this._referenceBufferDataList, 8);
                        structBufferData.BufferSize     = requiredReferenceSize;
                        structBufferData.ReferenceIndex = -1;
                        structBufferData.Info           = (XDRPCArgumentInfo)null;
                        data.ReferenceIndex             = this._referenceBufferDataList.Count;
                        this._referenceBufferDataList.Add(structBufferData);
                    }
                    else
                    {
                        data.ReferenceIndex = -1;
                    }
                    data.BufferSize = cMax;
                    if (flag2)
                    {
                        if (cMax > 0)
                        {
                            XDRPCStructArgumentInfo <T> .StructBufferData structBufferData = data;
                            structBufferData.BufferOffset = this.GetCurrentOffset(this._referenceBufferDataList, num3);
                            this.FillPointerBufferData(out data, bufferDataList, packAttribute);
                            this._referenceBufferDataList.Add(structBufferData);
                        }
                        else
                        {
                            this.FillPointerBufferData(out data, bufferDataList, packAttribute);
                            data.Info           = (XDRPCArgumentInfo) new XDRPCArgumentInfo <uint>(0U, ArgumentType.ByRef);
                            data.ReferenceIndex = -1;
                        }
                        num3 = data.BufferSize;
                    }
                    else
                    {
                        int packAlignment = this.CalculatePackAlignment(packAttribute, num3);
                        data.BufferOffset = this.GetCurrentOffset(bufferDataList, packAlignment);
                    }
                    num1 = Math.Max(num1, num3);
                    num2 = Math.Max(num2, data.BufferSize);
                    if (this.FillUnionBufferData(ref data, fieldInfo, unionWritingField))
                    {
                        flag1 = true;
                    }
                    bufferDataList.Add(data);
                }
                else if (fieldType.IsPrimitive)
                {
                    int num3 = MarshalingUtils.SizeOf(fieldType);
                    if (num3 == 0)
                    {
                        throw new XDRPCInvalidTypeException(fieldType, string.Format("Field {0} in struct type {1} is primitive type {2} which is not supported by XDRPCStructArgumentInfo.", (object)fieldInfo.Name, (object)structType.Name, (object)fieldType.Name));
                    }
                    data.Info = XDRPCMarshaler.GenerateArgumentInfo(fieldType, fieldInfo.GetValue(structToMarshal), ArgumentType.ByRef);
                    if (marshalAsAttribute != null && marshalAsAttribute.Value == UnmanagedType.LPStruct)
                    {
                        XDRPCStructArgumentInfo <T> .StructBufferData structBufferData = new XDRPCStructArgumentInfo <T> .StructBufferData();

                        structBufferData.Info           = data.Info;
                        structBufferData.BufferOffset   = this.GetCurrentOffset(this._referenceBufferDataList, num3);
                        structBufferData.BufferSize     = num3;
                        structBufferData.ReferenceIndex = -1;
                        this.FillPointerBufferData(out data, bufferDataList, packAttribute);
                        this._referenceBufferDataList.Add(structBufferData);
                    }
                    else
                    {
                        int packAlignment = this.CalculatePackAlignment(packAttribute, num3);
                        data.BufferOffset   = this.GetCurrentOffset(bufferDataList, packAlignment);
                        data.BufferSize     = num3;
                        data.ReferenceIndex = -1;
                    }
                    num1 = Math.Max(num1, data.BufferSize);
                    num2 = Math.Max(num2, data.BufferSize);
                    if (this.FillUnionBufferData(ref data, fieldInfo, unionWritingField))
                    {
                        flag1 = true;
                    }
                    bufferDataList.Add(data);
                }
                else
                {
                    if (!fieldType.IsValueType)
                    {
                        throw new XDRPCInvalidTypeException(fieldType, string.Format("Type {0} found in struct type {1} is not supported by XDRPCStructArgumentInfo.", (object)fieldType.Name, (object)structType.Name));
                    }
                    List <XDRPCStructArgumentInfo <T> .StructBufferData> bufferDataList1 = new List <XDRPCStructArgumentInfo <T> .StructBufferData>();
                    string   empty             = string.Empty;
                    object[] customAttributes2 = fieldInfo.GetCustomAttributes(typeof(XDRPCUnionAttribute), false);
                    if (customAttributes2 != null && customAttributes2.Length != 0)
                    {
                        empty = ((XDRPCUnionAttribute)customAttributes2[0]).Value;
                    }
                    int num3 = this.PopulateStructBufferRecursive(fieldType, fieldInfo.GetValue(structToMarshal), bufferDataList1, depth + 1, empty);
                    if (marshalAsAttribute != null && marshalAsAttribute.Value == UnmanagedType.LPStruct)
                    {
                        this.FillPointerBufferData(out data, bufferDataList, packAttribute);
                        if (this.FillUnionBufferData(ref data, fieldInfo, unionWritingField))
                        {
                            flag1 = true;
                        }
                        bufferDataList.Add(data);
                        int currentOffset = this.GetCurrentOffset(this._referenceBufferDataList, 8);
                        for (int index = 0; index < bufferDataList1.Count; ++index)
                        {
                            XDRPCStructArgumentInfo <T> .StructBufferData structBufferData = bufferDataList1[index];
                            structBufferData.BufferOffset += currentOffset;
                            if (structBufferData.NextOffset != 0)
                            {
                                structBufferData.NextOffset += currentOffset;
                            }
                            this._referenceBufferDataList.Add(structBufferData);
                        }
                        num1 = data.BufferSize;
                    }
                    else
                    {
                        data.BufferOffset = this.GetCurrentOffset(bufferDataList, this.CalculatePackAlignment(packAttribute, num3));
                        if (this.FillUnionBufferData(ref data, fieldInfo, unionWritingField))
                        {
                            flag1 = true;
                        }
                        for (int index = 0; index < bufferDataList1.Count; ++index)
                        {
                            XDRPCStructArgumentInfo <T> .StructBufferData structBufferData = bufferDataList1[index];
                            structBufferData.BufferOffset += data.BufferOffset;
                            if (structBufferData.NextOffset != 0)
                            {
                                data.BufferSize              = structBufferData.NextOffset;
                                structBufferData.NextOffset += data.BufferOffset;
                            }
                            if (data.Ignore)
                            {
                                structBufferData.Ignore = true;
                            }
                            bufferDataList.Add(structBufferData);
                        }
                    }
                    num1 = Math.Max(num1, num3);
                    num2 = Math.Max(num2, data.BufferSize);
                }
            }
            if (!string.IsNullOrEmpty(unionWritingField))
            {
                if (!flag1)
                {
                    throw new XDRPCInvalidTypeException(structType, string.Format("Struct of type {0} has the XDRPCUnion attribute with the non-existant field {1} specified, please provide a correct field name.", (object)structType.Name, (object)unionWritingField));
                }
                this.SetNextOffset(bufferDataList, num2);
            }
            int packAlignment1 = this.CalculatePackAlignment(packAttribute, num1);

            this.CalculateNextOffset(bufferDataList, packAlignment1);
            return(packAlignment1);
        }
Ejemplo n.º 20
0
        private void CreateArgumentBufferData()
        {
            int offset = 0;
            int num    = 2;

            this.callData = new byte[this.totalBufferSize];
            MarshalingUtils.PushCallData(0UL, this.callData, ref offset);
            MarshalingUtils.PushCallData(0UL, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.Options.PostMethodCall, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.callFlags, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.totalArgumentCount, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.FloatingPointArguments.Length, this.callData, ref offset);
            for (int index1 = 0; index1 < this.IntegerArguments.Length + num; ++index1)
            {
                ulong bufferAddress1 = (ulong)this.bufferBaseAddress + (ulong)this.bufferData[index1].BufferOffset;
                if (index1 < num)
                {
                    MarshalingUtils.PushCallData(this.Options.GetArgumentValue(index1, bufferAddress1), this.callData, ref offset);
                }
                else
                {
                    int   index2         = index1 - num;
                    ulong bufferAddress2 = (ulong)this.bufferBaseAddress + (ulong)this.referenceData[index2].BufferOffset;
                    this.IntegerArguments[index2].SetReferenceAddress(bufferAddress2);
                    if (this.IntegerArguments[index2].GetArgumentCount() == 1)
                    {
                        MarshalingUtils.PushCallData(this.IntegerArguments[index2].GetArgumentValue(bufferAddress1), this.callData, ref offset);
                    }
                    else
                    {
                        foreach (ulong argumentValue in this.IntegerArguments[index2].GetArgumentValues(bufferAddress1))
                        {
                            MarshalingUtils.PushCallData(argumentValue, this.callData, ref offset);
                        }
                    }
                }
            }
            for (int index = 0; index < this.FloatingPointArguments.Length; ++index)
            {
                ulong bufferAddress = (ulong)this.bufferBaseAddress + (ulong)this.bufferData[index].BufferOffset;
                MarshalingUtils.PushCallData(this.FloatingPointArguments[index].GetArgumentValue(bufferAddress), this.callData, ref offset);
            }
            for (int index = 0; index < this.IntegerArguments.Length + num; ++index)
            {
                if (this.bufferData[index].BufferSize > 0)
                {
                    byte[] numArray = index >= num ? this.IntegerArguments[index - num].PackBufferData() : this.Options.PackBufferData(index);
                    if (numArray != null)
                    {
                        offset = this.bufferData[index].BufferOffset;
                        MarshalingUtils.PushBufferData(numArray, this.callData, ref offset);
                    }
                }
            }
            for (int index = 0; index < this.IntegerArguments.Length; ++index)
            {
                if (this.referenceData[index].BufferSize > 0)
                {
                    byte[] numArray = this.IntegerArguments[index].PackReferenceData();
                    if (numArray != null)
                    {
                        offset = this.referenceData[index].BufferOffset;
                        MarshalingUtils.PushBufferData(numArray, this.callData, ref offset);
                    }
                }
            }
        }