コード例 #1
0
        public void recordMemorysInfo()
        {
            this.memorySnapshot = new System.Collections.Generic.List <ProcessMemory.MEMORY_BASIC_INFORMATION>();
            uint num = 1u;

            while (num != 0u)
            {
                ProcessMemory.MEMORY_BASIC_INFORMATION item = default(ProcessMemory.MEMORY_BASIC_INFORMATION);
                ProcessMemory.VirtualQueryEx(this.processHandle, num, ref item, (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(ProcessMemory.MEMORY_BASIC_INFORMATION)));
                uint num2 = num;
                num = item.BaseAddress + item.RegionSize;
                if (num < num2)
                {
                    return;
                }
                if (item.AllocationProtect == ProcessMemory.AllocationProtect.PAGE_READWRITE && item.Type == ProcessMemory.MemoryType.MEM_PRIVATE && item.State == ProcessMemory.MemoryState.MEM_COMMIT)
                {
                    this.memorySnapshot.Add(item);
                }
            }
        }
コード例 #2
0
 private static extern int VirtualQueryEx(uint hProcess, uint lpAddress, ref ProcessMemory.MEMORY_BASIC_INFORMATION lpBuffer, uint dwLength);