예제 #1
0
        public void BuildIDLInto(IDLFormatter ih, bool embedded)
        {
            var memIdInSpecialRange = (_vd.memid >= 0x60000000 && _vd.memid < 0x60020000);
            var lprops = new List <string>();

            if (!memIdInSpecialRange)
            {
                lprops.Add("id(" + _vd.memid.PaddedHex() + ")");
            }
            var help = _ti.GetHelpDocumentationById(_vd.memid, out var context);

//            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FRESTRICTED)) lprops.Add("restricted");
//            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FHIDDEN)) lprops.Add("hidden");
            AddHelpStringAndContext(lprops, help, context);
            ih.AppendLine("[" + string.Join(", ", lprops.ToArray()) + "] ");
            // Prototype in a different line.
            var ed = _vd.elemDescVar;

            ed.tdesc.ComTypeNameAsString(_ti, ih);
//            if (memIdInSpecialRange)
//            {
//                ih.AddString(" " + _fd.callconv.ToString().Substring(2).ToLower());
//            }
            ih.AppendLine(" " + _name + ";");
        }
예제 #2
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL))
            {
                lprops.Add("dual");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FNONEXTENSIBLE))
            {
                lprops.Add("nonextensible");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FOLEAUTOMATION))
            {
                lprops.Add("oleautomation");
            }
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            if (_ta.cImplTypes > 0)
            {
                _ti.GetRefTypeOfImplType(0, out var href);
                _ti.GetRefTypeInfo(href, out var ti2);
                ih.AddString($"interface {_name} : ");
                ih.AddLink(ti2.GetName(), "i");
                ih.AppendLine(" {");
            }
            else
            {
                ih.AppendLine("interface " + _name + " {");
            }
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
        }
예제 #3
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                "uuid(" + _ta.guid + ")"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL))
            {
                lprops.Add("dual");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FNONEXTENSIBLE))
            {
                lprops.Add("nonextensible");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FOLEAUTOMATION))
            {
                lprops.Add("oleautomation");
            }
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");

            ih.AppendLine("dispinterface " + _name + " {");

            if (_ta.cFuncs > 0 || _ta.cVars > 0)
            {
                // Naughty, but rely on side effect of verifying children.
                using (new IDLHelperTab(ih))
                {
                    _propChildren?.BuildIDLInto(ih);
                    _methodChildren?.BuildIDLInto(ih);
                }
            }
            ih.AppendLine("};");
        }
예제 #4
0
        public override List <string> GetAttributes()
        {
            var lprops = new List <string>();

            if (!MemIdInSpecialRange)
            {
                lprops.Add("id(" + _vd.memid.PaddedHex() + ")");
            }
            var help = _ti.GetHelpDocumentationById(_vd.memid, out var context);

            //            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FRESTRICTED)) lprops.Add("restricted");
            //            if (0 != (_vd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FHIDDEN)) lprops.Add("hidden");
            AddHelpStringAndContext(lprops, help, context);

            return(lprops);
        }
예제 #5
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            ih.AppendLine("[");
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);
            for (var i = 0; i < lprops.Count; ++i)
            {
                ih.AppendLine("  " + lprops[i] + (i < (lprops.Count - 1) ? "," : ""));
            }
            ih.AppendLine("]");
            ih.AppendLine("coclass " + _name + " {");
            using (new IDLHelperTab(ih))
            {
                for (var x = 0; x < _ta.cImplTypes; ++x)
                {
                    _ti.GetRefTypeOfImplType(x, out var href);
                    _ti.GetRefTypeInfo(href, out var ti2);
                    _ti.GetImplTypeFlags(x, out var itypflags);
                    var res = new List <string>();
                    if (0 != (itypflags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FDEFAULT))
                    {
                        res.Add("default");
                    }
                    if (0 != (itypflags & IMPLTYPEFLAGS.IMPLTYPEFLAG_FSOURCE))
                    {
                        res.Add("source");
                    }

                    if (res.Count > 0)
                    {
                        ih.AddString("[" + string.Join(", ", res.ToArray()) + "] ");
                    }
                    ih.AddString("interface ");
                    ih.AddLink(ti2.GetName(), "i");
                    ih.AppendLine(";");
                }
            }
            ih.AppendLine("};");
        }
