internal override string FormatType(NdrFormatter context) { if (AccessMask != 0) { object access = null; switch (Resource) { case NdrSystemHandleResource.Pipe: case NdrSystemHandleResource.File: access = (FileAccessRights)AccessMask; break; case NdrSystemHandleResource.Process: access = (ProcessAccessRights)AccessMask; break; case NdrSystemHandleResource.Thread: access = (ThreadAccessRights)AccessMask; break; case NdrSystemHandleResource.Event: access = (EventAccessRights)AccessMask; break; case NdrSystemHandleResource.Job: access = (JobAccessRights)AccessMask; break; case NdrSystemHandleResource.Mutex: access = (MutantAccessRights)AccessMask; break; case NdrSystemHandleResource.RegKey: access = (KeyAccessRights)AccessMask; break; case NdrSystemHandleResource.Section: access = (SectionAccessRights)AccessMask; break; case NdrSystemHandleResource.Semaphore: access = (SemaphoreAccessRights)AccessMask; break; case NdrSystemHandleResource.Token: access = (TokenAccessRights)AccessMask; break; default: access = string.Format("0x{0:X}", AccessMask); break; } return(string.Format("{0} HANDLE", context.FormatComment("FC_SYSTEM_HANDLE {0}({1})", Resource, access))); } return(string.Format("{0} HANDLE", context.FormatComment("FC_SYSTEM_HANDLE {0}", Resource))); }
internal override string FormatType(NdrFormatter context) { string comment = Format.ToString(); if (Description.IsValid) { comment = $"{comment} {Description}"; } return($"{context.FormatComment(comment)} {Type.FormatType(context)}*"); }
internal override string FormatType(NdrFormatter context) { if (StringSize > 0) { return(string.Format("{0}[{1}]", base.FormatType(context), StringSize)); } else { return(base.FormatType(context)); } }
internal override string FormatType(NdrFormatter formatter) { if (Type is NdrBaseArrayTypeReference) { return(Type.FormatType(formatter)); } else { bool is_unique = Format == NdrFormatCharacter.FC_UP; return(string.Format("{0}{1}*", is_unique ? formatter.FormatComment("unique") : "", Type.FormatType(formatter))); } }
internal override string FormatComplexType(NdrFormatter context) { StringBuilder builder = new StringBuilder(); builder.Append(context.FormatComment("Memory Size: {0}", GetSize())).AppendLine(); builder.Append(FormatType(context)).AppendLine(" {"); foreach (var member in Members.Select((m, i) => $"{m.FormatMember(context)} {m.Name}")) { builder.Append(" ").Append(member).AppendLine(";"); } builder.AppendLine("};"); return(builder.ToString()); }
internal string Format(NdrFormatter context) { NdrStringBuilder builder = new NdrStringBuilder(); builder.AppendLine("[uuid(\"{0}\"), version({1})]", InterfaceId, InterfaceVersion); builder.AppendLine("interface intf_{0} {{", InterfaceId.ToString().Replace('-', '_')); builder.PushIndent(' ', 4); foreach (NdrProcedureDefinition proc in Procedures) { builder.AppendLine(proc.FormatProcedure(context)); } builder.PopIndent(); builder.AppendLine("}").AppendLine(); return(builder.ToString()); }
internal override string FormatType(NdrFormatter context) { string comment = $"FC_SUPPLEMENT {BaseType}"; if (SupplementType is NdrBaseStringTypeReference) { comment = $"{comment} Range({Argument1}, {Argument2})"; } else if (SupplementType is NdrHandleTypeReference) { comment = $"{comment} Flags: {Argument1:X} ContextID: {Argument2:X})"; } return($"{context.FormatComment(comment)} {SupplementType.FormatType(context)}"); }
internal override string FormatType(NdrFormatter context) { StringBuilder builder = new StringBuilder(); if (VarianceDescriptor != null && VarianceDescriptor.IsValid) { builder.AppendFormat("V:{0}", VarianceDescriptor); } if (builder.Length > 0) { return($"{context.FormatComment(builder.ToString())} {base.FormatType(context)}"); } return(base.FormatType(context)); }
internal override string FormatType(NdrFormatter context) { string conformance_desc = string.Empty; if (ConformanceDescriptor != null && ConformanceDescriptor.IsValid) { conformance_desc = context.FormatComment(ConformanceDescriptor.ToString()); } if (!ConformanceDescriptor.IsValid) { return(string.Format("{0}{1}", conformance_desc, base.FormatType(context))); } return(string.Format("{0}{1}[{2}]", conformance_desc, base.FormatType(context), GetCharCount())); }
internal override string FormatType(NdrFormatter formatter) { if (IsConstant) { string name = formatter.IidToName(Iid); if (name != null) { return(formatter.FormatPointer(name)); } return($"{formatter.FormatComment("Unknown IID: {0}", Iid)} {formatter.FormatPointer("IUnknown")}"); } else { return($"{formatter.FormatComment("iid_is param offset: {0}", IidIsDescriptor.Offset)} {formatter.FormatPointer("IUnknown")}"); } }
internal override string FormatComplexType(NdrFormatter context) { int indent = 4; StringBuilder builder = new StringBuilder(); builder.Append(context.FormatComment("Memory Size: {0}", GetSize())).AppendLine(); builder.Append(FormatType(context)).AppendLine(" {"); if (!NonEncapsulated) { builder.Append(' ', indent).AppendFormat("{0} Selector;", new NdrSimpleTypeReference(SwitchType).FormatType(context)).AppendLine(); builder.Append(' ', indent).AppendLine("union { "); indent *= 2; } else { builder.Append(context.FormatComment(Correlation.ToString())).AppendLine(); } int index = 0; foreach (NdrUnionArm arm in Arms.Arms) { builder.Append(' ', indent).AppendFormat("/* case: {0} */", arm.CaseValue).AppendLine(); builder.Append(' ', indent).AppendFormat("{0} Member_{1};", arm.ArmType.FormatType(context), index++).AppendLine(); } if (Arms.DefaultArm != null) { builder.Append(' ', indent).AppendLine("/* default */"); if (Arms.DefaultArm.Format != NdrFormatCharacter.FC_ZERO) { builder.Append(' ', indent).AppendFormat("{0} Default;", new NdrSimpleTypeReference(Arms.DefaultArm.Format).FormatType(context)).AppendLine(); } } if (!NonEncapsulated) { indent /= 2; builder.Append(' ', indent).AppendLine("};"); } builder.AppendLine("};"); return(builder.ToString()); }
internal string FormatProcedure(NdrFormatter context) { string return_value; if (ReturnValue == null) { return_value = "void"; } else if (ReturnValue.Type.Format == NdrFormatCharacter.FC_LONG) { return_value = "HRESULT"; } else { return_value = ReturnValue.Type.FormatType(context); } return(String.Format("{0} {1}({2});", return_value, Name, string.Join(", ", Params.Select((p, i) => String.Format("/* Stack Offset: {0} */ {1} p{2}", p.Offset, p.Format(context), i))))); }
internal string Format(NdrFormatter context) { NdrStringBuilder builder = new NdrStringBuilder(); builder.AppendLine("[Guid(\"{0}\")]", Iid); string base_name = context.IidToName(BaseIid); if (base_name == null) { base_name = $"/* Unknown IID {BaseIid} */ IUnknown"; } builder.AppendLine("interface {0} : {1} {{", context.DemangleComName(Name), base_name); builder.PushIndent(' ', 4); foreach (NdrProcedureDefinition proc in Procedures) { builder.AppendLine(proc.FormatProcedure(context)); } builder.PopIndent(); builder.AppendLine("}").AppendLine(); return(builder.ToString()); }
internal override string FormatType(NdrFormatter formatter) { return(string.Format("{0}<{1}>[{2}]", base.FormatType(formatter), ElementSize, NumberOfElements)); }
internal override string FormatType(NdrFormatter context) { return(string.Format("{0}[{1}]", ElementType.FormatType(context), ElementCount == 0 ? string.Empty : ElementCount.ToString())); }
internal abstract string FormatComplexType(NdrFormatter context);
internal override string FormatType(NdrFormatter context) { return($"struct {Name}"); }
internal string FormatMember(NdrFormatter context) { return(string.Format("{0} {1}", context.FormatComment("Offset: {0}", Offset), MemberType.FormatType(context))); }
internal override string FormatType(NdrFormatter context) { return($"{context.FormatComment("FC_PIPE")} {BaseType.FormatType(context)}"); }
internal override string FormatType(NdrFormatter formatter) { return($"{formatter.FormatComment("Unhandled")} {base.FormatType(formatter)}"); }
internal override string FormatType(NdrFormatter context) { return($"{context.FormatComment(Format.ToString())} {context.SimpleTypeToName(Format)}"); }
internal override string FormatType(NdrFormatter formatter) { return(KnownType.ToString()); }
internal virtual string FormatType(NdrFormatter context) { return(context.SimpleTypeToName(Format)); }
internal override string FormatType(NdrFormatter context) { return(string.Format("{0} {1}", context.FormatComment("range: {0},{1}", MinValue, MaxValue), RangeType.FormatType(context))); }
internal override string FormatType(NdrFormatter context) { return(RefType.FormatType(context)); }
internal override string FormatType(NdrFormatter formatter) { return(string.Format("{0}<{1}>[]", base.FormatType(formatter), ElementSize)); }
internal override string FormatType(NdrFormatter context) { return(string.Format("{0} {1}", Format == NdrFormatCharacter.FC_NON_ENCAPSULATED_UNION ? "union" : "struct", Name)); }
internal override string FormatType(NdrFormatter formatter) { return(Name); }