public RpcTypeDescriptor(Type code_type, string unmarshal_method, MarshalHelperBuilder marshal_helper, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, AdditionalArguments additional_marshal_args, AdditionalArguments additional_unmarshal_args) : this(new CodeTypeReference(code_type), code_type.IsValueType || typeof(NtObject).IsAssignableFrom(code_type), unmarshal_method, marshal_helper, marshal_method, ndr_type, conformance, variance, additional_marshal_args, additional_unmarshal_args) { BuiltinType = code_type; }
public RpcTypeDescriptor(string name, bool value_type, string unmarshal_method, bool unmarshal_generic, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, params RpcMarshalArgument[] additional_args) : this(new CodeTypeReference(name), value_type, unmarshal_method, unmarshal_generic, marshal_method, ndr_type, conformance, variance, additional_args) { Constructed = true; }
public RpcTypeDescriptor(Type code_type, string unmarshal_method, bool unmarshal_generic, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, params RpcMarshalArgument[] additional_args) : this(new CodeTypeReference(code_type), code_type.IsValueType || typeof(NtObject).IsAssignableFrom(code_type), unmarshal_method, unmarshal_generic, marshal_method, ndr_type, conformance, variance, additional_args) { BuiltinType = code_type; }
public static RpcMarshalArgument CalculateCorrelationArgument(this NdrCorrelationDescriptor correlation, int current_offset, IEnumerable <Tuple <int, string> > offset_to_name) { if (correlation.IsConstant) { return(RpcMarshalArgument.CreateFromPrimitive((long)correlation.Offset)); } int expected_offset = current_offset + correlation.Offset; foreach (var offset in offset_to_name) { if (offset.Item1 == expected_offset) { CodeExpression expr = GetVariable(offset.Item2); CodeExpression right_expr = null; CodeBinaryOperatorType operator_type = CodeBinaryOperatorType.Add; switch (correlation.Operator) { case NdrFormatCharacter.FC_ADD_1: right_expr = GetPrimitive(1); operator_type = CodeBinaryOperatorType.Add; break; case NdrFormatCharacter.FC_DIV_2: right_expr = GetPrimitive(2); operator_type = CodeBinaryOperatorType.Divide; break; case NdrFormatCharacter.FC_MULT_2: right_expr = GetPrimitive(2); operator_type = CodeBinaryOperatorType.Multiply; break; case NdrFormatCharacter.FC_SUB_1: right_expr = GetPrimitive(2); operator_type = CodeBinaryOperatorType.Multiply; break; } if (right_expr != null) { expr = new CodeBinaryOperatorExpression(expr, operator_type, right_expr); } return(new RpcMarshalArgument(expr, new CodeTypeReference(typeof(long)))); } else if (offset.Item1 > expected_offset) { break; } } // We failed to find the base name, just return a 0 for now. return(RpcMarshalArgument.CreateFromPrimitive(0L)); }
public RpcTypeDescriptor(CodeTypeReference code_type, bool value_type, string unmarshal_method, bool unmarshal_generic, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, params RpcMarshalArgument[] additional_args) { CodeType = code_type; UnmarshalMethod = unmarshal_method; MarshalMethod = marshal_method; UnmarshalGeneric = unmarshal_generic; NdrType = ndr_type; AdditionalArgs = additional_args; ValueType = value_type; ConformanceDescriptor = conformance ?? new NdrCorrelationDescriptor(); VarianceDescriptor = variance ?? new NdrCorrelationDescriptor(); }
public RpcTypeDescriptor(CodeTypeReference code_type, bool value_type, string unmarshal_method, MarshalHelperBuilder marshal_helper, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, AdditionalArguments additional_marshal_args, AdditionalArguments additional_unmarshal_args) { CodeType = code_type; UnmarshalMethod = unmarshal_method; if (additional_marshal_args != null) { if (marshal_helper == null) { throw new ArgumentNullException(nameof(marshal_helper)); } MarshalMethod = marshal_helper.AddGenericMarshal(ndr_type, code_type, marshal_method, additional_marshal_args); } else { MarshalMethod = marshal_method; } if (additional_unmarshal_args != null) { if (marshal_helper == null) { throw new ArgumentNullException(nameof(marshal_helper)); } UnmarshalMethod = marshal_helper.AddGenericUnmarshal(ndr_type, code_type, unmarshal_method, additional_unmarshal_args ?? new AdditionalArguments()); } else { UnmarshalMethod = unmarshal_method; } NdrType = ndr_type; ValueType = value_type; ConformanceDescriptor = conformance ?? new NdrCorrelationDescriptor(); VarianceDescriptor = variance ?? new NdrCorrelationDescriptor(); }
public static bool ValidateCorrelation(this NdrCorrelationDescriptor correlation) { if (!correlation.IsConstant && !correlation.IsNormal) { return(false); } switch (correlation.Operator) { case NdrFormatCharacter.FC_ADD_1: case NdrFormatCharacter.FC_DIV_2: case NdrFormatCharacter.FC_MULT_2: case NdrFormatCharacter.FC_SUB_1: case NdrFormatCharacter.FC_ZERO: break; default: return(false); } return(true); }
public RpcTypeDescriptor(string name, bool value_type, string unmarshal_method, MarshalHelperBuilder marshal_helper, string marshal_method, NdrBaseTypeReference ndr_type, NdrCorrelationDescriptor conformance, NdrCorrelationDescriptor variance, AdditionalArguments additional_marshal_args, AdditionalArguments additional_unmarshal_args) : this(new CodeTypeReference(name), value_type, unmarshal_method, marshal_helper, marshal_method, ndr_type, conformance, variance, additional_marshal_args, additional_unmarshal_args) { Constructed = true; Union = ndr_type is NdrUnionTypeReference; }