예제 #6
0
        public override List <string> GetAttributes()
        {
            var lprops = new List <string>();

            if (!MemIdInSpecialRange)
            {
                lprops.Add("id(" + _fd.memid.PaddedHex() + ")");
            }
            switch (_fd.invkind)
            {
            case FuncDesc.InvokeKind.INVOKE_PROPERTYGET:
                lprops.Add("propget");
                break;

            case FuncDesc.InvokeKind.INVOKE_PROPERTYPUT:
                lprops.Add("propput");
                break;

            case FuncDesc.InvokeKind.INVOKE_PROPERTYPUTREF:
                lprops.Add("propputref");
                break;
            }
            if (!MemIdInSpecialRange)
            {
                OWCustData.GetAllFuncCustData(_fd.memid, (INVOKEKIND)_fd.invkind, _ti, ref lprops);
            }
            var help = _ti.GetHelpDocumentationById(_fd.memid, out var context);

            if (0 != (_fd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_fd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            AddHelpStringAndContext(lprops, help, context);

            return(lprops);
        }
예제 #7
0
        public override void BuildIDLInto(IDLFormatter ih)
        {
            if (_ta.cFuncs == 0)
            {
                ih.AppendLine("// NOTE: This module has no entry points. There is no way to");
                ih.AppendLine("//       extract the dllname of a module with no entry points!");
                ih.AppendLine("// ");
            }
            ih.AppendLine("[");
            var liba = new List <string>
            {
                "dllname(\"" + (string.IsNullOrEmpty(_dllname) ? "<no entry points>" : _dllname) + "\")"
            };

            if (_ta.guid != Guid.Empty)
            {
                liba.Add("uuid(" + _ta.guid + ")");
            }
            var help = _ti.GetHelpDocumentationById(-1, out var cnt);

            if (!string.IsNullOrEmpty(help))
            {
                liba.Add("helpstring(\"" + help + "\")");
            }
            if (cnt != 0)
            {
                liba.Add("helpcontext(" + cnt.PaddedHex() + ")");
            }

            cnt = 0;
            liba.ForEach(x => ih.AppendLine("  " + x + (++cnt == liba.Count ? "" : ",")));
            ih.AppendLine("]");
            ih.AppendLine("module " + _name + " {");
            using (new IDLHelperTab(ih))
            {
                Children.ForEach(x => x.BuildIDLInto(ih));
            }
            ih.AppendLine("};");
        }
예제 #8
0
        public override List <string> GetAttributes()
        {
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };
            var ta = new TypeAttr(_ti);

            if (_ta.wMajorVerNum != 0 || _ta.wMinorVerNum != 0)
            {
                lprops.Add($"version({ta.wMajorVerNum}.{ta.wMinorVerNum})");
            }
            OWCustData.GetCustData(_ti, ref lprops);
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);

            if (0 == (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FCANCREATE))
            {
                lprops.Add("noncreatable");
            }

            return(lprops);
        }
예제 #9
0
        public override List <string> GetAttributes()
        {
            var liba = new List <string>
            {
                "dllname(\"" + (string.IsNullOrEmpty(_dllname) ? "<no entry points>" : _dllname) + "\")"
            };

            if (_ta.guid != Guid.Empty)
            {
                liba.Add("uuid(" + _ta.guid + ")");
            }
            var help = _ti.GetHelpDocumentationById(-1, out var cnt);

            if (!string.IsNullOrEmpty(help))
            {
                liba.Add("helpstring(\"" + help + "\")");
            }
            if (cnt != 0)
            {
                liba.Add("helpcontext(" + cnt.PaddedHex() + ")");
            }

            return(liba);
        }
