| 229 | |
| 230 | |
| 231 | bool |
| 232 | commitMemory(uintptr_t address, |
| 233 | size_t size, |
| 234 | ProtectFlags flags) |
| 235 | { |
| 236 | auto baseAddress = reinterpret_cast<LPVOID>(address); |
| 237 | auto result = VirtualAlloc(baseAddress, |
| 238 | size, |
| 239 | MEM_COMMIT, |
| 240 | flagsToPageProtect(flags)); |
| 241 | |
| 242 | if (result != baseAddress) { |
| 243 | gLog->error("commitMemory(address: 0x{:X}, size: 0x{:X}, flags: {}) failed with error: {}", |
| 244 | address, size, static_cast<int>(flags), GetLastError()); |
| 245 | return false; |
| 246 | } |
| 247 | |
| 248 | return true; |
| 249 | } |
| 250 | |
| 251 | |
| 252 | bool |
no test coverage detected