ntdll: NtUnmapViewOfSection should succeed for all offsets within the mapped range.

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 12:59:55 +02:00 committed by Alexandre Julliard
parent 38d4935007
commit 1311c8157b
3 changed files with 6 additions and 9 deletions

View File

@ -1007,15 +1007,13 @@ static void test_MapViewOfFile(void)
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
ret = UnmapViewOfFile( (char *)ptr + 4096 );
todo_wine ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
if (!ret) UnmapViewOfFile( ptr );
ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 12288 );
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
ret = UnmapViewOfFile( (char *)ptr + 4096 + 100 );
todo_wine ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
if (!ret) UnmapViewOfFile( ptr );
ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
CloseHandle(mapping);
CloseHandle(file);

View File

@ -1643,7 +1643,7 @@ static void test_mapprotection(void)
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) );
ok( (status == STATUS_SUCCESS) || (status == STATUS_INVALID_INFO_CLASS), "Expected STATUS_SUCCESS, got %08x\n", status);
size.u.LowPart = 0x1000;
size.u.LowPart = 0x2000;
size.u.HighPart = 0;
status = pNtCreateSection ( &h,
STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE,
@ -1657,7 +1657,7 @@ static void test_mapprotection(void)
offset.u.LowPart = 0;
offset.u.HighPart = 0;
count = 0x1000;
count = 0x2000;
addr = NULL;
status = pNtMapViewOfSection ( h, GetCurrentProcess(), &addr, 0, 0, &offset, &count, ViewShare, 0, PAGE_READWRITE);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
@ -1680,7 +1680,7 @@ static void test_mapprotection(void)
ok( retlen == sizeof(info), "Expected STATUS_SUCCESS, got %08x\n", status);
ok((info.Protect & ~PAGE_NOCACHE) == PAGE_READWRITE, "addr.Protect is not PAGE_READWRITE, but 0x%x\n", info.Protect);
status = pNtUnmapViewOfSection (GetCurrentProcess(), addr);
status = pNtUnmapViewOfSection( GetCurrentProcess(), (char *)addr + 0x1050 );
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
pNtClose (h);

View File

@ -2737,7 +2737,6 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
struct file_view *view;
NTSTATUS status = STATUS_NOT_MAPPED_VIEW;
sigset_t sigset;
void *base = ROUND_ADDR( addr, page_mask );
if (process != NtCurrentProcess())
{
@ -2754,7 +2753,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
}
server_enter_uninterrupted_section( &csVirtual, &sigset );
if ((view = VIRTUAL_FindView( base, 0 )) && (base == view->base) && !(view->protect & VPROT_VALLOC))
if ((view = VIRTUAL_FindView( addr, 0 )) && !(view->protect & VPROT_VALLOC))
{
delete_view( view );
status = STATUS_SUCCESS;