12345678910111213 |
- #include "Utils.h"
- #include <Windows.h>
- void InjectCode(void* address, const std::vector<uint8_t> data)
- {
- const size_t byteCount = data.size() * sizeof(uint8_t);
- DWORD oldProtect;
- VirtualProtect(address, byteCount, PAGE_EXECUTE_READWRITE, &oldProtect);
- memcpy(address, data.data(), byteCount);
- VirtualProtect(address, byteCount, oldProtect, nullptr);
- }
|