I am trying to inject bytes into the 64-bit game process, since there are a lot of bytes to look for the cave address during the game, but VirtualQueryEx does not work correctly, compared it with the VMMap program C #

VMMap

C # does not find free addresses at all. How to make finds these free places in the space of the game.

IntPtr handle = OpenProcess(ProcessAccessFlags.All, false, proc.Id); SYSTEM_INFO sysinfo = new SYSTEM_INFO(); GetSystemInfo(ref sysinfo); long MaxAddress = (Int64)sysinfo.lpMaximumApplicationAddress; long address = 0; do { MEMORY_BASIC_INFORMATION m; UIntPtr result = VirtualQueryEx(handle, (IntPtr)address, out m, (int)Marshal.SizeOf(typeof(MEMORY_BASIC_INFORMATION))); ListViewItem l = new ListViewItem(m.BaseAddress.ToString("X8")); l.SubItems.Add(m.AllocationBase.ToString("X8")); l.SubItems.Add(m.RegionSize.ToString()); l.SubItems.Add(m.State.ToString()); l.SubItems.Add(m.AllocationProtect.ToString()); l.SubItems.Add(m.Protect.ToString("X3")); l.SubItems.Add(m.Type.ToString()); l.SubItems.Add(m.__alignment1.ToString("X8")); l.SubItems.Add(m.__alignment2.ToString("X8")); address = (long)m.BaseAddress + (long)m.RegionSize; } while (address <= MaxAddress); 

fairly common code.

  • 2
    Of the two options: the library function does not work correctly and the code that uses it is incorrectly written - what do you think is more common? - VladD
  • I searched for other codes when I did not find it, tried to understand how this API works in general, but did not understand. Maybe you also tried to do it, share the code. - Laziz Ergashev

0