Commit 1311c815 authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

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

parent 38d49350
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment