kernel32: Add a test for rw mapping of a read-only section

Dmitry Timoshkov dmitry at codeweavers.com
Wed Sep 19 06:01:22 CDT 2007


Hello,

this patch adds a test for the problem reported in the bug 9714, and
confirms that this is a Wine bug.

Changelog:
    kernel32: Add a test for rw mapping of a read-only section.

---
 dlls/kernel32/tests/virtual.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 7727c65..5bfa3e9 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -416,6 +416,17 @@ static void test_MapViewOfFile(void)
 
     CloseHandle( file );
     DeleteFileA( testfile );
+
+    file = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, "Global\\Foo");
+    ok( file != 0, "CreateFileMapping PAGE_READWRITE failed\n" );
+
+    mapping = OpenFileMapping( FILE_MAP_READ, FALSE, "Global\\Foo" );
+    ok( mapping != 0, "OpenFileMapping FILE_MAP_READ failed\n" );
+    ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
+todo_wine ok( !ptr, "MapViewOfFile FILE_MAP_WRITE should fail\n" );
+    CloseHandle( mapping );
+
+    CloseHandle( file );
 }
 
 static DWORD (WINAPI *pNtMapViewOfSection)( HANDLE handle, HANDLE process, PVOID *addr_ptr,
-- 
1.5.3.1






More information about the wine-patches mailing list