Rebase against a71128513767d44a8f42e10895578b650061bdce.

[ntdll-NtUnmapViewOfSection]
Removed patch to fix behavior of UnmapViewOfFile for Win9x (accepted upstream).

[shell32-FolderItems_Stub_Iface]
Removed patch to implement stubbed FolderItems interface (fixed upstream).
This commit is contained in:
Sebastian Lackner
2016-07-19 18:15:40 +02:00
parent 5125d3edeb
commit cbd440689d
7 changed files with 24 additions and 503 deletions

View File

@@ -1,112 +0,0 @@
From fcbd459e01f674633462156e45c77397e5af3e34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 16 May 2016 18:50:55 +0200
Subject: ntdll: NtUnmapViewOfSection must succeed for all offsets within the
mapped range.
---
dlls/kernel32/tests/virtual.c | 27 ++++++++++++++++++++++++++-
dlls/ntdll/tests/info.c | 6 +++---
dlls/ntdll/virtual.c | 3 +--
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 37206b5..552cbb4 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -435,7 +435,7 @@ static void test_MapViewOfFile(void)
SetLastError(0xdeadbeef);
file = CreateFileA( testfile, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 );
ok( file != INVALID_HANDLE_VALUE, "CreateFile error %u\n", GetLastError() );
- SetFilePointer( file, 4096, NULL, FILE_BEGIN );
+ SetFilePointer( file, 12288, NULL, FILE_BEGIN );
SetEndOfFile( file );
/* read/write mapping */
@@ -994,6 +994,31 @@ static void test_MapViewOfFile(void)
ok(info.State == MEM_FREE, "%#x != MEM_FREE\n", info.State);
ok(info.Type == 0, "%#x != 0\n", info.Type);
+ mapping = CreateFileMappingA( file, NULL, PAGE_READONLY, 0, 12288, NULL );
+ ok( mapping != 0, "CreateFileMappingA 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 + 100 );
+ ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
+ if (!ret) UnmapViewOfFile( ptr );
+
+ ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 12288 );
+ ok( ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError() );
+
+ ret = UnmapViewOfFile( (char *)ptr + 4096 );
+ ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
+ if (!ret) UnmapViewOfFile( ptr );
+
+ 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 );
+ ok( ret, "UnmapViewOfFile failed with error %u\n", GetLastError() );
+ if (!ret) UnmapViewOfFile( ptr );
+
+ CloseHandle(mapping);
CloseHandle(file);
DeleteFileA(testfile);
}
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index be355fb..19c7d66 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -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);
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5c43d26..27daf96 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2723,7 +2723,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())
{
@@ -2740,7 +2739,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;
--
2.8.0

View File

@@ -1,38 +0,0 @@
From 6ca6102f0f4c52dee00013a8e1d0d924f4b6c5a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 14 May 2016 17:21:54 +0200
Subject: kernel32: Fail in UnmapViewOfFile on Win 9X when addr is not a base
address of a mapping.
---
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 32f2d65..7e9c2f3 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;
}
--
2.8.0

View File

@@ -1 +0,0 @@
Fixes: [2905] UnmapViewOfFile should fail on Win9x when addr is not the base address of a mapping