예제 #10
0
        public override List <string> GetAttributes()
        {
            var lprops = new List <string> {
                $"uuid({_ta.guid})"
            };

            var ta = new TypeAttr(_ti);

            if (ta.wMajorVerNum != 0 || ta.wMinorVerNum != 0)
            {
                lprops.Add($"version({ta.wMajorVerNum}.{ta.wMinorVerNum})");
            }
            OWCustData.GetCustData(_ti, ref lprops);
            var help = _ti.GetHelpDocumentationById(-1, out var context);

            AddHelpStringAndContext(lprops, help, context);

            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FAGGREGATABLE))
            {
                lprops.Add("aggregatable");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FAPPOBJECT))
            {
                lprops.Add("appobject");
            }
            // TYPEFLAG_FCANCREATE is not applicable to interfaces/dispinterfaces
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FCONTROL))
            {
                lprops.Add("control");
            }
            // No IDL syntax for TYPEFLAG_FDISPATCHABLE -- it is computed
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FDUAL))
            {
                lprops.Add("dual");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FLICENSED))
            {
                lprops.Add("licensed");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FNONEXTENSIBLE))
            {
                lprops.Add("nonextensible");
            }
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FOLEAUTOMATION))
            {
                lprops.Add("oleautomation");
            }
            // Can't find IDL for TYPEFLAG_FPREDECLID?!?
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FPROXY))
            {
                lprops.Add("proxy");
            }
            // Can't find IDL for TYPEFLAG_FREPLACEABLE?!?
            if (0 != (_ta.wTypeFlags & TypeAttr.TypeFlags.TYPEFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            // Can't find IDL for TYPEFLAG_FREVERSEBIND?!?

            return(lprops);
        }
예제 #11
0
        public void BuildIDLInto(IDLFormatter ih, bool bAsDispatch)
        {
            var memIdInSpecialRange = (_fd.memid >= 0x60000000 && _fd.memid < 0x60020000);
            var lprops = new List <string>();

            if (!memIdInSpecialRange)
            {
                lprops.Add("id(" + _fd.memid.PaddedHex() + ")");
            }
            switch (_fd.invkind)
            {
            case FuncDesc.InvokeKind.INVOKE_PROPERTYGET:
                lprops.Add("propget");
                break;

            case FuncDesc.InvokeKind.INVOKE_PROPERTYPUT:
                lprops.Add("propput");
                break;

            case FuncDesc.InvokeKind.INVOKE_PROPERTYPUTREF:
                lprops.Add("propputref");
                break;
            }
            var help = _ti.GetHelpDocumentationById(_fd.memid, out var context);

            if (0 != (_fd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FRESTRICTED))
            {
                lprops.Add("restricted");
            }
            if (0 != (_fd.wFuncFlags & FuncDesc.FuncFlags.FUNCFLAG_FHIDDEN))
            {
                lprops.Add("hidden");
            }
            AddHelpStringAndContext(lprops, help, context);
            ih.AppendLine("[" + string.Join(", ", lprops.ToArray()) + "] ");
            // Prototype in a different line.
            var ed = _fd.elemdescFunc;

            Action <int> paramtextgen   = null;
            ElemDesc     elast          = null;
            var          bRetvalPresent = false;

            if (_fd.cParams > 0)
            {
                var names = _fd.GetNames(_ti);
                var edps  = _fd.elemdescParams;
                if (edps.Length > 0)
                {
                    elast = edps[edps.Length - 1];
                }
                if (bAsDispatch && elast != null && 0 != (elast.paramdesc.wParamFlags & ParamDesc.ParamFlags.PARAMFLG_FRETVAL))
                {
                    bRetvalPresent = true;
                }
                // ReSharper disable once UnusedVariable
                var maxCnt = (bAsDispatch && bRetvalPresent) ? _fd.cParams - 1 : _fd.cParams;

                paramtextgen = x =>
                {
                    var paramname = (names[x + 1] == null) ? "rhs" : names[x + 1];
                    var edp       = edps[x];
                    ih.AddString(ParamFlagsDescription(edp.paramdesc) + " ");
                    edp.tdesc.ComTypeNameAsString(_ti, ih);
                    ih.AddString(" " + paramname);
                };
            }
            (bRetvalPresent ? elast : ed).tdesc.ComTypeNameAsString(_ti, ih);
            if (memIdInSpecialRange)
            {
                ih.AddString(" " + _fd.callconv.ToString().Substring(2).ToLower());
            }
            ih.AddString($" {_name}");
            switch (_fd.cParams)
            {
            case 0:
                ih.AppendLine("();");
                break;

            case 1:
                ih.AddString("(");
                paramtextgen?.Invoke(0);
                ih.AppendLine(");");
                break;

            default:
                ih.AppendLine("(");
                using (new IDLHelperTab(ih))
                {
                    for (var y = 0; y < _fd.cParams; ++y)
                    {
                        paramtextgen?.Invoke(y);
                        ih.AppendLine(y == _fd.cParams - 1 ? "" : ",");
                    }
                }
                ih.AppendLine(");");
                break;
            }
        }