Example #1
0
        public static Heap[] GetHeaps()
        {
            IntPtr[] heapAddresses = new IntPtr[64];
            int retHeaps;

            retHeaps = Win32.RtlGetProcessHeaps(heapAddresses.Length, heapAddresses);

            if (retHeaps > heapAddresses.Length)
            {
                heapAddresses = new IntPtr[retHeaps];
                retHeaps = Win32.RtlGetProcessHeaps(heapAddresses.Length, heapAddresses);
            }

            int numberOfHeaps = Math.Min(heapAddresses.Length, retHeaps);
            Heap[] heaps = new Heap[numberOfHeaps];

            for (int i = 0; i < numberOfHeaps; i++)
                heaps[i] = new Heap(heapAddresses[i]);

            return heaps;
        }
Example #2
0
        public static Heap[] GetHeaps()
        {
            IntPtr[] heapAddresses = new IntPtr[64];
            int retHeaps;

            retHeaps = Win32.RtlGetProcessHeaps(heapAddresses.Length, heapAddresses);

            // Reallocate the buffer if it wasn't large enough.
            if (retHeaps > heapAddresses.Length)
            {
                heapAddresses = new IntPtr[retHeaps];
                retHeaps = Win32.RtlGetProcessHeaps(heapAddresses.Length, heapAddresses);
            }

            int numberOfHeaps = Math.Min(heapAddresses.Length, retHeaps);
            Heap[] heaps = new Heap[numberOfHeaps];

            for (int i = 0; i < numberOfHeaps; i++)
                heaps[i] = new Heap(heapAddresses[i]);

            return heaps;
        }