public void TestPatternScan() { // Allocate memory in the host process const int testRegionSize = 32; var testRegionAddress = _memoryModule.AllocateMemory(_hostProcessName, testRegionSize); // Write a test array of bytes into memory var testArray = new byte[] { 0xFF, 0x01, 0x5A, 0xFF, 0x22, 0x00, 0x1A, 0xAA, 0xFF, 0xFF, 0xFF }; _memoryModule.WriteMemory(_hostProcessName, testRegionAddress, testArray); // Scan the host process for test array pattern const string testArrayPattern = "FF 01 ?? FF 22 00 ?? AA FF ?? FF"; var result = _memoryModule.PatternScan(_hostProcessName, IntPtr.Zero, testArrayPattern); Assert.Contains(testRegionAddress, result); // Free the memory that was allocated _memoryModule.FreeMemory(_hostProcessName, testRegionAddress); }
public void TestPatternScan() { var regionAddress = _memoryModule.AllocateVirtualMemory(sizeof(int)); var pattern = new byte[] { 0x6A, 0x8B, 0xFF, 0xFF, 0x11, 0x60, 0x00, 0x1A }; _memoryModule.WriteVirtualMemory(regionAddress, pattern); Assert.Contains(regionAddress, _memoryModule.PatternScan(pattern)); _memoryModule.FreeVirtualMemory(regionAddress); }