예제 #1
0
        public IntPtr NdrRangeUnmarshall(int formatStringOffset)
        {
            // offset + 1 is the place of real format string of this parameter.
            IntPtr             pFormat    = IntPtrUtility.Add(stubDesc.pFormatTypes, formatStringOffset + 1);
            RpceFormatCharType formatChar = (RpceFormatCharType)Marshal.ReadByte(pFormat);

            //Range is base type only.
            //pArg is ignored for base types.
            IntPtr pValue = NdrUnmarshalRoutines(IntPtr.Zero, formatStringOffset, formatChar);

            return(pValue);
        }
예제 #2
0
        public IntPtr NdrSupplementUnmarshall(IntPtr pArg, int formatStringOffset, byte mustAlloc)
        {
            // offset + 2 is the size of supplement header size (ushort), skip the size.
            formatStringOffset += 2;
            IntPtr pFormat          = IntPtrUtility.Add(stubDesc.pFormatTypes, formatStringOffset);
            int    supplementOffset = Marshal.ReadInt16(pFormat);

            formatStringOffset += supplementOffset;
            pFormat             = IntPtrUtility.Add(pFormat, supplementOffset);
            RpceFormatCharType formatChar = (RpceFormatCharType)Marshal.ReadByte(pFormat);

            return(NdrUnmarshalRoutines(pArg, formatStringOffset, formatChar));
        }
예제 #3
0
 /// <summary>
 /// The NdrSimpleTypeUnmarshall function unmarshalls a simple type.
 /// </summary>
 /// <param name="pMemory">Pointer to memory to unmarshall.</param>
 /// <param name="formatChar">Format char of the simple type.</param>
 public void NdrSimpleTypeUnmarshall(IntPtr pMemory, RpceFormatCharType formatChar)
 {
     NativeMethods.NdrSimpleTypeUnmarshall(pStubMsg, pMemory, (byte)formatChar);
 }
