После внедрения DLL в C++ я получаю код ошибки 5 при попытке NOP нужных мне байтов. Я думаю, что это ошибка разрешения доступа. Что мне для этого сделать? Пробовал запустить загрузчик от имени администратора.
bool memory::patch_bytes(std::uintptr_t address, std::string_view string_bytes) noexcept {
std::vector bytes = string_to_bytes(string_bytes);
void* dest = reinterpret_cast(address);
DWORD old_protection = 0;
if (!VirtualProtect(dest, bytes.size(), PAGE_EXECUTE_READWRITE, &old_protection))
return false;
std::memcpy(dest, bytes.data(), bytes.size());
return VirtualProtect(dest, bytes.size(), old_protection, &old_protection);
}
void patch_integrity_check() {
std::uintptr_t integrity_check = memory::find_pattern("75 ? 85 c9 0f 84 ? ? ? ? 8d 5d");
if (integrity_check == 0)
throw std::runtime_error("integrity check pattern not found"); //success found
if (!memory::patch_bytes(integrity_check, "90 90"))
throw std::runtime_error("failed to patch integrity check"); //error code 5
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... -injection