示例#1
0
        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
        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);
        }