Exemplo n.º 1
0
 //MemoryHandler.Instance.Process
 /// <summary>
 /// </summary>
 private static void LoadRegions()
 {
     try
     {
         _regions = new List <UnsafeNativeMethods.MemoryBasicInformation>();
         var address = 0;
         while (true)
         {
             var info   = new UnsafeNativeMethods.MemoryBasicInformation();
             var result = UnsafeNativeMethods.VirtualQueryEx(MemoryHandler.Instance.Process.Handle, (uint)address, out info, (uint)Marshal.SizeOf(info));
             if (0 == result)
             {
                 break;
             }
             if (0 != (info.State & MemCommit) && 0 != (info.Protect & Writable) && 0 == (info.Protect & PageGuard))
             {
                 _regions.Add(info);
             }
             address = info.BaseAddress + info.RegionSize;
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 2
0
        //MemoryHandler.Instance.Process
        /// <summary>
        /// </summary>
        private static void LoadRegions()
        {
            try
            {
                _regions = new List<UnsafeNativeMethods.MemoryBasicInformation>();
                var address = 0;
                while (true)
                {
                    var info = new UnsafeNativeMethods.MemoryBasicInformation();
                    var result = UnsafeNativeMethods.VirtualQueryEx(MemoryHandler.Instance.Process.Handle, (uint)address, out info, (uint)Marshal.SizeOf(info));
                    if (0 == result)
                    {
                        break;
                    }
                    if (0 != (info.State & MemCommit) && 0 != (info.Protect & Writable) && 0 == (info.Protect & PageGuard))
                    {
                        _regions.Add(info);
                    }
                    address = info.BaseAddress + info.RegionSize;
                }
            }
            catch (Exception ex)
            {

            }
        }