La verdad es que soy novato con lo relacionado con memoria y no estoy seguro de cómo hacerlo, estoy interesado en escanear cadenas/strings que son estáticas en la memoria pero no he encontrado ninguna forma eficaz de hacerlo.
He encontrado esto en un foro, pero siempre devuelve 0
Código
public static List<MEMORY_BASIC_INFORMATION> MemReg { get; set; } public static void MemInfo(IntPtr pHandle) { while (true) { if (MemDump == 0) break; if ((MemInfo.State & 0x1000) != 0 && (MemInfo.Protect & 0x100) == 0) MemReg.Add(MemInfo); } } public static IntPtr _Scan(byte[] sIn, byte[] sFor) { int End = sFor.Length - 1; for (int i = 0; i < 256; i++) sBytes[i] = sFor.Length; for (int i = 0; i < End; i++) sBytes[sFor[i]] = End - i; while (Pool <= sIn.Length - sFor.Length) { for (int i = End; sIn[Pool + i] == sFor[i]; i--) Pool += sBytes[sIn[Pool + End]]; } return IntPtr.Zero; } public static IntPtr AobScan(string ProcessName, byte[] Pattern) { Process[] P = Process.GetProcessesByName(ProcessName); if (P.Length == 0) return IntPtr.Zero; MemInfo(P[0].Handle); for (int i = 0; i < MemReg.Count; i++) { ReadProcessMemory(P[0].Handle, MemReg[i].BaseAddress, buff, MemReg[i].RegionSize, 0); IntPtr Result = _Scan(buff, Pattern); if (Result != IntPtr.Zero) } return IntPtr.Zero; }