Rebase against 24b9203d3544001dd51894f1c1edd99819367198.

This commit is contained in:
Alistair Leslie-Hughes 2021-01-28 09:08:29 +11:00
parent bcf5899a3c
commit 9692b2e5eb
10 changed files with 68 additions and 280 deletions

View File

@ -1,4 +1,4 @@
From af7dc115ada8acf19aebedfc091e048b919c2478 Mon Sep 17 00:00:00 2001
From 3a159edee2db7634475ee665e3ab0cf56c5425f6 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 18:51:40 -0500
Subject: [PATCH] server: Add an object operation to grab the esync file
@ -110,10 +110,10 @@ index 0bad4d7a260..176cf1b817e 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/console.c b/server/console.c
index 295db7767b2..a67f1918a3a 100644
index d1f948b23a6..cc534e8c9c1 100644
--- a/server/console.c
+++ b/server/console.c
@@ -82,6 +82,7 @@ static const struct object_ops console_ops =
@@ -81,6 +81,7 @@ static const struct object_ops console_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
console_signaled, /* signaled */
@ -121,7 +121,7 @@ index 295db7767b2..a67f1918a3a 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
console_get_fd, /* get_fd */
@@ -157,6 +158,7 @@ static const struct object_ops console_server_ops =
@@ -156,6 +157,7 @@ static const struct object_ops console_server_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
console_server_signaled, /* signaled */
@ -129,7 +129,7 @@ index 295db7767b2..a67f1918a3a 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
console_server_get_fd, /* get_fd */
@@ -225,6 +227,7 @@ static const struct object_ops screen_buffer_ops =
@@ -224,6 +226,7 @@ static const struct object_ops screen_buffer_ops =
screen_buffer_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -137,7 +137,7 @@ index 295db7767b2..a67f1918a3a 100644
NULL, /* satisfied */
no_signal, /* signal */
screen_buffer_get_fd, /* get_fd */
@@ -274,6 +277,7 @@ static const struct object_ops console_device_ops =
@@ -273,6 +276,7 @@ static const struct object_ops console_device_ops =
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -145,7 +145,7 @@ index 295db7767b2..a67f1918a3a 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -311,6 +315,7 @@ static const struct object_ops console_input_ops =
@@ -310,6 +314,7 @@ static const struct object_ops console_input_ops =
console_input_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -153,7 +153,7 @@ index 295db7767b2..a67f1918a3a 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
console_input_get_fd, /* get_fd */
@@ -367,6 +372,7 @@ static const struct object_ops console_output_ops =
@@ -366,6 +371,7 @@ static const struct object_ops console_output_ops =
console_output_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -161,7 +161,7 @@ index 295db7767b2..a67f1918a3a 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
console_output_get_fd, /* get_fd */
@@ -424,6 +430,7 @@ static const struct object_ops console_connection_ops =
@@ -423,6 +429,7 @@ static const struct object_ops console_connection_ops =
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -170,7 +170,7 @@ index 295db7767b2..a67f1918a3a 100644
no_signal, /* signal */
console_connection_get_fd, /* get_fd */
diff --git a/server/debugger.c b/server/debugger.c
index e4a6c1e43a8..c37f97aa0b6 100644
index 9531a4b6909..7eb7847a9da 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -73,6 +73,7 @@ static const struct object_ops debug_event_ops =
@ -181,10 +181,10 @@ index e4a6c1e43a8..c37f97aa0b6 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -101,6 +102,7 @@ static const struct object_ops debug_ctx_ops =
@@ -103,6 +104,7 @@ static const struct object_ops debug_obj_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
debug_ctx_signaled, /* signaled */
debug_obj_signaled, /* signaled */
+ NULL, /* get_esync_fd */
no_satisfied, /* satisfied */
no_signal, /* signal */
@ -226,7 +226,7 @@ index 652da83e1e2..cc9aa2358a4 100644
no_signal, /* signal */
device_file_get_fd, /* get_fd */
diff --git a/server/directory.c b/server/directory.c
index 81d02d6f64e..1ffa35f0cc8 100644
index ca9f978ff7f..2d25667106e 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -57,6 +57,7 @@ static const struct object_ops object_type_ops =
@ -278,7 +278,7 @@ index cba9472aa3d..06655fc7dd6 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/fd.c b/server/fd.c
index c3c53489212..d3b1e515b52 100644
index 673055718f8..5b76e3a876e 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -216,6 +216,7 @@ static const struct object_ops fd_ops =
@ -314,10 +314,10 @@ index c3c53489212..d3b1e515b52 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/file.c b/server/file.c
index 2cc4a9d978c..5c28b1c176d 100644
index d7e1af5841a..308d19cec31 100644
--- a/server/file.c
+++ b/server/file.c
@@ -86,6 +86,7 @@ static const struct object_ops file_ops =
@@ -85,6 +85,7 @@ static const struct object_ops file_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -386,7 +386,7 @@ index 5d26c606080..2e09bab22fa 100644
no_signal, /* signal */
mailslot_device_file_get_fd, /* get_fd */
diff --git a/server/mapping.c b/server/mapping.c
index 6c2e7a1fd2b..d06ceaa1a66 100644
index 9c51aa3bec7..70395b804b0 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -68,6 +68,7 @@ static const struct object_ops ranges_ops =
@ -483,7 +483,7 @@ index 73058fd3f99..02878ef0e0e 100644
void (*satisfied)(struct object *,struct wait_queue_entry *);
/* signal an object */
diff --git a/server/process.c b/server/process.c
index 5b3e29e5dfd..a7db8332702 100644
index 3dabe0e6cfa..a8b11686315 100644
--- a/server/process.c
+++ b/server/process.c
@@ -78,6 +78,7 @@ static const struct object_ops process_ops =
@ -531,10 +531,10 @@ index a552fed57bb..263bb46ea00 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/registry.c b/server/registry.c
index c937e051597..8110bbb340c 100644
index 64aec1d83c9..49a3c679207 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -160,6 +160,7 @@ static const struct object_ops key_ops =
@@ -161,6 +161,7 @@ static const struct object_ops key_ops =
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -591,7 +591,7 @@ index 7c2bf2cc154..b6d6dcfc4b6 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/sock.c b/server/sock.c
index 1ff56f7bbe5..57dd5a7c6d7 100644
index 8c146a0a8f8..57d994ee332 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -188,6 +188,7 @@ static const struct object_ops sock_ops =
@ -602,7 +602,7 @@ index 1ff56f7bbe5..57dd5a7c6d7 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
sock_get_fd, /* get_fd */
@@ -1527,6 +1528,7 @@ static const struct object_ops ifchange_ops =
@@ -1533,6 +1534,7 @@ static const struct object_ops ifchange_ops =
add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -610,7 +610,7 @@ index 1ff56f7bbe5..57dd5a7c6d7 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
ifchange_get_fd, /* get_fd */
@@ -1748,6 +1750,7 @@ static const struct object_ops socket_device_ops =
@@ -1754,6 +1756,7 @@ static const struct object_ops socket_device_ops =
no_add_queue, /* add_queue */
NULL, /* remove_queue */
NULL, /* signaled */
@ -631,7 +631,7 @@ index 0b85350e1a5..c7212618cac 100644
no_signal, /* signal */
no_get_fd, /* get_fd */
diff --git a/server/thread.c b/server/thread.c
index 0a0d957384b..c10f1710542 100644
index f493b7b2aa8..29a692361f8 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -110,6 +110,7 @@ static const struct object_ops thread_apc_ops =

