i have a game “A” , tool “B” for make write value at address on memory of game
i need to make tool using c# or c++ for Monitor the memory if it has been changed by specific tool “B”
i tried to make that code using c# :
using (var memorySharp = new MemorySharp(targetProcessId))
{
// Create a thread that continuously monitors memory writes
var monitorThread = new System.Threading.Thread(() =>
{
// Create an array to store the initial state of memory
byte[] initialMemory = new byte[0x1000]; // Replace with the desired size
// Read the initial state of memory
memorySharp.ReadBytes(IntPtr.Zero, initialMemory);
while (true)
{
// Read the current state of memory
byte[] currentMemory = new byte[0x1000]; // Replace with the desired size
memorySharp.ReadBytes(IntPtr.Zero, currentMemory);
// Compare the current state with the initial state
if (!ByteArrayCompare(initialMemory, currentMemory))
{
Console.WriteLine("Memory write detected!");
}
// Update the initial state
initialMemory = currentMemory;
// Sleep or use a timer to avoid constant checking
System.Threading.Thread.Sleep(1000); // Sleep for 1 second, for example
}
});
monitorThread.Start();
Console.WriteLine("Monitoring memory writes. Press Enter to exit.");
Console.ReadLine();
// Stop the monitoring thread when done
monitorThread.Abort();
}
}
Check that address periodically? Sending a message from B to A when B changes memory?
And what’s your question now?
make tool using c# or c++ for Monitor the memory if it has been changed by specific tool “B”