Используя мой код измени программу таким образом, чтобы патчинг user_ini_bytes и bodyblock_bytes работал параллельно:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <memory>
#include <Windows.h>
#include <TlHelp32.h>

class ProcessHelper {
public:
	static DWORD getProcessId(const std::wstring& processName) {
		DWORD processId = 0;
		HANDLE snapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
		if (snapShot == INVALID_HANDLE_VALUE) {
			return processId;
		}

		PROCESSENTRY32W entry;
		entry.dwSize = sizeof(PROCESSENTRY32W);

		if (Process32FirstW(snapShot, &entry)) {
			do {
				if (_wcsicmp(processName.c_str(), entry.szExeFile) == 0) {
					processId = entry.th32ProcessID;
					break;
				}
			} while (Process32NextW(snapShot, &entry));
		}

		CloseHandle(snapShot);
		return processId;
	}

	static std::uintptr_t getModuleBase(DWORD pid, const std::wstring& moduleName) {
		std::uintptr_t moduleBase = 0;
		HANDLE snapShot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pid);
		if (snapShot == INVALID_HANDLE_VALUE) {
			return moduleBase;
		}

		MODULEENTRY32W entry;
		entry.dwSize = sizeof(MODULEENTRY32W);

		if (Module32FirstW(snapShot, &entry)) {
			do {
				if (moduleName == entry.szModule) {
					moduleBase = reinterpret_cast<std::uintptr_t>(entry.modBaseAddr);
					break;
				}
			} while (Module32NextW(snapShot, &entry));
		}

		CloseHandle(snapShot);
		return moduleBase;
	}
};

namespace driver {
	namespace codes {
		// Used to setup the driver.
		constexpr ULONG attach =
			CTL_CODE(FILE_DEVICE_UNKNOWN, 0x696, METHOD_BUFFERED, FILE_SPECIAL_ACCESS);

		// Read process memory.
		constexpr ULONG read =
			CTL_CODE(FILE_DEVICE_UNKNOWN, 0x697, METHOD_BUFFERED, FILE_SPECIAL_ACCESS);

		// Write process memory.
		constexpr ULONG write =
			CTL_CODE(FILE_DEVICE_UNKNOWN, 0x698, METHOD_BUFFERED, FILE_SPECIAL_ACCESS);
	} // namespace codes

	// Shares between user mode & kernel mode.
	struct Request {
		HANDLE process_id;

		PVOID target;
		PVOID buffer;

		SIZE_T size;
		SIZE_T return_size;
	};

	bool attach_to_process(HANDLE driver_handle, const DWORD pid) {
		Request r;
		r.process_id = reinterpret_cast<HANDLE>(pid);

		return DeviceIoControl(driver_handle, codes::attach, &r, sizeof(r), &r, sizeof(r), nullptr, nullptr);
	}

	// Обновлено для поддержки размера буфера и обработки указателей на данные
	bool read_memory(HANDLE driver_handle, std::uintptr_t address, PVOID buffer, SIZE_T size) {
		Request r;
		r.target = reinterpret_cast<PVOID>(address);
		r.buffer = buffer;
		r.size = size;

		DWORD bytes_returned;
		return DeviceIoControl(driver_handle, codes::read, &r, sizeof(r), &r, sizeof(r), &bytes_returned, nullptr);
	}

	bool write_memory(HANDLE driver_handle, std::uintptr_t address, const void* buffer, SIZE_T size) {
		Request r;
		r.target = reinterpret_cast<PVOID>(address);
		r.buffer = const_cast<PVOID>(buffer);
		r.size = size;

		DWORD bytes_returned;
		return DeviceIoControl(driver_handle, codes::write, &r, sizeof(r), &r, sizeof(r), &bytes_returned, nullptr);
	}

	std::uintptr_t find_memory_sequence(HANDLE driver_handle, DWORD pid, const std::vector<BYTE>& sequence, std::uintptr_t start_address, std::uintptr_t end_address) {
		std::vector<BYTE> buffer(10240); // Буфер для чтения памяти
		std::uintptr_t current_address = start_address;

		while (current_address < end_address) {
			// Чтение памяти процесса
			SIZE_T read_size = buffer.size();
			if (current_address + read_size > end_address) {
				read_size = end_address - current_address;
			}
			if (!read_memory(driver_handle, current_address, buffer.data(), read_size)) {
				// Заметьте, здесь мы принимаем решение продолжать, даже если чтение не удалось
				// Переход к следующему блоку памяти, даже если текущий блок нельзя прочитать
				current_address += buffer.size();
				continue;
			}

			// Поиск последовательности в буфере
			auto it = std::search(buffer.begin(), buffer.begin() + read_size, sequence.begin(), sequence.end());

			// Проверка, нашли ли мы последовательность
			if (it != buffer.begin() + read_size) {
				return current_address + std::distance(buffer.begin(), it);
			}

			// Перемещаем current_address вперед, чтобы искать в следующем блоке памяти
			if (read_size == buffer.size()) {
				current_address += buffer.size() - sequence.size() + 1;
			}
			else {
				// Если размер последнего прочитанного блока меньше размера буфера,
				// значит мы достигли конца доступной области памяти.
				break;
			}
		}

		return 0; // Если не найдено
	}

