Module: wine Branch: master Commit: 1b26d38095e7d710375657b64db80c7c858ebea6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b26d38095e7d710375657b64d...
Author: Michael Müller michael@fds-team.de Date: Tue Jul 19 13:00:30 2016 +0200
kernel32: In Win9x mode UnmapViewOfFile requires base address of a mapping.
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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c index 37ab264..5733a42 100644 --- a/dlls/kernel32/virtual.c +++ b/dlls/kernel32/virtual.c @@ -576,7 +576,19 @@ LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access, */ BOOL WINAPI UnmapViewOfFile( LPCVOID addr ) { - NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr ); + NTSTATUS status; + + if (GetVersion() & 0x80000000) + { + MEMORY_BASIC_INFORMATION info; + if (!VirtualQuery( addr, &info, sizeof(info) ) || info.AllocationBase != addr) + { + SetLastError( ERROR_INVALID_ADDRESS ); + return FALSE; + } + } + + status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr ); if (status) SetLastError( RtlNtStatusToDosError(status) ); return !status; }