=?UTF-8?Q?Michael=20M=C3=BCller=20?=: kernel32/tests: Add tests for UnmapViewOfFile with unaligned pointer.
Alexandre Julliard
julliard at winehq.org
Tue Jul 19 10:34:22 CDT 2016
Module: wine
Branch: master
Commit: 38d49350072419fa38a5f376fe00ba5dcb9a6f5d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=38d49350072419fa38a5f376fe00ba5dcb9a6f5d
Author: Michael Müller <michael at fds-team.de>
Date: Tue Jul 19 12:59:24 2016 +0200
kernel32/tests: Add tests for UnmapViewOfFile with unaligned pointer.
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/virtual.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 37206b5..75d772b 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,30 @@ 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 != NULL, "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() );
+
+ ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 12288 );
+ 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 );
+
+ 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 );
+
+ CloseHandle(mapping);
CloseHandle(file);
DeleteFileA(testfile);
}
More information about the wine-cvs
mailing list