View File

@ -1,4 +1,4 @@
From 3d3cd983add6183a0e38c427d15895c331a2b666 Mon Sep 17 00:00:00 2001
From 882fe7c0815814c912722d663c981c411e7314f5 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 22:04:29 -0500
Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
@ -9,7 +9,7 @@ Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/server/thread.c b/server/thread.c
index 785203b7fa6..b52a1f5048c 100644
index 2d2a80a61ef..c52057d1f50 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -172,6 +172,7 @@ static const struct object_ops context_ops =
@ -34,7 +34,7 @@ index 785203b7fa6..b52a1f5048c 100644
thread->teb = 0;
thread->entry_point = 0;
+ thread->esync_fd = -1;
thread->debug_ctx = NULL;
thread->debug_obj = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -361,6 +363,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@ -72,7 +72,7 @@ index 785203b7fa6..b52a1f5048c 100644
{
if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | THREAD_QUERY_INFORMATION | THREAD_GET_CONTEXT;
diff --git a/server/thread.h b/server/thread.h
index 78ca4c201b2..faffe13d795 100644
index 4a8c5b1cb2c..e6a9f987c9e 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -54,6 +54,7 @@ struct thread
@ -80,9 +80,9 @@ index 78ca4c201b2..faffe13d795 100644
thread_id_t id; /* thread id */
struct list mutex_list; /* list of currently owned mutexes */
+ int esync_fd; /* esync file descriptor (signalled on exit) */
struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */
struct debug_obj *debug_obj; /* debugger context if this thread is a debugger */
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--
2.28.0
2.29.2

View File

@ -1,4 +1,4 @@
From b04ab24c90337271146425edc2059328e42743b6 Mon Sep 17 00:00:00 2001
From 607d2418e9997885192791cb54a9cdfdaf77eee1 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 17:17:31 -0500
Subject: [PATCH] ntdll, server: Implement alertable waits.
@ -164,7 +164,7 @@ index d1a282c65e9..2a7c3865617 100644
/* We need to let the server know when we are doing a message wait, and when we
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 23731f0fdc6..b2020b6311a 100644
index 1d6ba95d2a1..9c8e334aba6 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -50,6 +50,7 @@ struct ntdll_thread_data
@ -176,10 +176,10 @@ index 23731f0fdc6..b2020b6311a 100644
int reply_fd; /* fd for receiving server replies */
int wait_fd[2]; /* fd for sleeping server requests */
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 785583a340a..93646bc51f4 100644
index c1e79a210f4..5631414bf4c 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -2552,6 +2552,7 @@ static void init_teb( TEB *teb, PEB *peb )
@@ -2565,6 +2565,7 @@ static void init_teb( TEB *teb, PEB *peb )
InitializeListHead( &teb->ActivationContextStack.FrameListCache );
teb->StaticUnicodeString.Buffer = teb->StaticUnicodeBuffer;
teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer);
@ -244,10 +244,10 @@ index aeb58c5469c..cea025d9308 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index 30296aedde8..d2772aacec2 100644
index e60d6f7e8dd..34eaff6207c 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3707,3 +3707,7 @@ enum esync_type
@@ -3718,3 +3718,7 @@ enum esync_type
@REQ(esync_msgwait)
int in_msgwait; /* are we in a message wait? */
@END
@ -256,7 +256,7 @@ index 30296aedde8..d2772aacec2 100644
+@REQ(get_esync_apc_fd)
+@END
diff --git a/server/thread.c b/server/thread.c
index b52a1f5048c..6fb8684f5e0 100644
index c52057d1f50..0b905e6a155 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -227,6 +227,7 @@ static inline void init_thread_structure( struct thread *thread )
@ -264,7 +264,7 @@ index b52a1f5048c..6fb8684f5e0 100644
thread->entry_point = 0;
thread->esync_fd = -1;
+ thread->esync_apc_fd = -1;
thread->debug_ctx = NULL;
thread->debug_obj = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -364,7 +365,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@ -304,7 +304,7 @@ index b52a1f5048c..6fb8684f5e0 100644
}
diff --git a/server/thread.h b/server/thread.h
index faffe13d795..0f6108b684a 100644
index e6a9f987c9e..ff86da99798 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@ -312,7 +312,7 @@ index faffe13d795..0f6108b684a 100644
struct list mutex_list; /* list of currently owned mutexes */
int esync_fd; /* esync file descriptor (signalled on exit) */
+ int esync_apc_fd; /* esync apc fd (signalled when APCs are present) */
struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */
struct debug_obj *debug_obj; /* debugger context if this thread is a debugger */
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--

