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>
This commit is contained in:
Michael Müller 2016-07-19 13:00:30 +02:00 committed by Alexandre Julliard
parent 1311c8157b
commit 1b26d38095
1 changed files with 13 additions and 1 deletions

View File

@ -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;
}