Esempio n. 1
0
        private GCDesc FillGCDesc()
        {
            DesktopRuntimeBase runtime = DesktopHeap.DesktopRuntime;

            Debug.Assert(_constructedMT != 0, "Attempted to fill GC desc with a constructed (not real) type.");
            if (!runtime.ReadDword(_constructedMT - (ulong)IntPtr.Size, out int entries))
            {
                return(null);
            }

            // Get entries in map
            if (entries < 0)
            {
                entries = -entries;
            }

            int slots = 1 + entries * 2;

            byte[] buffer = new byte[slots * IntPtr.Size];
            if (!runtime.ReadMemory(_constructedMT - (ulong)(slots * IntPtr.Size), buffer, buffer.Length, out int read) || read != buffer.Length)
            {
                return(null);
            }

            // Construct the gc desc
            return(new GCDesc(buffer));
        }