AllocatorHooks: Amend VirtualProtect for Windows

VirtualProtect returns non-zero on success, also the old protection flag
parameter isn't allowed to be null.
This commit is contained in:
LC committed 2026-07-11 23:24:30 -04:00
1 parent 76b35dfeb0
commit 25f2021711
1 file changed
+2 -1
@@ -97,7 +97,8 @@ inline bool VirtualProtect(void* Ptr, size_t Size, ProtectOptions options) {
LOGMAN_MSG_A_FMT("Unknown VirtualProtect options combination");
}
return ::VirtualProtect(Ptr, Size, prot, nullptr) == 0;
DWORD OldProt {};
return ::VirtualProtect(Ptr, Size, prot, &OldProt) != 0;
}
FEX_DEFAULT_VISIBILITY extern VirtualNamePtr VirtualName;