예제 #4
0
        private Int3264 NdrUnmarshalRoutines(
            Int3264 arg,
            int typeFormatStringOffset,
            RpceFormatCharType formatChar)
        {
            Int3264 retVal = 0;

            switch ((RpceFormatCharType)((int)formatChar & FORMAT_CHAR_ROUTINE_BITMASK))
            {
            case RpceFormatCharType.FC_ZERO:
                throw new InvalidOperationException("Bad format char: FC_ZERO.");

            case RpceFormatCharType.FC_BYTE:
            case RpceFormatCharType.FC_CHAR:
            case RpceFormatCharType.FC_SMALL:
            case RpceFormatCharType.FC_USMALL:
                retVal = (int)NdrByteUnmarshal();
                break;

            case RpceFormatCharType.FC_WCHAR:
            case RpceFormatCharType.FC_SHORT:
            case RpceFormatCharType.FC_USHORT:
                retVal = (int)NdrInt16Unmarshal();
                break;

            case RpceFormatCharType.FC_LONG:
            case RpceFormatCharType.FC_ULONG:
            case RpceFormatCharType.FC_FLOAT:
                retVal = NdrInt32Unmarshal();
                break;

            case RpceFormatCharType.FC_HYPER:
            case RpceFormatCharType.FC_DOUBLE:
                retVal = NdrInt64Unmarshal();
                break;

            case RpceFormatCharType.FC_ENUM16:
                retVal = (int)NdrInt16Unmarshal();
                break;

            case RpceFormatCharType.FC_ENUM32:
                retVal = NdrInt32Unmarshal();
                break;

            case RpceFormatCharType.FC_ERROR_STATUS_T:
                retVal = NdrInt32Unmarshal();
                break;

            case RpceFormatCharType.FC_RP:
            case RpceFormatCharType.FC_UP:
            case RpceFormatCharType.FC_OP:
            case RpceFormatCharType.FC_FP:
                retVal = NdrPointerUnmarshall(typeFormatStringOffset);
                break;

            case RpceFormatCharType.FC_STRUCT:
            case RpceFormatCharType.FC_PSTRUCT:
                retVal = NdrSimpleStructUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_CSTRUCT:
            case RpceFormatCharType.FC_CPSTRUCT:
                retVal = NdrConformantStructUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_CVSTRUCT:
                retVal = NdrConformantVaryingStructUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_BOGUS_STRUCT:
            case (RpceFormatCharType)((int)
                                      RpceFormatCharType.FC_FORCED_BOGUS_STRUCT & FORMAT_CHAR_ROUTINE_BITMASK):
                retVal = NdrComplexStructUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_CARRAY:
                retVal = NdrConformantArrayUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_CVARRAY:
                retVal = NdrConformantVaryingArrayUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_SMFARRAY:
            case RpceFormatCharType.FC_LGFARRAY:
                retVal = NdrFixedArrayUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_SMVARRAY:
            case RpceFormatCharType.FC_LGVARRAY:
                retVal = NdrVaryingArrayUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_BOGUS_ARRAY:
                retVal = NdrComplexArrayUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_C_CSTRING:
            case RpceFormatCharType.FC_C_BSTRING:
            case RpceFormatCharType.FC_C_SSTRING:
            case RpceFormatCharType.FC_C_WSTRING:
                retVal = NdrConformantStringUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_CSTRING:
            case RpceFormatCharType.FC_BSTRING:
            case RpceFormatCharType.FC_SSTRING:
            case RpceFormatCharType.FC_WSTRING:
                retVal = NdrNonConformantStringUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_ENCAPSULATED_UNION:
                retVal = NdrEncapsulatedUnionUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_NON_ENCAPSULATED_UNION:
                retVal = NdrNonEncapsulatedUnionUnmarshall(typeFormatStringOffset, 0);
                break;

            case RpceFormatCharType.FC_BYTE_COUNT_POINTER:
                retVal = NdrByteCountPointerUnmarshall(typeFormatStringOffset, arg.ToIntPtr(), 0);
                break;

            case RpceFormatCharType.FC_IP:
                retVal = NdrPointerUnmarshall(typeFormatStringOffset);
                break;

            case RpceFormatCharType.FC_BIND_CONTEXT:
                retVal = NdrContextHandleUnmarshall(arg, typeFormatStringOffset);
                break;

            case (RpceFormatCharType)((int)RpceFormatCharType.FC_SUPPLEMENT & FORMAT_CHAR_ROUTINE_BITMASK):
                retVal = NdrSupplementUnmarshall(arg, typeFormatStringOffset, 0);
                break;

            case (RpceFormatCharType)((int)RpceFormatCharType.FC_RANGE & FORMAT_CHAR_ROUTINE_BITMASK):
                retVal = NdrRangeUnmarshall(typeFormatStringOffset);
                break;

            case (RpceFormatCharType)((int)RpceFormatCharType.FC_INT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)RpceFormatCharType.FC_UINT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
                if (IntPtr.Size == sizeof(int))
                {
                    retVal = NdrInt32Unmarshal();
                }
                else if (IntPtr.Size == sizeof(long))
                {
                    retVal = NdrInt64Unmarshal();
                }
                else
                {
                    throw new InvalidOperationException("Unsupported platform.");
                }
                break;

            case (RpceFormatCharType)0x0f:     // Ignore
                break;

            case RpceFormatCharType.FC_TRANSMIT_AS:
            case RpceFormatCharType.FC_REPRESENT_AS:
            case (RpceFormatCharType)((int)
                                      RpceFormatCharType.FC_TRANSMIT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)
                                      RpceFormatCharType.FC_REPRESENT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)RpceFormatCharType.FC_USER_MARSHAL & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)RpceFormatCharType.FC_PIPE & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)RpceFormatCharType.FC_CSARRAY & FORMAT_CHAR_ROUTINE_BITMASK):
            case (RpceFormatCharType)((int)RpceFormatCharType.FC_CS_TAG & FORMAT_CHAR_ROUTINE_BITMASK):
                throw new NotSupportedException(
                          "transmit_as, represent_as, user_marshal, pipe and csarray are not supported.");

            default:
                throw new InvalidOperationException(
                          string.Format("Unsupported type format char {0}.", formatChar));
            }

            return(retVal);
        }
        private void NdrMarshalRoutines(
            Int3264 arg,
            int typeFormatStringOffset,
            RpceFormatCharType formatChar)
        {
            switch ((RpceFormatCharType)((int)formatChar & FORMAT_CHAR_ROUTINE_BITMASK))
            {
                case RpceFormatCharType.FC_ZERO:
                    throw new InvalidOperationException("Bad format char: FC_ZERO.");

                case RpceFormatCharType.FC_BYTE:
                case RpceFormatCharType.FC_CHAR:
                case RpceFormatCharType.FC_SMALL:
                case RpceFormatCharType.FC_USMALL:
                    unchecked { NdrByteMarshal((byte)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_WCHAR:
                case RpceFormatCharType.FC_SHORT:
                case RpceFormatCharType.FC_USHORT:
                    unchecked { NdrInt16Marshal((short)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_LONG:
                case RpceFormatCharType.FC_ULONG:
                case RpceFormatCharType.FC_FLOAT:
                    unchecked { NdrInt32Marshal((int)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_HYPER:
                case RpceFormatCharType.FC_DOUBLE:
                    unchecked { NdrInt64Marshal((long)arg.ToInt64()); }
                    break;

                case RpceFormatCharType.FC_ENUM16:
                    unchecked { NdrInt16Marshal((short)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_ENUM32:
                    unchecked { NdrInt32Marshal((int)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_ERROR_STATUS_T:
                    unchecked { NdrInt32Marshal((int)arg.ToInt32()); }
                    break;

                case RpceFormatCharType.FC_RP:
                case RpceFormatCharType.FC_UP:
                case RpceFormatCharType.FC_OP:
                case RpceFormatCharType.FC_FP:
                    NdrPointerMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_STRUCT:
                case RpceFormatCharType.FC_PSTRUCT:
                    NdrSimpleStructMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CSTRUCT:
                case RpceFormatCharType.FC_CPSTRUCT:
                    NdrConformantStructMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CVSTRUCT:
                    NdrConformantVaryingStructMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BOGUS_STRUCT:
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_FORCED_BOGUS_STRUCT & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrComplexStructMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CARRAY:
                    NdrConformantArrayMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CVARRAY:
                    NdrConformantVaryingArrayMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_SMFARRAY:
                case RpceFormatCharType.FC_LGFARRAY:
                    NdrFixedArrayMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_SMVARRAY:
                case RpceFormatCharType.FC_LGVARRAY:
                    NdrVaryingArrayMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BOGUS_ARRAY:
                    NdrComplexArrayMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_C_CSTRING:
                case RpceFormatCharType.FC_C_BSTRING:
                case RpceFormatCharType.FC_C_SSTRING:
                case RpceFormatCharType.FC_C_WSTRING:
                    NdrConformantStringMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CSTRING:
                case RpceFormatCharType.FC_BSTRING:
                case RpceFormatCharType.FC_SSTRING:
                case RpceFormatCharType.FC_WSTRING:
                    NdrNonConformantStringMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_ENCAPSULATED_UNION:
                    NdrEncapsulatedUnionMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_NON_ENCAPSULATED_UNION:
                    NdrNonEncapsulatedUnionMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BYTE_COUNT_POINTER:
                    NdrByteCountPointerMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_IP:
                    NdrPointerMarshall(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BIND_CONTEXT:
                    NdrContextHandleMarshall(arg, typeFormatStringOffset);
                    break;

                case (RpceFormatCharType)((int)RpceFormatCharType.FC_SUPPLEMENT & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrSupplementMarshall(arg, typeFormatStringOffset);
                    break;

                case (RpceFormatCharType)((int)RpceFormatCharType.FC_RANGE & FORMAT_CHAR_ROUTINE_BITMASK):
                    IntPtr p = Marshal.AllocHGlobal(sizeof(long));
                    Marshal.Copy(BitConverter.GetBytes(arg.ToInt64()), 0, p, sizeof(long));
                    NdrRangeMarshall(p, typeFormatStringOffset);
                    Marshal.FreeHGlobal(p);
                    break;

                case (RpceFormatCharType)((int)RpceFormatCharType.FC_INT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_UINT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
                    if (IntPtr.Size == sizeof(int))
                    {
                        unchecked { NdrInt32Marshal(arg.ToInt32()); }
                    }
                    else if (IntPtr.Size == sizeof(long))
                    {
                        unchecked { NdrInt64Marshal(arg.ToInt64()); }
                    }
                    else
                    {
                        throw new InvalidOperationException("Unsupported platform.");
                    }
                    break;

                case (RpceFormatCharType)0x0f: // Ignore
                    break;

                case RpceFormatCharType.FC_TRANSMIT_AS:
                case RpceFormatCharType.FC_REPRESENT_AS:
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_TRANSMIT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_REPRESENT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_USER_MARSHAL & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_PIPE & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_CSARRAY & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_CS_TAG & FORMAT_CHAR_ROUTINE_BITMASK):
                    throw new NotSupportedException(
                        "transmit_as, represent_as, user_marshal, pipe and csarray are not supported.");

                default:
                    throw new InvalidOperationException(
                        string.Format("Unsupported type format char {0}.", formatChar));
            }
        }
        private void NdrBufferSizeRoutines(
            Int3264 arg,
            int typeFormatStringOffset,
            RpceFormatCharType formatChar)
        {
            switch ((RpceFormatCharType)((int)formatChar & FORMAT_CHAR_ROUTINE_BITMASK))
            {
                case RpceFormatCharType.FC_ZERO:
                case RpceFormatCharType.FC_BYTE:
                case RpceFormatCharType.FC_CHAR:
                case RpceFormatCharType.FC_SMALL:
                case RpceFormatCharType.FC_USMALL:
                case RpceFormatCharType.FC_WCHAR:
                case RpceFormatCharType.FC_SHORT:
                case RpceFormatCharType.FC_USHORT:
                case RpceFormatCharType.FC_LONG:
                case RpceFormatCharType.FC_ULONG:
                case RpceFormatCharType.FC_FLOAT:
                case RpceFormatCharType.FC_HYPER:
                case RpceFormatCharType.FC_DOUBLE:
                case RpceFormatCharType.FC_ENUM16:
                case RpceFormatCharType.FC_ENUM32:
                case (RpceFormatCharType)0x0f:
                case RpceFormatCharType.FC_ERROR_STATUS_T:
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_INT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_UINT3264 & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrSimpleTypeBufferSize(formatChar);
                    break;

                case RpceFormatCharType.FC_RP:
                case RpceFormatCharType.FC_UP:
                case RpceFormatCharType.FC_OP:
                case RpceFormatCharType.FC_FP:
                    NdrPointerBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_STRUCT:
                case RpceFormatCharType.FC_PSTRUCT:
                    NdrSimpleStructBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CSTRUCT:
                case RpceFormatCharType.FC_CPSTRUCT:
                    NdrConformantStructBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CVSTRUCT:
                    NdrConformantVaryingStructBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BOGUS_STRUCT:
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_FORCED_BOGUS_STRUCT & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrComplexStructBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CARRAY:
                    NdrConformantArrayBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CVARRAY:
                    NdrConformantVaryingArrayBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_SMFARRAY:
                case RpceFormatCharType.FC_LGFARRAY:
                    NdrFixedArrayBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_SMVARRAY:
                case RpceFormatCharType.FC_LGVARRAY:
                    NdrVaryingArrayBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BOGUS_ARRAY:
                    NdrComplexArrayBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_C_CSTRING:
                case RpceFormatCharType.FC_C_BSTRING:
                case RpceFormatCharType.FC_C_SSTRING:
                case RpceFormatCharType.FC_C_WSTRING:
                    NdrConformantStringBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_CSTRING:
                case RpceFormatCharType.FC_BSTRING:
                case RpceFormatCharType.FC_SSTRING:
                case RpceFormatCharType.FC_WSTRING:
                    NdrNonConformantStringBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_ENCAPSULATED_UNION:
                    NdrEncapsulatedUnionBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_NON_ENCAPSULATED_UNION:
                    NdrNonEncapsulatedUnionBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BYTE_COUNT_POINTER:
                    NdrByteCountPointerBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_IP:
                    NdrPointerBufferSize(arg, typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_BIND_CONTEXT:
                    NdrContextHandleSize(arg, typeFormatStringOffset);
                    break;

                case (RpceFormatCharType)((int)RpceFormatCharType.FC_SUPPLEMENT & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrSupplementBufferSize(arg, typeFormatStringOffset);
                    break;

                case (RpceFormatCharType)((int)RpceFormatCharType.FC_RANGE & FORMAT_CHAR_ROUTINE_BITMASK):
                    NdrRangeBufferSize(typeFormatStringOffset);
                    break;

                case RpceFormatCharType.FC_TRANSMIT_AS:
                case RpceFormatCharType.FC_REPRESENT_AS:
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_TRANSMIT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)
                RpceFormatCharType.FC_REPRESENT_AS_PTR & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_USER_MARSHAL & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_PIPE & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_CSARRAY & FORMAT_CHAR_ROUTINE_BITMASK):
                case (RpceFormatCharType)((int)RpceFormatCharType.FC_CS_TAG & FORMAT_CHAR_ROUTINE_BITMASK):
                    throw new NotSupportedException(
                        "transmit_as, represent_as, user_marshal, pipe and csarray are not supported.");

                default:
                    throw new InvalidOperationException(
                        string.Format("Unsupported type format char {0}.", formatChar));
            }
        }
 /// <summary>
 /// Marshalls a simple type.
 /// </summary>
 /// <param name="pMemory">Pointer to the parameter.</param>
 /// <param name="formatChar">A format char of the simple type.</param>
 public void NdrSimpleTypeMarshall(IntPtr pMemory, RpceFormatCharType formatChar)
 {
     NativeMethods.NdrSimpleTypeMarshall(pStubMsg, pMemory, (byte)formatChar);
 }
 /// <summary>
 /// Computes the buffer size needed for a simple type.
 /// </summary>
 /// <param name="formatChar">A format char of the simple type.</param>
 public void NdrSimpleTypeBufferSize(RpceFormatCharType formatChar)
 {
     byte size = NativeMethods.NdrGetSimpleTypeBufferSize((byte)formatChar);
     uint bufferLength = GetBufferLength();
     bufferLength = (uint)RpceUtility.Align((int)bufferLength, size);
     bufferLength += size;
     SetBufferLength(bufferLength);
 }