View File

@ -1,4 +1,4 @@
From be9f0261d9afa05ea32eac251decf42bf5a83b6c Mon Sep 17 00:00:00 2001
From f1f8f1d85868f75ac182252335de1cd84cb4ba16 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 9 Jan 2020 13:44:01 -0600
Subject: [PATCH] ntdll/tests: Move some tests to a new sync.c file.
@ -23,7 +23,7 @@ index ed15c51339f..9a99c01bd7c 100644
time.c \
virtual.c
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index f739996c58c..d088a6ee64b 100644
index 266ec0d63eb..201fb92cc97 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -28,10 +28,6 @@
@ -46,7 +46,7 @@ index f739996c58c..d088a6ee64b 100644
static NTSTATUS (WINAPI *pNtCreateSemaphore)( PHANDLE, ACCESS_MASK,const POBJECT_ATTRIBUTES,LONG,LONG );
static NTSTATUS (WINAPI *pNtOpenSemaphore)( PHANDLE, ACCESS_MASK, const POBJECT_ATTRIBUTES );
static NTSTATUS (WINAPI *pNtQuerySemaphore)( PHANDLE, SEMAPHORE_INFORMATION_CLASS, PVOID, ULONG, PULONG );
@@ -65,22 +59,12 @@ static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE,OBJECT_INFORMATION_CLASS,PVOID,U
@@ -65,23 +59,13 @@ static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE,OBJECT_INFORMATION_CLASS,PVOID,U
static NTSTATUS (WINAPI *pNtReleaseSemaphore)(HANDLE, ULONG, PULONG);
static NTSTATUS (WINAPI *pNtCreateKeyedEvent)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, ULONG );
static NTSTATUS (WINAPI *pNtOpenKeyedEvent)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES * );
@ -60,6 +60,7 @@ index f739996c58c..d088a6ee64b 100644
-static void (WINAPI *pRtlWakeAddressAll)( const void * );
-static void (WINAPI *pRtlWakeAddressSingle)( const void * );
static NTSTATUS (WINAPI *pNtOpenProcess)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, const CLIENT_ID * );
static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *, ULONG );
static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
-#define KEYEDEVENT_WAIT 0x0001
@ -69,7 +70,7 @@ index f739996c58c..d088a6ee64b 100644
#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
static LPCSTR wine_dbgstr_us( const UNICODE_STRING *us )
@@ -1697,286 +1681,6 @@ static void test_type_mismatch(void)
@@ -1710,286 +1694,6 @@ static void test_type_mismatch(void)
pNtClose( h );
}
@ -356,7 +357,7 @@ index f739996c58c..d088a6ee64b 100644
static void test_null_device(void)
{
OBJECT_ATTRIBUTES attr;
@@ -2050,119 +1754,6 @@ static void test_null_device(void)
@@ -2063,119 +1767,6 @@ static void test_null_device(void)
CloseHandle(ov.hEvent);
}
@ -476,7 +477,7 @@ index f739996c58c..d088a6ee64b 100644
static void test_semaphore(void)
{
SEMAPHORE_BASIC_INFORMATION info;
@@ -2239,79 +1830,6 @@ static void test_semaphore(void)
@@ -2252,79 +1843,6 @@ static void test_semaphore(void)
NtClose( semaphore );
}
@ -556,7 +557,7 @@ index f739996c58c..d088a6ee64b 100644
static void test_process(void)
{
OBJECT_ATTRIBUTES attr;
@@ -2375,13 +1893,7 @@ START_TEST(om)
@@ -2388,13 +1906,7 @@ START_TEST(om)
pNtCreateMailslotFile = (void *)GetProcAddress(hntdll, "NtCreateMailslotFile");
pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
pNtOpenEvent = (void *)GetProcAddress(hntdll, "NtOpenEvent");
@ -570,7 +571,7 @@ index f739996c58c..d088a6ee64b 100644
pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
@@ -2402,15 +1914,9 @@ START_TEST(om)
@@ -2415,15 +1927,9 @@ START_TEST(om)
pNtReleaseSemaphore = (void *)GetProcAddress(hntdll, "NtReleaseSemaphore");
pNtCreateKeyedEvent = (void *)GetProcAddress(hntdll, "NtCreateKeyedEvent");
pNtOpenKeyedEvent = (void *)GetProcAddress(hntdll, "NtOpenKeyedEvent");
@ -584,9 +585,9 @@ index f739996c58c..d088a6ee64b 100644
- pRtlWakeAddressAll = (void *)GetProcAddress(hntdll, "RtlWakeAddressAll");
- pRtlWakeAddressSingle = (void *)GetProcAddress(hntdll, "RtlWakeAddressSingle");
pNtOpenProcess = (void *)GetProcAddress(hntdll, "NtOpenProcess");
pNtCreateDebugObject = (void *)GetProcAddress(hntdll, "NtCreateDebugObject");
pNtQuerySystemInformation = (void *)GetProcAddress(hntdll, "NtQuerySystemInformation");
@@ -2423,11 +1929,7 @@ START_TEST(om)
@@ -2437,11 +1943,7 @@ START_TEST(om)
test_query_object();
test_query_object_types();
test_type_mismatch();

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "c1824d578ac514d29e79a5a00d6759f11dbe4813"
echo "24b9203d3544001dd51894f1c1edd99819367198"
}
# Show version information
@ -218,7 +218,6 @@ patch_enable_all ()
enable_server_Object_Types="$1"
enable_server_PeekMessage="$1"
enable_server_Realtime_Priority="$1"
enable_server_Registry_Notifications="$1"
enable_server_Signal_Thread="$1"
enable_server_Stored_ACLs="$1"
enable_server_unix_name="$1"
@ -742,9 +741,6 @@ patch_enable ()
server-Realtime_Priority)
enable_server_Realtime_Priority="$2"
;;
server-Registry_Notifications)
enable_server_Registry_Notifications="$2"
;;
server-Signal_Thread)
enable_server_Signal_Thread="$2"
;;
@ -3837,16 +3833,6 @@ if test "$enable_server_Key_State" -eq 1; then
patch_apply server-Key_State/0002-server-Implement-locking-and-synchronization-of-keys.patch
fi
# Patchset server-Registry_Notifications
# |
# | Modified files:
# | * dlls/ntdll/tests/reg.c, server/registry.c
# |
if test "$enable_server_Registry_Notifications" -eq 1; then
patch_apply server-Registry_Notifications/0001-server-Allow-multiple-registry-notifications-for-the.patch
patch_apply server-Registry_Notifications/0002-server-Introduce-refcounting-for-registry-notificati.patch
fi
# Patchset server-unix_name
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,4 +1,4 @@
From f68291cd2574c19f60ecf90bd1ab48554c579f86 Mon Sep 17 00:00:00 2001
From ad4729eeb457b1957ba925928932f85d79e5534e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 19:39:29 +0100
Subject: [PATCH] ntdll: Mimic object type behavior for different windows
@ -11,18 +11,18 @@ Subject: [PATCH] ntdll: Mimic object type behavior for different windows
3 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 5f272f16cc5..cebac8b36c0 100644
index dea669f1186..266ec0d63eb 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -74,6 +74,7 @@ static NTSTATUS (WINAPI *pRtlWaitOnAddress)( const void *, const void *, SIZE_T,
static void (WINAPI *pRtlWakeAddressAll)( const void * );
@@ -76,6 +76,7 @@ static void (WINAPI *pRtlWakeAddressAll)( const void * );
static void (WINAPI *pRtlWakeAddressSingle)( const void * );
static NTSTATUS (WINAPI *pNtOpenProcess)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, const CLIENT_ID * );
static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *, ULONG );
+static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
#define KEYEDEVENT_WAIT 0x0001
#define KEYEDEVENT_WAKE 0x0002
@@ -1571,13 +1572,31 @@ static void test_query_object(void)
@@ -1585,13 +1586,31 @@ static void test_query_object(void)
pNtClose(handle);
}
@ -55,7 +55,7 @@ index 5f272f16cc5..cebac8b36c0 100644
buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(OBJECT_TYPES_INFORMATION) );
ok( buffer != NULL, "Failed to allocate memory\n" );
@@ -1605,11 +1624,54 @@ static void test_query_object_types(void)
@@ -1619,11 +1638,54 @@ static void test_query_object_types(void)
ok( type->TypeName.Length == sizeof(typeW) && !strncmpW(typeW, type->TypeName.Buffer, 4),
"Expected 'Type' as first type, got %s\n", wine_dbgstr_us(&type->TypeName) );
}
@ -110,19 +110,19 @@ index 5f272f16cc5..cebac8b36c0 100644
}
static void test_type_mismatch(void)
@@ -2252,6 +2314,7 @@ START_TEST(om)
pRtlWakeAddressAll = (void *)GetProcAddress(hntdll, "RtlWakeAddressAll");
@@ -2364,6 +2426,7 @@ START_TEST(om)
pRtlWakeAddressSingle = (void *)GetProcAddress(hntdll, "RtlWakeAddressSingle");
pNtOpenProcess = (void *)GetProcAddress(hntdll, "NtOpenProcess");
pNtCreateDebugObject = (void *)GetProcAddress(hntdll, "NtCreateDebugObject");
+ pNtQuerySystemInformation = (void *)GetProcAddress(hntdll, "NtQuerySystemInformation");
test_case_sensitive();
test_namespace_pipe();
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index ab46eace617..881975e590a 100644
index c237a4550e3..98b2be9776e 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -7600,7 +7600,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
@@ -7542,7 +7542,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
}
if (status == STATUS_SUCCESS)
{
@ -135,10 +135,10 @@ index ab46eace617..881975e590a 100644
}
}
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 92c46fd7d38..fbdc1d87ddf 100644
index 5eb1bbf9203..21a7abd30a5 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2035,6 +2035,18 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi )
@@ -2055,6 +2055,18 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi )
mutex_unlock( &tz_mutex );
}
@ -157,7 +157,7 @@ index 92c46fd7d38..fbdc1d87ddf 100644
/******************************************************************************
* NtQuerySystemInformation (NTDLL.@)
@@ -2426,7 +2438,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2446,7 +2458,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].OwnerPid = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].AccessMask = handle_info[i].access;
@ -166,7 +166,7 @@ index 92c46fd7d38..fbdc1d87ddf 100644
/* FIXME: Fill out HandleFlags, ObjectPointer */
}
}
@@ -2479,7 +2491,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2499,7 +2511,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].UniqueProcessId = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].GrantedAccess = handle_info[i].access;
@ -175,7 +175,7 @@ index 92c46fd7d38..fbdc1d87ddf 100644
/* FIXME: Fill out remaining fields */
}
}
@@ -2743,7 +2755,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
@@ -2741,7 +2753,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
return ret;
}

