From: Steve Lhomme <rob...@ycbcr.xyz> VirtualProtectFromApp is a fully functional replacement for cases when not needing to touch code sections, and for other cases, the call should fail - just like the previous stub that failed unconditionally.
This should be enough for fixing up runtime pseudo relocations for code generated by LLVM (and possibly by GCC on x86_64), where all fixed up references either are in normal data sections, or in .refptr stubs. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-libraries/winstorecompat/src/VirtualProtect.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mingw-w64-libraries/winstorecompat/src/VirtualProtect.c b/mingw-w64-libraries/winstorecompat/src/VirtualProtect.c index acccf6519..b02dc0cb7 100644 --- a/mingw-w64-libraries/winstorecompat/src/VirtualProtect.c +++ b/mingw-w64-libraries/winstorecompat/src/VirtualProtect.c @@ -30,8 +30,17 @@ BOOL WINAPI VirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect) { +#if _WIN32_WINNT >= _WIN32_WINNT_WIN10 + ULONG OldProtection; + BOOL res = VirtualProtectFromApp(lpAddress, dwSize, flNewProtect, + lpflOldProtect ? &OldProtection : NULL); + if (lpflOldProtect) + *lpflOldProtect = OldProtection; + return res; +#else /* _WIN32_WINNT < _WIN32_WINNT_WIN10 */ SetLastError(ERROR_ACCESS_DENIED); return FALSE; +#endif /* _WIN32_WINNT < _WIN32_WINNT_WIN10 */ } #ifdef _X86_ -- 2.17.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public