Round size to 64k for allocations without base address

This commit is contained in:
Gliniak 2022-03-08 09:04:14 +01:00
parent af806ee98f
commit ba60b94c7d
1 changed files with 3 additions and 2 deletions

View File

@ -120,7 +120,8 @@ dword_result_t NtAllocateVirtualMemory_entry(lpdword_t base_addr_ptr,
uint32_t adjusted_size = int32_t(*region_size_ptr) < 0
? -int32_t(region_size_ptr.value())
: region_size_ptr.value();
adjusted_size = xe::round_up(adjusted_size, page_size);
adjusted_size = xe::round_up(adjusted_size, adjusted_base ? page_size : 64 * 1024);
// Allocate.
uint32_t allocation_type = 0;
@ -207,7 +208,7 @@ dword_result_t NtProtectVirtualMemory_entry(lpdword_t base_addr_ptr,
if (protect_bits & (X_PAGE_EXECUTE | X_PAGE_EXECUTE_READ |
X_PAGE_EXECUTE_READWRITE | X_PAGE_EXECUTE_WRITECOPY)) {
XELOGW("Game setting EXECUTE bit on protect");
return X_STATUS_ACCESS_DENIED;
return X_STATUS_INVALID_PAGE_PROTECTION;
}
auto heap = kernel_memory()->LookupHeap(*base_addr_ptr);