diff --git a/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch b/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch index 2c623364..5161fde5 100644 --- a/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch +++ b/patches/ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch @@ -1,18 +1,44 @@ -From 36c5307ddaea9ee5f0b1709ed14f3ec4b580acae Mon Sep 17 00:00:00 2001 +From 8f87412b097475e203ad9aa5289f35905c4a8327 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 10 Feb 2015 06:36:52 +0100 Subject: ntdll: Avoid race-conditions with write watches in NtReadFile. Rebased against kernel32-NamedPipe patchset by Sebastian Lackner . --- - dlls/ntdll/file.c | 5 +++++ - 1 file changed, 5 insertions(+) + dlls/kernel32/tests/virtual.c | 8 ++++---- + dlls/ntdll/file.c | 5 +++++ + 2 files changed, 9 insertions(+), 4 deletions(-) +diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c +index e80ba38..29740b5 100644 +--- a/dlls/kernel32/tests/virtual.c ++++ b/dlls/kernel32/tests/virtual.c +@@ -1637,16 +1637,16 @@ static void test_write_watch(void) + + num_bytes = 0; + success = GetOverlappedResult( readpipe, &overlapped, &num_bytes, TRUE ); +- todo_wine ok( success, "GetOverlappedResult failed %u\n", GetLastError() ); +- todo_wine ok( num_bytes == sizeof(testdata), "wrong number of bytes read\n" ); +- todo_wine ok( !memcmp( base, testdata, sizeof(testdata)), "didn't receive expected data\n" ); ++ ok( success, "GetOverlappedResult failed %u\n", GetLastError() ); ++ ok( num_bytes == sizeof(testdata), "wrong number of bytes read\n" ); ++ ok( !memcmp( base, testdata, sizeof(testdata)), "didn't receive expected data\n" ); + + count = 64; + memset( results, 0, sizeof(results) ); + ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + todo_wine ok( count == 1, "wrong count %lu\n", count ); +- todo_wine ok( results[0] == base, "wrong result %p\n", results[0] ); ++ ok( results[0] == base, "wrong result %p\n", results[0] ); + + CloseHandle( readpipe ); + CloseHandle( writepipe ); diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index e564bdd..10e17d8 100644 +index 15500b9..1f35a55 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -541,6 +541,8 @@ static NTSTATUS read_unix_fd(int fd, char *buf, ULONG *total, ULONG length, +@@ -627,6 +627,8 @@ static NTSTATUS read_unix_fd(int fd, char *buf, ULONG *total, ULONG length, else return STATUS_PENDING; } @@ -21,7 +47,7 @@ index e564bdd..10e17d8 100644 else if (errno != EINTR) return FILE_GetNtStatus(); } -@@ -780,6 +782,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, +@@ -968,6 +970,9 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, /* async I/O doesn't make sense on regular files */ while ((result = pread( unix_handle, buffer, length, offset->QuadPart )) == -1) { @@ -32,5 +58,5 @@ index e564bdd..10e17d8 100644 { status = FILE_GetNtStatus(); -- -2.2.2 +2.6.1 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 15785b88..e190c125 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4408,7 +4408,7 @@ fi # | * rpcrt4-Pipe_Transport, kernel32-Named_Pipe, ntdll-Virtual_Memory_Stack, ws2_32-WriteWatches # | # | Modified files: -# | * dlls/ntdll/file.c +# | * dlls/kernel32/tests/virtual.c, dlls/ntdll/file.c # | if test "$enable_ntdll_WriteWatches" -eq 1; then patch_apply ntdll-WriteWatches/0001-ntdll-Avoid-race-conditions-with-write-watches-in-Nt.patch