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:
parent
38d4935007
commit
1311c8157b
|
@ -1007,15 +1007,13 @@ static void test_MapViewOfFile(void)
|
||||||
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
|
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
|
||||||
|
|
||||||
ret = UnmapViewOfFile( (char *)ptr + 4096 );
|
ret = UnmapViewOfFile( (char *)ptr + 4096 );
|
||||||
todo_wine ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
|
ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
|
||||||
if (!ret) UnmapViewOfFile( ptr );
|
|
||||||
|
|
||||||
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 12288 );
|
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 12288 );
|
||||||
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
|
ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
|
||||||
|
|
||||||
ret = UnmapViewOfFile( (char *)ptr + 4096 + 100 );
|
ret = UnmapViewOfFile( (char *)ptr + 4096 + 100 );
|
||||||
todo_wine ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
|
ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
|
||||||
if (!ret) UnmapViewOfFile( ptr );
|
|
||||||
|
|
||||||
CloseHandle(mapping);
|
CloseHandle(mapping);
|
||||||
CloseHandle(file);
|
CloseHandle(file);
|
||||||
|
|
|
@ -1643,7 +1643,7 @@ static void test_mapprotection(void)
|
||||||
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) );
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) );
|
||||||
ok( (status == STATUS_SUCCESS) || (status == STATUS_INVALID_INFO_CLASS), "Expected STATUS_SUCCESS, got %08x\n", status);
|
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;
|
size.u.HighPart = 0;
|
||||||
status = pNtCreateSection ( &h,
|
status = pNtCreateSection ( &h,
|
||||||
STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE,
|
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.LowPart = 0;
|
||||||
offset.u.HighPart = 0;
|
offset.u.HighPart = 0;
|
||||||
count = 0x1000;
|
count = 0x2000;
|
||||||
addr = NULL;
|
addr = NULL;
|
||||||
status = pNtMapViewOfSection ( h, GetCurrentProcess(), &addr, 0, 0, &offset, &count, ViewShare, 0, PAGE_READWRITE);
|
status = pNtMapViewOfSection ( h, GetCurrentProcess(), &addr, 0, 0, &offset, &count, ViewShare, 0, PAGE_READWRITE);
|
||||||
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
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( 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);
|
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);
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
||||||
pNtClose (h);
|
pNtClose (h);
|
||||||
|
|
||||||
|
|
|
@ -2737,7 +2737,6 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||||
struct file_view *view;
|
struct file_view *view;
|
||||||
NTSTATUS status = STATUS_NOT_MAPPED_VIEW;
|
NTSTATUS status = STATUS_NOT_MAPPED_VIEW;
|
||||||
sigset_t sigset;
|
sigset_t sigset;
|
||||||
void *base = ROUND_ADDR( addr, page_mask );
|
|
||||||
|
|
||||||
if (process != NtCurrentProcess())
|
if (process != NtCurrentProcess())
|
||||||
{
|
{
|
||||||
|
@ -2754,7 +2753,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||||
}
|
}
|
||||||
|
|
||||||
server_enter_uninterrupted_section( &csVirtual, &sigset );
|
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 );
|
delete_view( view );
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue