Rebase against 6a966678e89c0c2090b7684a1c2ebfb0a295b9a8.

This commit is contained in:
Elizabeth Figura
2025-11-17 16:36:15 -06:00
parent 0229597809
commit 4741f1abc6
3 changed files with 14 additions and 131 deletions

View File

@@ -1,117 +0,0 @@
From 51373e0350ff1b507d7b47d6e5acd84b8af9d328 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
Date: Sat, 6 Feb 2021 12:46:30 -0700
Subject: [PATCH] kernelbase: Add support for moving reparse points with
MoveFile*.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/kernelbase/file.c | 2 +-
dlls/ntdll/unix/file.c | 24 ++++++++++++++++++++++--
server/fd.c | 6 ++++--
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 36045116e43..f1b1326353f 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -2597,7 +2597,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH MoveFileWithProgressW( const WCHAR *source, const
InitializeObjectAttributes( &attr, &nt_name, OBJ_CASE_INSENSITIVE, 0, NULL );
status = NtOpenFile( &source_handle, DELETE | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- FILE_SYNCHRONOUS_IO_NONALERT );
+ FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_REPARSE_POINT );
RtlFreeUnicodeString( &nt_name );
if (!set_ntstatus( status )) goto error;
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 3c341a6d702..9076da9f763 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5572,6 +5572,8 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
unsigned int flags;
UNICODE_STRING name_str, nt_name;
OBJECT_ATTRIBUTES attr;
+ REPARSE_DATA_BUFFER *buffer = NULL;
+ ULONG buffer_len = 0;
char *unix_name;
if (class == FileRenameInformation)
@@ -5586,6 +5588,20 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
name_str.Length = info->FileNameLength;
name_str.MaximumLength = info->FileNameLength + sizeof(WCHAR);
InitializeObjectAttributes( &attr, &name_str, OBJ_CASE_INSENSITIVE, info->RootDirectory, NULL );
+
+ /* obtain all the data from the reparse point (if applicable) */
+ status = get_reparse_point( handle, NULL, &buffer_len );
+ if (status == STATUS_BUFFER_TOO_SMALL)
+ {
+ buffer = malloc( buffer_len );
+ status = get_reparse_point( handle, buffer, &buffer_len );
+ if (status != STATUS_SUCCESS)
+ {
+ free( buffer );
+ break;
+ }
+ }
+
status = get_nt_and_unix_names( &attr, &nt_name, &unix_name, FILE_OPEN_IF );
if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE)
{
@@ -5602,8 +5618,13 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
}
SERVER_END_REQ;
+ /* rebuild reparse point in new location (if applicable) */
+ if (buffer && status == STATUS_SUCCESS)
+ status = create_reparse_point( handle, buffer );
+
+ free( unix_name );
}
- free( unix_name );
+ free( buffer );
free( nt_name.Buffer );
}
else status = STATUS_INVALID_PARAMETER_3;
@@ -5646,7 +5667,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
status = wine_server_call( req );
}
SERVER_END_REQ;
-
}
free( unix_name );
free( nt_name.Buffer );
diff --git a/server/fd.c b/server/fd.c
index 466259ae567..7f88fcd6e33 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2771,7 +2771,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
goto failed;
}
- if (!stat( name, &st ))
+ if (!lstat( name, &st ))
{
if (!fstat( fd->unix_fd, &st2 ) && st.st_ino == st2.st_ino && st.st_dev == st2.st_dev)
{
@@ -2787,7 +2787,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
}
/* can't replace directories or special files */
- if (!S_ISREG( st.st_mode ))
+ if (!S_ISREG( st.st_mode ) && !S_ISLNK( st.st_mode ))
{
set_error( STATUS_ACCESS_DENIED );
goto failed;
@@ -2853,6 +2853,8 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da
fd->nt_name = dup_nt_name( root, nt_name, &fd->nt_namelen );
free( fd->unix_name );
fd->closed->unix_name = fd->unix_name = realpath( name, NULL );
+ if (!fd->unix_name)
+ fd->closed->unix_name = fd->unix_name = dup_fd_name( root, name ); /* dangling symlink */
free( name );
if (!fd->unix_name)
set_error( STATUS_NO_MEMORY );
--
2.47.2

View File

@@ -1,4 +1,4 @@
From 2f2480806c4c431aeb75308e570a317da43f3508 Mon Sep 17 00:00:00 2001
From 26240eeb2925918d8c75a251fde5fd5ed9f9bfcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com>
Date: Mon, 22 Jul 2019 15:29:25 +0300
Subject: [PATCH] user32/focus: Prevent a recursive loop with the activation
@@ -20,10 +20,10 @@ Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index a4834b740d8..123a0ff9a94 100644
index f431ab98a9f..9e07052d612 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1966,7 +1966,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
@@ -1992,7 +1992,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
{
HWND previous = get_active_window();
BOOL ret;
@@ -32,7 +32,7 @@ index a4834b740d8..123a0ff9a94 100644
CBTACTIVATESTRUCT cbt;
if (previous == hwnd)
@@ -1975,16 +1975,24 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
@@ -2001,16 +2001,24 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
goto done;
}
@@ -48,7 +48,7 @@ index a4834b740d8..123a0ff9a94 100644
{
- send_message( previous, WM_NCACTIVATE, FALSE, (LPARAM)hwnd );
- send_message( previous, WM_ACTIVATE,
- MAKEWPARAM( WA_INACTIVE, is_iconic(previous) ), (LPARAM)hwnd );
- MAKEWPARAM( WA_INACTIVE, is_iconic(previous) ? 0x20 : 0 ), (LPARAM)hwnd );
+ ret = FALSE;
+
+ /* call CBT hook chain */
@@ -57,16 +57,16 @@ index a4834b740d8..123a0ff9a94 100644
+ if (call_hooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hwnd, (LPARAM)&cbt, sizeof(cbt) ))
+ goto clear_flags;
+
+ if (is_window(previous))
+ if (is_window( previous ))
+ {
+ send_message( previous, WM_NCACTIVATE, FALSE, (LPARAM)hwnd );
+ send_message( previous, WM_ACTIVATE,
+ MAKEWPARAM( WA_INACTIVE, is_iconic(previous) ), (LPARAM)hwnd );
+ MAKEWPARAM( WA_INACTIVE, is_iconic(previous) ? 0x20 : 0 ), (LPARAM)hwnd );
+ }
}
SERVER_START_REQ( set_active_window )
@@ -2006,7 +2014,11 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
@@ -2032,7 +2040,11 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 ))
send_message_timeout( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
SMTO_ABORTIFHUNG, 2000, FALSE );
@@ -79,7 +79,7 @@ index a4834b740d8..123a0ff9a94 100644
}
old_thread = previous ? get_window_thread( previous, NULL ) : 0;
@@ -2039,7 +2051,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
@@ -2065,7 +2077,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
}
}
@@ -88,7 +88,7 @@ index a4834b740d8..123a0ff9a94 100644
{
send_message( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous );
send_message( hwnd, WM_ACTIVATE,
@@ -2064,13 +2076,17 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
@@ -2090,13 +2102,17 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new
}
}
@@ -108,10 +108,10 @@ index a4834b740d8..123a0ff9a94 100644
/**********************************************************************
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index 2f3bbdf91c0..74f5b07bd46 100644
index c38b6d0e029..bec513cfadb 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -92,6 +92,7 @@ typedef struct tagWND
@@ -86,6 +86,7 @@ typedef struct tagWND
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
#define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */
#define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */
@@ -120,5 +120,5 @@ index 2f3bbdf91c0..74f5b07bd46 100644
#define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */
#define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */
--
2.47.2
2.51.0

View File

@@ -1 +1 @@
fe1175af410d04f806dda770502d0476a8ccbef6
6a966678e89c0c2090b7684a1c2ebfb0a295b9a8