示例#1
0
        // Token: 0x06000129 RID: 297 RVA: 0x0001D17C File Offset: 0x0001B37C
        public long pagedMemorySearchMatch(int[] search, MemAPI.MemoryRegion[] regions)
        {
            long num = -1L;

            for (int i = 0; i < regions.Length; i++)
            {
                MemAPI.MemoryRegion memoryRegion = regions[i];
                num = this.pagedMemorySearchMatch(search, memoryRegion.regionStart, memoryRegion.regionSize);
                if (num > 0L)
                {
                    break;
                }
            }
            return(num);
        }
示例#2
0
        public MemAPI.MemoryRegion[] listProcessMemoryRegions(IntPtr hProc)
        {
            IntPtr intPtr;

            MemAPI.MEMORY_BASIC_INFORMATION mEMORYBASICINFORMATION;
            List <MemAPI.MemoryRegion>      memoryRegions = new List <MemAPI.MemoryRegion>();

            if (hProc != IntPtr.Zero)
            {
                intPtr = hProc;
            }
            else
            {
                if (this.p == null)
                {
                    return(memoryRegions.ToArray());
                }
                intPtr = MemAPI.OpenProcess(MemAPI.ProcessAccessFlags.All, false, this.p.Id);
            }
            long num         = 9223372036854775807L;
            long baseAddress = (long)0;

            do
            {
                MemAPI.VirtualQueryEx(intPtr, (IntPtr)baseAddress, out mEMORYBASICINFORMATION, (uint)Marshal.SizeOf(typeof(MemAPI.MEMORY_BASIC_INFORMATION)));
                if ((long)mEMORYBASICINFORMATION.RegionSize > (long)0 && mEMORYBASICINFORMATION.State == MemAPI.StateEnum.MEM_COMMIT && mEMORYBASICINFORMATION.Type == MemAPI.TypeEnum.MEM_PRIVATE && (mEMORYBASICINFORMATION.Protect == MemAPI.AllocationProtectEnum.PAGE_READWRITE || mEMORYBASICINFORMATION.Protect == MemAPI.AllocationProtectEnum.PAGE_EXECUTE_READWRITE))
                {
                    MemAPI.MemoryRegion memoryRegion = new MemAPI.MemoryRegion()
                    {
                        regionStart = (long)mEMORYBASICINFORMATION.BaseAddress,
                        regionSize  = (long)mEMORYBASICINFORMATION.RegionSize,
                        state       = mEMORYBASICINFORMATION.State,
                        protect     = mEMORYBASICINFORMATION.Protect
                    };
                    memoryRegions.Add(memoryRegion);
                }
                if (baseAddress == (long)mEMORYBASICINFORMATION.BaseAddress + (long)mEMORYBASICINFORMATION.RegionSize)
                {
                    break;
                }
                baseAddress = (long)mEMORYBASICINFORMATION.BaseAddress + (long)mEMORYBASICINFORMATION.RegionSize;
            }while (baseAddress <= num);
            if (hProc == IntPtr.Zero)
            {
                MemAPI.CloseHandle(intPtr);
            }
            return(memoryRegions.ToArray());
        }
示例#3
0
        public long pagedMemorySearchMatch(int[] search, MemAPI.MemoryRegion[] regions)
        {
            long num = (long)-1;

            MemAPI.MemoryRegion[] memoryRegionArray = regions;
            for (int i = 0; i < (int)memoryRegionArray.Length; i++)
            {
                MemAPI.MemoryRegion memoryRegion = memoryRegionArray[i];
                num = this.pagedMemorySearchMatch(search, memoryRegion.regionStart, memoryRegion.regionSize);
                if (num > (long)0)
                {
                    break;
                }
            }
            return(num);
        }