Piotr Caban : kernel32/tests: Test that copy-on-write file mapping is not modifying the file.

Alexandre Julliard julliard at winehq.org
Wed Feb 13 15:30:41 CST 2019


Module: wine
Branch: master
Commit: 864919a2ea9df830d809e905cc0ad7cd5727fd2e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=864919a2ea9df830d809e905cc0ad7cd5727fd2e

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Feb 13 11:43:20 2019 +0100

kernel32/tests: Test that copy-on-write file mapping is not modifying the file.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/virtual.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 01c698d..78bc17a 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -4236,6 +4236,7 @@ static void test_mappings(void)
 {
     char temp_path[MAX_PATH];
     char file_name[MAX_PATH];
+    DWORD data, num_bytes;
     HANDLE hfile;
 
     GetTempPathA(MAX_PATH, temp_path);
@@ -4248,6 +4249,13 @@ static void test_mappings(void)
 
     test_mapping( hfile, SEC_COMMIT, FALSE );
 
+    /* test that file was not modified */
+    SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
+    ok(ReadFile(hfile, &data, sizeof(data), &num_bytes, NULL), "ReadFile failed\n");
+    ok(num_bytes == sizeof(data), "num_bytes = %d\n", num_bytes);
+    todo_wine
+    ok(!data, "data = %x\n", data);
+
     CloseHandle( hfile );
 
     hfile = CreateFileA(file_name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);




More information about the wine-cvs mailing list