	void replace_memory_sequence(HANDLE driver_handle, std::uintptr_t address, const std::vector<BYTE>& new_bytes) {
		write_memory(driver_handle, address, new_bytes.data(), new_bytes.size());
	}
}  // namespace driver

int main() {
	auto pid = ProcessHelper::getProcessId(L"l2.bin");

	if (pid == 0) {
		std::cout << "[-] Failed to find l2.bin\n";
		std::cin.get();
		return 1;
	}

	auto driverHandle = CreateFile(L"\\\\.\\MotorolaDriver", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
	if (driverHandle == INVALID_HANDLE_VALUE) {
		std::cout << "[-] Failed to create our driver handle.\n";
		std::cin.get();
		return 1;
	}

	// Использование умного указателя для автоматического закрытия дескриптора
	std::unique_ptr<std::remove_pointer<HANDLE>::type, decltype(&CloseHandle)> driver(driverHandle, &CloseHandle);

	if (driver::attach_to_process(driver.get(), pid)) {
		std::cout << "[+] Attachment successful.\n";
	}
	else {
		std::cout << "[-] Failed to attach to process.\n";
		std::cin.get();
		return 1;
	}

	std::vector<BYTE> user_ini_bytes = { 0x44, 0x00, 0x65, 0x00, 0x62, 0x00, 0x75, 0x00, 0x67, 0x00, 0x4D, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x75, 0x00, 0x2E, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x78, 0x00, 0x65, 0x00, 0x64, 0x00, 0x44, 0x00, 0x65, 0x00, 0x66, 0x00, 0x61, 0x00, 0x75, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x43, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x72, 0x00, 0x61, 0x00, 0x20, 0x00, 0x44, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x46, 0x00, 0x69, 0x00, 0x78, 0x00, 0x65, 0x00, 0x64, 0x00, 0x44, 0x00, 0x65, 0x00, 0x66, 0x00, 0x61, 0x00, 0x75, 0x00, 0x6C, 0x00, 0x74, 0x00, 0x43, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x72, 0x00, 0x61, 0x00, 0x20, 0x00, 0x55, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00, 0x62, 0x00, 0x6F, 0x00, 0x61, 0x00, 0x72, 0x00, 0x64, 0x00, 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
	std::vector<BYTE> user_ini_patch = { 0x44, 0x00, 0x65, 0x00, 0x62, 0x00, 0x75, 0x00, 0x67, 0x00, 0x4D, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x75, 0x00, 0x2E, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x32, 0x00, 0x52, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x77, 0x00, 0x20, 0x00, 0x70, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x63, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x65, 0x00, 0x79, 0x00, 0x62, 0x00, 0x6F, 0x00, 0x61, 0x00, 0x72, 0x00, 0x64, 0x00, 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

	std::cout << "[+] Looking for a sequence in the process memory...\n";

	std::uintptr_t found_user_ini_address = driver::find_memory_sequence(driver.get(), pid, user_ini_bytes, 0x00999999, 0x7FFFFFFF);

	if (found_user_ini_address != 0) {
		std::cout << "[+] User.ini sequence found at: 0x" << std::hex << found_user_ini_address << std::endl;
		driver::replace_memory_sequence(driver.get(), found_user_ini_address, user_ini_patch);
		std::cout << "[+] Sequence has been successfully replaced!\n" << std::endl;
	}
	else {
		std::cout << "[-] User.ini sequence not found.\n" << std::endl;
	}

	std::vector<BYTE> bodyblock_bytes = { 0x85, 0xC0, 0x74, 0x57, 0x5F, 0xB8, 0x01 };
	std::vector<BYTE> bodyblock_patch = { 0x85, 0xC0, 0x74, 0x57, 0x5F, 0xB8, 0x00 };

	std::cout << "[+] Looking for a sequence in the process memory...\n";

	std::uintptr_t found_bodyblock_address = driver::find_memory_sequence(driver.get(), pid, bodyblock_bytes, 0x00999999, 0x7FFFFFFF);

	if (found_bodyblock_address != 0) {
		std::cout << "[+] Bodyblock sequence found at: 0x" << std::hex << found_bodyblock_address << std::endl;
		driver::replace_memory_sequence(driver.get(), found_bodyblock_address, bodyblock_patch);
		std::cout << "[+] Sequence has been successfully replaced!\n" << std::endl;
	}
	else {
		std::cout << "[-] Bodyblock sequence not found.\n" << std::endl;
	}

	std::cin.get();

	return 0;
}