ntdll-User_Shared_Data: Replace with new wineserver-based implementation.

This commit is contained in:
Zebediah Figura
2020-04-30 18:14:40 -05:00
parent 169c49055d
commit 4e6a477acd
16 changed files with 663 additions and 668 deletions

View File

@@ -1,4 +1,4 @@
From 53d03a31463a98450b44f1d99c86195b78044691 Mon Sep 17 00:00:00 2001
From b304bfba257073741c03dbcb719f55d2788c18a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 4 Oct 2014 03:22:09 +0200
Subject: [PATCH] ntdll: Properly handle PAGE_WRITECOPY protection. (try 5)
@@ -9,10 +9,10 @@ For now, only enable it when a special environment variable is set.
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index aa1107f136f..fa39a67b9ca 100644
index 7700385eb7b..aec6c18da87 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -323,6 +323,21 @@ static const char *VIRTUAL_GetProtStr( BYTE prot )
@@ -321,6 +321,21 @@ static const char *VIRTUAL_GetProtStr( BYTE prot )
return buffer;
}
@@ -34,7 +34,7 @@ index aa1107f136f..fa39a67b9ca 100644
/***********************************************************************
* VIRTUAL_GetUnixProt
@@ -336,8 +351,19 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
@@ -334,8 +349,19 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
{
if (vprot & VPROT_READ) prot |= PROT_READ;
if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ;
@@ -55,7 +55,7 @@ index aa1107f136f..fa39a67b9ca 100644
if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE;
}
if (!prot) prot = PROT_NONE;
@@ -1073,7 +1099,7 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size
@@ -1080,7 +1106,7 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size
{
TRACE( "updating watch %p-%p-%p\n", base, (char *)base + accessed_size, (char *)base + size );
/* clear write watch flag on accessed pages */
@@ -64,7 +64,7 @@ index aa1107f136f..fa39a67b9ca 100644
/* restore page protections on the entire range */
mprotect_range( base, size, 0, 0 );
}
@@ -2291,12 +2317,13 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2336,12 +2362,13 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH );
mprotect_range( page, page_size, 0, 0 );
}
@@ -80,9 +80,9 @@ index aa1107f136f..fa39a67b9ca 100644
+ /* ignore fault if page is writable now */
+ if (VIRTUAL_GetUnixProt( get_page_vprot( page )) & PROT_WRITE) ret = STATUS_SUCCESS;
}
else if (!err && page == user_shared_data_external)
{
@@ -2347,11 +2374,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
server_leave_uninterrupted_section( &csVirtual, &sigset );
return ret;
@@ -2363,11 +2390,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat
{
BYTE vprot = get_page_vprot( addr + i );
if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE;
@@ -101,5 +101,5 @@ index aa1107f136f..fa39a67b9ca 100644
}
--
2.25.4
2.26.2

View File

@@ -1,5 +1,4 @@
Fixes: [29384] Multiple applications expect correct handling of WRITECOPY memory protection (Voobly fails to launch Age of Empires II, MSYS2)
Depends: ntdll-User_Shared_Data
# Causes regressions?
# https://bugs.wine-staging.com/show_bug.cgi?id=207