Module: wine Branch: master Commit: 8eb893f185414278dc45b238349c2e87a73381c5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8eb893f185414278dc45b23834...
Author: Michael Müller michael@fds-team.de Date: Tue Feb 16 06:53:14 2016 +0100
kernel32: Allow to pass NULL as old protection in VirtualProtect for Win9x compatibility.
Signed-off-by: Michael Müller michael@fds-team.de Signed-off-by: Sebastian Lackner sebastian@fds-team.de Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/virtual.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c index 03ef38c..4bfc6cc 100644 --- a/dlls/kernel32/virtual.c +++ b/dlls/kernel32/virtual.c @@ -235,7 +235,13 @@ BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD ol BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD old_prot ) { - NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot ); + NTSTATUS status; + DWORD prot; + + /* Win9x allows to pass NULL as old_prot while it fails on NT */ + if (!old_prot && (GetVersion() & 0x80000000)) old_prot = &prot; + + status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot ); if (status) SetLastError( RtlNtStatusToDosError(status) ); return !status; }