Example #1
0
 /// <summary>
 /// </summary>
 private void LoadRegions()
 {
     try
     {
         _regions = new List <UnsafeNativeMethods.MemoryBasicInformation>();
         var address = 0;
         while (true)
         {
             var info   = new UnsafeNativeMethods.MemoryBasicInformation();
             var result = UnsafeNativeMethods.VirtualQueryEx(MemoryHandler.Instance.ProcessHandle, (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)
     {
     }
 }
Example #2
0
 /// <summary>
 /// </summary>
 private void LoadRegions()
 {
     try
     {
         _regions = new List<UnsafeNativeMethods.MemoryBasicInformation>();
         var address = 0;
         while (true)
         {
             var info = new UnsafeNativeMethods.MemoryBasicInformation();
             var result = UnsafeNativeMethods.VirtualQueryEx(MemoryHandler.Instance.ProcessHandle, (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)
     {
     }
 }