View File

@ -1,137 +0,0 @@
From 65522961f3a0cc382bf2effc445228815ee06e58 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 13 Nov 2015 22:39:00 +0100
Subject: server: Allow multiple registry notifications for the same key.
---
dlls/ntdll/tests/reg.c | 6 ++---
server/registry.c | 53 ++++++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index 9bb8d2502..1ba688084 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -1874,7 +1874,7 @@ static void test_notify(void)
pRtlFreeUnicodeString(&str);
status = pNtWaitForSingleObject(events[0], FALSE, &timeout);
- todo_wine ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
status = pNtWaitForSingleObject(events[1], FALSE, &timeout);
ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
@@ -1887,7 +1887,7 @@ static void test_notify(void)
ok(status == STATUS_SUCCESS, "NtDeleteSubkey failed: %x\n", status);
status = pNtWaitForSingleObject(events[0], FALSE, &timeout);
- todo_wine ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
status = pNtWaitForSingleObject(events[1], FALSE, &timeout);
ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
@@ -1901,7 +1901,7 @@ static void test_notify(void)
pNtClose(key);
status = pNtWaitForSingleObject(events[0], FALSE, &timeout);
- todo_wine ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
status = pNtWaitForSingleObject(events[1], FALSE, &timeout);
ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
diff --git a/server/registry.c b/server/registry.c
index 964e2ebd5..41af3cbe7 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -49,10 +49,16 @@
#include "winternl.h"
+struct notify_event
+{
+ struct list entry; /* entry in list of events */
+ struct event *event; /* event to set */
+};
+
struct notify
{
struct list entry; /* entry in list of notifications */
- struct event *event; /* event to set when changing this key */
+ struct list events; /* list of events to set when changing this key */
int subtree; /* true if subtree notification */
unsigned int filter; /* which events to notify on */
obj_handle_t hkey; /* hkey associated with this notification */
@@ -313,12 +319,17 @@ static struct object_type *key_get_type( struct object *obj )
/* notify waiter and maybe delete the notification */
static void do_notification( struct key *key, struct notify *notify, int del )
{
- if (notify->event)
+ void *ptr;
+
+ while ((ptr = list_head( &notify->events )))
{
- set_event( notify->event );
- release_object( notify->event );
- notify->event = NULL;
+ struct notify_event *notify_event = LIST_ENTRY( ptr, struct notify_event, entry );
+ list_remove( &notify_event->entry );
+ set_event( notify_event->event );
+ release_object( notify_event->event );
+ free( notify_event );
}
+
if (del)
{
list_remove( &notify->entry );
@@ -2277,6 +2288,7 @@ DECL_HANDLER(set_registry_notification)
struct key *key;
struct event *event;
struct notify *notify;
+ struct notify_event *notify_event;
key = get_hkey_obj( req->hkey, KEY_NOTIFY );
if (key)
@@ -2285,29 +2297,20 @@ DECL_HANDLER(set_registry_notification)
if (event)
{
notify = find_notify( key, current->process, req->hkey );
- if (notify)
- {
- if (notify->event)
- release_object( notify->event );
- grab_object( event );
- notify->event = event;
- }
- else
+ if (!notify && (notify = mem_alloc( sizeof(*notify) )))
{
- notify = mem_alloc( sizeof(*notify) );
- if (notify)
- {
- grab_object( event );
- notify->event = event;
- notify->subtree = req->subtree;
- notify->filter = req->filter;
- notify->hkey = req->hkey;
- notify->process = current->process;
- list_add_head( &key->notify_list, &notify->entry );
- }
+ list_init( &notify->events );
+ notify->subtree = req->subtree;
+ notify->filter = req->filter;
+ notify->hkey = req->hkey;
+ notify->process = current->process;
+ list_add_head( &key->notify_list, &notify->entry );
}
- if (notify)
+ if (notify && (notify_event = mem_alloc( sizeof(*notify_event) )))
{
+ grab_object(event);
+ notify_event->event = event;
+ list_add_tail( &notify->events, &notify_event->entry );
reset_event( event );
set_error( STATUS_PENDING );
}
--
2.23.0

View File

@ -1,61 +0,0 @@
From aedc8d40763b059b996bdfc95d4974ac2f793b63 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 13 Nov 2015 23:30:27 +0100
Subject: server: Introduce refcounting for registry notifications.
---
server/registry.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/server/registry.c b/server/registry.c
index ead9749..5c70b8d 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -58,6 +58,7 @@ struct notify_event
struct notify
{
+ unsigned int refcount; /* number of references */
struct list entry; /* entry in list of notifications */
struct list events; /* list of events to set when changing this key */
int subtree; /* true if subtree notification */
@@ -311,6 +312,14 @@ static void do_notification( struct key *key, struct notify *notify, int del )
{
void *ptr;
+ if (del)
+ list_remove( &notify->entry );
+ else
+ {
+ assert( notify->refcount < INT_MAX );
+ notify->refcount++;
+ }
+
while ((ptr = list_head( &notify->events )))
{
struct notify_event *notify_event = LIST_ENTRY( ptr, struct notify_event, entry );
@@ -320,11 +329,9 @@ static void do_notification( struct key *key, struct notify *notify, int del )
free( notify_event );
}
- if (del)
- {
- list_remove( &notify->entry );
+ assert( notify->refcount );
+ if (!--notify->refcount)
free( notify );
- }
}
static inline struct notify *find_notify( struct key *key, struct process *process, obj_handle_t hkey )
@@ -2282,6 +2289,7 @@ DECL_HANDLER(set_registry_notification)
notify = find_notify( key, current->process, req->hkey );
if (!notify && (notify = mem_alloc( sizeof(*notify) )))
{
+ notify->refcount = 1;
list_init( &notify->events );
notify->subtree = req->subtree;
notify->filter = req->filter;
--
2.6.2

View File

@ -1 +0,0 @@
Fixes: Properly handle multiple registry notifications per key

View File

@ -1 +1 @@
c1824d578ac514d29e79a5a00d6759f11dbe4813
24b9203d3544001dd51894f1c1edd99819367198