From bcf38efc5bbf628f34950a2f264a7c8d9c6bc3b9 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 29 Mar 2024 19:31:59 +1100 Subject: [PATCH] Rebase against a2c20d0e93290b3f998ad78c7aeaed8028aee2da. --- .../0002-ntdll-Implement-NtFlushKey.patch | 32 +++++++++---------- ...form-periodic-registry-flush-instead.patch | 20 ++++++------ staging/upstream-commit | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/patches/ntdll_reg_flush/0002-ntdll-Implement-NtFlushKey.patch b/patches/ntdll_reg_flush/0002-ntdll-Implement-NtFlushKey.patch index b35660fc..f7c2c50c 100644 --- a/patches/ntdll_reg_flush/0002-ntdll-Implement-NtFlushKey.patch +++ b/patches/ntdll_reg_flush/0002-ntdll-Implement-NtFlushKey.patch @@ -1,7 +1,7 @@ -From 36b85f294e94ff58ba190d7b6606e34d64af1a31 Mon Sep 17 00:00:00 2001 +From e1f8622b3b787ca19ca1cfc149492c517e5833c4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Jun 2023 11:54:06 -0600 -Subject: [PATCH 2/3] ntdll: Implement NtFlushKey(). +Subject: [PATCH] ntdll: Implement NtFlushKey(). --- dlls/ntdll/unix/registry.c | 155 +++++++++++++++++++++++++++++++++++-- @@ -10,7 +10,7 @@ Subject: [PATCH 2/3] ntdll: Implement NtFlushKey(). 3 files changed, 247 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c -index b63c7a66925..14b3ade3e6d 100644 +index 88ad7e569a1..492dd00d67a 100644 --- a/dlls/ntdll/unix/registry.c +++ b/dlls/ntdll/unix/registry.c @@ -29,6 +29,8 @@ @@ -42,7 +42,7 @@ index b63c7a66925..14b3ade3e6d 100644 } -@@ -901,22 +904,162 @@ NTSTATUS WINAPI NtNotifyChangeKey( HANDLE key, HANDLE event, PIO_APC_ROUTINE apc +@@ -916,22 +919,162 @@ NTSTATUS WINAPI NtNotifyChangeKey( HANDLE key, HANDLE event, PIO_APC_ROUTINE apc io, filter, subtree, buffer, length, async ); } @@ -210,10 +210,10 @@ index b63c7a66925..14b3ade3e6d 100644 } diff --git a/server/protocol.def b/server/protocol.def -index 12aa43a43e7..0e62f609459 100644 +index 1117e3b797a..910960285a0 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -1818,6 +1818,18 @@ struct process_info +@@ -1834,6 +1834,18 @@ struct process_info /* Flush a registry key */ @REQ(flush_key) obj_handle_t hkey; /* handle to the key */ @@ -233,7 +233,7 @@ index 12aa43a43e7..0e62f609459 100644 diff --git a/server/registry.c b/server/registry.c -index 3365d4e9a4b..f6d57c579f4 100644 +index ec1ca27be80..6ec1202cf7a 100644 --- a/server/registry.c +++ b/server/registry.c @@ -90,6 +90,7 @@ struct key @@ -290,7 +290,7 @@ index 3365d4e9a4b..f6d57c579f4 100644 } /* go through all the notifications and send them if necessary */ -@@ -2004,6 +2010,7 @@ void init_registry(void) +@@ -1995,6 +2001,7 @@ void init_registry(void) /* save a registry branch to a file */ static void save_all_subkeys( struct key *key, FILE *f ) { @@ -298,16 +298,16 @@ index 3365d4e9a4b..f6d57c579f4 100644 fprintf( f, "WINE REGISTRY Version 2\n" ); fprintf( f, ";; All keys relative to " ); dump_path( key, NULL, f ); -@@ -2192,7 +2199,7 @@ static int save_branch( struct key *key, const char *path ) +@@ -2179,7 +2186,7 @@ static int save_branch( struct key *key, const char *filename ) + } done: - free( tmp ); - if (ret) make_clean( key ); + if (ret) make_clean( key, key->timestamp_counter ); return ret; } -@@ -2240,6 +2247,36 @@ static int is_wow64_thread( struct thread *thread ) +@@ -2227,6 +2234,36 @@ static int is_wow64_thread( struct thread *thread ) return (is_machine_64bit( native_machine ) && !is_machine_64bit( thread->process->machine )); } @@ -344,7 +344,7 @@ index 3365d4e9a4b..f6d57c579f4 100644 /* create a registry key */ DECL_HANDLER(create_key) -@@ -2304,15 +2341,56 @@ DECL_HANDLER(delete_key) +@@ -2291,15 +2328,56 @@ DECL_HANDLER(delete_key) } } @@ -372,7 +372,7 @@ index 3365d4e9a4b..f6d57c579f4 100644 - release_object( key ); + if (!(save_branch_info[branches[i]].key->flags & KEY_DIRTY)) continue; + ++reply->branch_count; -+ path_len = strlen( save_branch_info[branches[i]].path ) + 1; ++ path_len = strlen( save_branch_info[branches[i]].filename ) + 1; + reply->total += sizeof(int) + sizeof(int) + path_len + save_registry( save_branch_info[branches[i]].key, NULL ); + } + if (reply->total > get_reply_max_size()) @@ -388,10 +388,10 @@ index 3365d4e9a4b..f6d57c579f4 100644 + if (!(save_branch_info[branches[i]].key->flags & KEY_DIRTY)) continue; + *(int *)data = branches[i]; + data += sizeof(int); -+ path_len = strlen( save_branch_info[branches[i]].path ) + 1; ++ path_len = strlen( save_branch_info[branches[i]].filename ) + 1; + *(int *)data = path_len; + data += sizeof(int); -+ memcpy( data, save_branch_info[branches[i]].path, path_len ); ++ memcpy( data, save_branch_info[branches[i]].filename, path_len ); + data += path_len; + data += save_registry( save_branch_info[branches[i]].key, data ); + } @@ -406,5 +406,5 @@ index 3365d4e9a4b..f6d57c579f4 100644 /* enumerate registry subkeys */ -- -2.40.1 +2.43.0 diff --git a/patches/ntdll_reg_flush/0003-mountmgr.sys-Perform-periodic-registry-flush-instead.patch b/patches/ntdll_reg_flush/0003-mountmgr.sys-Perform-periodic-registry-flush-instead.patch index c6637d83..c64f6cc7 100644 --- a/patches/ntdll_reg_flush/0003-mountmgr.sys-Perform-periodic-registry-flush-instead.patch +++ b/patches/ntdll_reg_flush/0003-mountmgr.sys-Perform-periodic-registry-flush-instead.patch @@ -1,7 +1,7 @@ -From 093f14e3ce1753ef399681ec2ccdeecb4443c7a1 Mon Sep 17 00:00:00 2001 +From 71559b3e6e2ba78682c3968a9837bf2fa6719830 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Jun 2023 12:17:36 -0600 -Subject: [PATCH 3/3] mountmgr.sys: Perform periodic registry flush instead of +Subject: [PATCH] mountmgr.sys: Perform periodic registry flush instead of server. --- @@ -10,10 +10,10 @@ Subject: [PATCH 3/3] mountmgr.sys: Perform periodic registry flush instead of 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c -index 1850051a258..ee8d282594f 100644 +index 52bc6536693..fecac943b41 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c -@@ -618,6 +618,27 @@ static DWORD WINAPI run_loop_thread( void *arg ) +@@ -616,6 +616,27 @@ static DWORD WINAPI run_loop_thread( void *arg ) return MOUNTMGR_CALL( run_loop, ¶ms ); } @@ -41,7 +41,7 @@ index 1850051a258..ee8d282594f 100644 /* main entry point for the mount point manager driver */ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) -@@ -661,6 +682,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) +@@ -659,6 +680,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) thread = CreateThread( NULL, 0, device_op_thread, NULL, 0, NULL ); CloseHandle( CreateThread( NULL, 0, run_loop_thread, thread, 0, NULL )); @@ -50,7 +50,7 @@ index 1850051a258..ee8d282594f 100644 #ifdef _WIN64 /* create a symlink so that the Wine port overrides key can be edited with 32-bit reg or regedit */ diff --git a/server/registry.c b/server/registry.c -index f6d57c579f4..21566057fa1 100644 +index 6ec1202cf7a..09badf44bcd 100644 --- a/server/registry.c +++ b/server/registry.c @@ -125,15 +125,12 @@ static abstime_t change_timestamp_counter; @@ -69,7 +69,7 @@ index f6d57c579f4..21566057fa1 100644 static struct key_value *find_value( const struct key *key, const struct unicode_str *name, int *index ); /* information about where to save a registry branch */ -@@ -1983,9 +1980,6 @@ void init_registry(void) +@@ -1976,9 +1973,6 @@ void init_registry(void) release_object( hklm ); release_object( hkcu ); @@ -79,7 +79,7 @@ index f6d57c579f4..21566057fa1 100644 /* create windows directories */ if (!mkdir( "drive_c/windows", 0777 )) -@@ -2203,26 +2197,6 @@ done: +@@ -2190,26 +2184,6 @@ done: return ret; } @@ -91,7 +91,7 @@ index f6d57c579f4..21566057fa1 100644 - if (fchdir( config_dir_fd ) == -1) return; - save_timeout_user = NULL; - for (i = 0; i < save_branch_count; i++) -- save_branch( save_branch_info[i].key, save_branch_info[i].path ); +- save_branch( save_branch_info[i].key, save_branch_info[i].filename ); - if (fchdir( server_dir_fd ) == -1) fatal_error( "chdir to server dir: %s\n", strerror( errno )); - set_periodic_save_timer(); -} @@ -107,5 +107,5 @@ index f6d57c579f4..21566057fa1 100644 void flush_registry(void) { -- -2.40.1 +2.43.0 diff --git a/staging/upstream-commit b/staging/upstream-commit index edbb8e7d..d119fdd8 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -e01cb2b9156f808acc279a1b4753a48de0fda327 +a2c20d0e93290b3f998ad78c7aeaed8028aee2da