コード例 #1
0
ファイル: DebugSymbols.cs プロジェクト: wp442638266/clrmd
        public string?GetModuleNameStringWide(DebugModuleName which, int index, ulong imageBase)
        {
            InitDelegate(ref _getModuleNameStringWide, VTable.GetModuleNameStringWide);

            using IDisposable holder = _sys.Enter();
            HResult hr = _getModuleNameStringWide(Self, which, index, imageBase, null, 0, out int needed);

            if (!hr)
            {
                return(null);
            }

            StringBuilder sb = new StringBuilder(needed);

            hr = _getModuleNameStringWide(Self, which, index, imageBase, sb, sb.Capacity, out _);
            if (!hr)
            {
                return(null);
            }

            return(sb.ToString());
        }
コード例 #2
0
ファイル: DebugSymbols.cs プロジェクト: wilvk/dotnet-sos
        public string?GetModuleNameStringWide(DebugModuleName which, int index, ulong imageBase)
        {
            InitDelegate(ref _getModuleNameStringWide, VTable.GetModuleNameStringWide);

            using IDisposable holder = _sys.Enter();
            HResult hr = _getModuleNameStringWide(Self, which, index, imageBase, null, 0, out int needed);

            if (!hr)
            {
                return(null);
            }

            string nameResult = new string('\0', needed - 1);

            fixed(char *nameResultPtr = nameResult)
            if (_getModuleNameStringWide(Self, which, index, imageBase, nameResultPtr, needed, out _))
            {
                return(nameResult);
            }

            return(null);
        }