예제 #1
0
        public static List <MemoryBasicInformation> LoadRegions(SafeMemoryHandle processHandle, IntPtr startAddress, IntPtr endAddress,
                                                                MemoryAllocationState memoryAllocationState = MemoryAllocationState.MEM_COMMIT,
                                                                MemoryProtectionType memoryProtectionType   = MemoryProtectionType.PAGE_ACCESSIBLE)
        {
            List <MemoryBasicInformation> regions = new List <MemoryBasicInformation>();

            if (startAddress == endAddress)
            {
                return(regions);
            }

            if (endAddress == IntPtr.Zero)
            {
                endAddress = new IntPtr(0x7fffffffffff);
            }

            IntPtr seek = startAddress;

            do
            {
                MemoryBasicInformation region = Native.Query(processHandle, seek, MarshalType <MemoryBasicInformation> .Size);
                if ((region.State & memoryAllocationState) != 0 && (region.Protect & memoryProtectionType) != 0)
                {
                    regions.Add(region);
                }

                seek = IntPtr.Add(region.BaseAddress, region.RegionSize.ToInt32());
            }while (seek.ToInt64() < endAddress.ToInt64());

            return(regions);
        }
예제 #2
0
파일: Imports.cs 프로젝트: zaafar/ExileApi
 internal static extern IntPtr VirtualAllocEx(SafeMemoryHandle hProcess, [Optional] IntPtr lpAddress, int nSize,
                                              MemoryAllocationState dwAllocationType, MemoryProtectionType dwProtect);
예제 #3
0
파일: Imports.cs 프로젝트: zaafar/ExileApi
 internal static extern IntPtr VirtualAlloc([Optional] IntPtr lpAddress, int nSize, MemoryAllocationState dwAllocationType,
                                            MemoryProtectionType dwProtect);