예제 #1
0
 public int FindSymbolByRVA(int rva, SymTagEnum symTag, out IDiaSymbol symbol)
 {
     symbol = null;
     IntPtr _symbol;
     int hr = S.StdCall<int>(GetVTableMember(14), Punk, rva, (int)symTag, out _symbol);
     GC.KeepAlive(this);
     if (hr != S_OK)
         return hr;
     symbol = new IDiaSymbol(_symbol);
     return hr;
 }
예제 #2
0
 public int FindChildren(IDiaSymbol parent, SymTagEnum symTag, String name, NameSearchOptions compareFlags, out IDiaEnumSymbols enumSymbols)
 {
     enumSymbols = null;
     IntPtr _enumSymbols;
     int hr;
     unsafe
     {
         fixed (char* _name = name)
         {
             hr = S.StdCall<int>(GetVTableMember(8), Punk, parent.Punk, (int)symTag, _name, (int)compareFlags, out _enumSymbols);
         }
     }
     GC.KeepAlive(this);
     GC.KeepAlive(parent);
     if (hr != S_OK)
         return hr;
     enumSymbols = new IDiaEnumSymbols(_enumSymbols);
     return hr;
 }
예제 #3
0
        public unsafe int FindChildren(IDiaSymbol parent, SymTagEnum symTag, string name, NameSearchOptions compareFlags, out IDiaEnumSymbols enumSymbols)
        {
            enumSymbols = null;
            IntPtr _enumSymbols;
            int    hr;

            fixed(char *_name = name)
            {
                hr = S.StdCall <int>(GetVTableMember(8), Punk, parent.Punk, (int)symTag, _name, (int)compareFlags, out _enumSymbols);
            }

            GC.KeepAlive(this);
            GC.KeepAlive(parent);
            if (hr != S_OK)
            {
                return(hr);
            }
            enumSymbols = new IDiaEnumSymbols(_enumSymbols);
            return(hr);
        }
예제 #4
0
        //
        // Create the method parameter list.
        //
        private static String CreateParameterListString(IDiaSession session, IDiaSymbol symbol)
        {
            StringBuilder sb = new StringBuilder("(");

            // find the parameters
            IDiaEnumSymbols dataSymbols;
            int hr = session.FindChildren(symbol, SymTagEnum.SymTagData, null, NameSearchOptions.nsNone, out dataSymbols);
            if (hr == S_OK)
            {
                int count;
                hr = dataSymbols.Count(out count);
                if (hr == S_OK)
                {
                    for (int i = 0, iParam = 0; i < count; i++)
                    {
                        IDiaSymbol dataSym;
                        hr = dataSymbols.Item(i, out dataSym);
                        if (hr != S_OK)
                            continue;

                        DataKind dataKind;
                        hr = dataSym.GetDataKind(out dataKind);
                        if (hr != S_OK || dataKind != DataKind.DataIsParam)
                            continue;

                        string paramName;
                        hr = dataSym.GetName(out paramName);
                        if (hr != S_OK)
                        {
                            continue;
                        }

                        //this approximates the way C# displays methods by not including these hidden arguments
                        if (paramName == "InstParam" || paramName == "this")
                        {
                            continue;
                        }

                        IDiaSymbol parameterType;
                        hr = dataSym.GetType(out parameterType);
                        if (hr != S_OK)
                        {
                            continue;
                        }

                        if (iParam++ != 0)
                            sb.Append(", ");

                        sb.Append(parameterType.ToTypeString(session));
                        sb.Append(' ');
                        sb.Append(paramName);
                    }
                }
            }
            sb.Append(')');
            return sb.ToString();
        }
예제 #5
0
 public int GetType(out IDiaSymbol symbol)
 {
     symbol = null;
     IntPtr _symbol;
     int hr = S.StdCall<int>(GetVTableMember(8), Punk, out _symbol);
     GC.KeepAlive(this);
     if (hr != S_OK)
         return hr;
     symbol = new IDiaSymbol(_symbol);
     return hr;
 }
예제 #6
0
 public int Item(int index, out IDiaSymbol symbol)
 {
     symbol = null;
     IntPtr pSymbol;
     int hr = S.StdCall<int>(GetVTableMember(5), Punk, index, out pSymbol);
     GC.KeepAlive(this);
     if (hr != S_OK)
         return hr;
     symbol = new IDiaSymbol(pSymbol);
     return hr;
 }