mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
ntdll-Junction_Points: Use debugstr_a() in two places.
From Aida Jonikienė.
This commit is contained in:
parent
1ba0c55d0d
commit
ec3dd19d45
@ -1,4 +1,4 @@
|
||||
From ed0b9682a8e134eeefa4186b930a92843383b8b1 Mon Sep 17 00:00:00 2001
|
||||
From ef771cfa26c9d15568d0711073145b3cf11c6b5a Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 20:56:49 -0700
|
||||
Subject: [PATCH] ntdll: Add support for creating reparse points.
|
||||
@ -13,10 +13,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
5 files changed, 451 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 475743bc121..c82d6ec371b 100644
|
||||
index 417b1a63a13..88e53b11c05 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -2089,6 +2089,8 @@ AC_CHECK_FUNCS(\
|
||||
@@ -2084,6 +2084,8 @@ AC_CHECK_FUNCS(\
|
||||
prctl \
|
||||
proc_pidinfo \
|
||||
sched_yield \
|
||||
@ -26,7 +26,7 @@ index 475743bc121..c82d6ec371b 100644
|
||||
setprogname \
|
||||
sigprocmask \
|
||||
diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
|
||||
index d3f2a0e5523..74e6da5bb56 100644
|
||||
index b519bcd655f..f71f79b9f5f 100644
|
||||
--- a/dlls/ntdll/Makefile.in
|
||||
+++ b/dlls/ntdll/Makefile.in
|
||||
@@ -4,7 +4,7 @@ UNIXLIB = ntdll.so
|
||||
@ -39,7 +39,7 @@ index d3f2a0e5523..74e6da5bb56 100644
|
||||
EXTRADLLFLAGS = -nodefaultlibs
|
||||
i386_EXTRADLLFLAGS = -Wl,--image-base,0x7bc00000
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index da3611f74f2..5889bebace4 100644
|
||||
index 9dd49c925b7..89d65bf6f46 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -38,6 +38,7 @@
|
||||
@ -50,7 +50,7 @@ index da3611f74f2..5889bebace4 100644
|
||||
|
||||
#ifndef IO_COMPLETION_ALL_ACCESS
|
||||
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
|
||||
@@ -5803,32 +5804,154 @@ static void test_mailslot_name(void)
|
||||
@@ -5854,32 +5855,154 @@ static void test_mailslot_name(void)
|
||||
CloseHandle( device );
|
||||
}
|
||||
|
||||
@ -101,7 +101,9 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ INT buffer_len;
|
||||
+ HANDLE handle;
|
||||
+ BOOL bret;
|
||||
+
|
||||
|
||||
- pRtlInitUnicodeString( &nameW, L"\\??\\C:\\" );
|
||||
- InitializeObjectAttributes( &attr, &nameW, 0, NULL, NULL );
|
||||
+ /* Create a temporary folder for the junction point tests */
|
||||
+ GetTempFileNameW(dotW, fooW, 0, path);
|
||||
+ DeleteFileW(path);
|
||||
@ -110,7 +112,9 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ win_skip("Unable to create a temporary junction point directory.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
||||
- status = pNtOpenFile( &handle, READ_CONTROL, &attr, &io, 0, 0 );
|
||||
- ok( !status, "open %s failed %#lx\n", wine_dbgstr_w(nameW.Buffer), status );
|
||||
+ /* Check that the volume this folder is located on supports junction points */
|
||||
+ pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL);
|
||||
+ volW[0] = nameW.Buffer[4];
|
||||
@ -127,15 +131,17 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ RemoveDirectoryW(path);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, NULL, 0 );
|
||||
- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status );
|
||||
+ /* Create the folder to be replaced by a junction point */
|
||||
+ lstrcpyW(reparse_path, path);
|
||||
+ lstrcatW(reparse_path, reparseW);
|
||||
+ bret = CreateDirectoryW(reparse_path, NULL);
|
||||
+ ok(bret, "Failed to create junction point directory.\n");
|
||||
|
||||
- pRtlInitUnicodeString( &nameW, L"\\??\\C:\\" );
|
||||
- InitializeObjectAttributes( &attr, &nameW, 0, NULL, NULL );
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 0 );
|
||||
- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status );
|
||||
+ /* Create a destination folder for the junction point to target */
|
||||
+ lstrcpyW(target_path, path);
|
||||
+ for (int i=0; i<1; i++)
|
||||
@ -148,8 +154,9 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ ok(bret, "Failed to create junction point target directory.\n");
|
||||
+ pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL);
|
||||
|
||||
- status = pNtOpenFile( &handle, READ_CONTROL, &attr, &io, 0, 0 );
|
||||
- ok( !status, "open %s failed %#lx\n", wine_dbgstr_w(nameW.Buffer), status );
|
||||
- /* a volume cannot be a reparse point by definition */
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 1 );
|
||||
- ok( status == STATUS_NOT_A_REPARSE_POINT, "expected %#lx, got %#lx\n", STATUS_NOT_A_REPARSE_POINT, status );
|
||||
+ /* construct a too long pathname (resulting reparse buffer over 16 kiB limit) */
|
||||
+ long_path = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32767);
|
||||
+ lstrcpyW(long_path, nameW.Buffer);
|
||||
@ -159,7 +166,8 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ lstrcatW(long_path, path);
|
||||
+ }
|
||||
+ lstrcatW(long_path, targetW);
|
||||
+
|
||||
|
||||
- CloseHandle( handle );
|
||||
+ /* Create the junction point */
|
||||
+ handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
||||
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
|
||||
@ -173,9 +181,7 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ ok(!bret && GetLastError()==ERROR_INVALID_REPARSE_DATA, "Unexpected error (0x%lx)\n", GetLastError());
|
||||
+ HeapFree(GetProcessHeap(), 0, buffer);
|
||||
+ CloseHandle(handle);
|
||||
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, NULL, 0 );
|
||||
- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status );
|
||||
+
|
||||
+ /* construct a long pathname to demonstrate correct behavior with very large reparse points */
|
||||
+ pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL);
|
||||
+ lstrcpyW(long_path, nameW.Buffer);
|
||||
@ -185,16 +191,11 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ lstrcatW(long_path, path);
|
||||
+ }
|
||||
+ lstrcatW(long_path, targetW);
|
||||
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 0 );
|
||||
- ok( status == STATUS_INVALID_USER_BUFFER, "expected %#lx, got %#lx\n", STATUS_INVALID_USER_BUFFER, status );
|
||||
+
|
||||
+ /* use a sane (not obscenely long) target for the rest of testing */
|
||||
+ pRtlFreeUnicodeString(&nameW);
|
||||
+ pRtlDosPathNameToNtPathName_U(target_path, &nameW, NULL, NULL);
|
||||
|
||||
- /* a volume cannot be a reparse point by definition */
|
||||
- status = pNtFsControlFile( handle, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse_data, 1 );
|
||||
- ok( status == STATUS_NOT_A_REPARSE_POINT, "expected %#lx, got %#lx\n", STATUS_NOT_A_REPARSE_POINT, status );
|
||||
+
|
||||
+ /* Create the junction point */
|
||||
+ handle = CreateFileW(reparse_path, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
||||
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
|
||||
@ -207,8 +208,7 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ bret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, (LPVOID)buffer, buffer_len, NULL, 0, &dwret, 0);
|
||||
+ ok(bret, "Failed to create junction point! (0x%lx)\n", GetLastError());
|
||||
+ CloseHandle(handle);
|
||||
|
||||
- CloseHandle( handle );
|
||||
+
|
||||
+cleanup:
|
||||
+ /* Cleanup */
|
||||
+ pRtlFreeUnicodeString(&nameW);
|
||||
@ -222,7 +222,7 @@ index da3611f74f2..5889bebace4 100644
|
||||
}
|
||||
|
||||
START_TEST(file)
|
||||
@@ -5908,6 +6031,6 @@ START_TEST(file)
|
||||
@@ -5960,6 +6083,6 @@ START_TEST(file)
|
||||
test_ioctl();
|
||||
test_query_ea();
|
||||
test_flush_buffers_file();
|
||||
@ -231,7 +231,7 @@ index da3611f74f2..5889bebace4 100644
|
||||
+ test_mailslot_name();
|
||||
}
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index ee68e4dee9b..2b5ab4e232a 100644
|
||||
index d292d934efa..d67983ffac7 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -36,6 +36,8 @@
|
||||
@ -434,7 +434,7 @@ index ee68e4dee9b..2b5ab4e232a 100644
|
||||
+ }
|
||||
+ encoded_len = encode_base64url( (const char *)buffer, buffer_len, encoded );
|
||||
+
|
||||
+ TRACE( "Linking %s to %s\n", unix_src, encoded );
|
||||
+ TRACE( "Linking %s to %s\n", debugstr_a(unix_src), encoded );
|
||||
+ strcpy( filename_buf, unix_src );
|
||||
+ filename = basename( filename_buf );
|
||||
+
|
||||
@ -571,7 +571,7 @@ index ee68e4dee9b..2b5ab4e232a 100644
|
||||
/******************************************************************************
|
||||
* lookup_unix_name
|
||||
*
|
||||
@@ -6153,6 +6448,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
|
||||
@@ -6181,6 +6476,13 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From c491128fb95c0aaf54cc917061d46910b7bd2e4a Mon Sep 17 00:00:00 2001
|
||||
From f1675a9b37980cafd0b6f76e23ef8b042b60bb1e Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Sun, 4 Sep 2022 13:19:16 -0600
|
||||
Subject: [PATCH] ntdll: Allow reparse points to target the applicable Unix
|
||||
@ -13,10 +13,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
1 file changed, 129 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 71311bec9c9..28aa839b34a 100644
|
||||
index f2e182d9076..63a27b89e20 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -3581,6 +3581,125 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
|
||||
@@ -3577,6 +3577,125 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ index 71311bec9c9..28aa839b34a 100644
|
||||
+ for (;is_relative && depth > 0; depth--)
|
||||
+ strcat( target_path, "../" );
|
||||
+ strcat( target_path, &unix_target[relative_offset] );
|
||||
+ TRACE( "adding reparse point target: %s\n", target_path );
|
||||
+ TRACE( "adding reparse point target: %s\n", debugstr_a(target_path) );
|
||||
+ symlinkat( target_path, dirfd, link_path );
|
||||
+ }
|
||||
+ free( unix_target );
|
||||
@ -142,7 +142,7 @@ index 71311bec9c9..28aa839b34a 100644
|
||||
/*
|
||||
* Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink
|
||||
* the requested directory to the location of the old directory.
|
||||
@@ -3714,6 +3833,16 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
|
||||
@@ -3710,6 +3829,16 @@ NTSTATUS create_reparse_point(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
|
||||
link_dir_fd = fd;
|
||||
}
|
||||
|
||||
@ -160,5 +160,5 @@ index 71311bec9c9..28aa839b34a 100644
|
||||
if (!renameat2( -1, tmplink, -1, unix_src, RENAME_EXCHANGE ))
|
||||
{
|
||||
--
|
||||
2.40.1
|
||||
2.43.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 236c1c30f4cf4550a6fc50d3a5be050ec79bac53 Mon Sep 17 00:00:00 2001
|
||||
From 1f891d01326bcb1b7bf6bcaa35f6f10d311fe660 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Sat, 6 Feb 2021 16:16:17 -0700
|
||||
Subject: [PATCH] ntdll: Add an intermediary prefix symlink in reparse point
|
||||
@ -10,7 +10,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
|
||||
1 file changed, 39 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 5d7095086d9..6422bdc5ec1 100644
|
||||
index 63a27b89e20..a15c5e19dcb 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -3577,6 +3577,18 @@ static NTSTATUS get_reparse_target( UNICODE_STRING *nt_target, REPARSE_DATA_BUFF
|
||||
@ -61,7 +61,7 @@ index 5d7095086d9..6422bdc5ec1 100644
|
||||
+ if (append_prefix)
|
||||
+ strcat( target_path, prefix_string );
|
||||
strcat( target_path, &unix_target[relative_offset] );
|
||||
TRACE( "adding reparse point target: %s\n", target_path );
|
||||
TRACE( "adding reparse point target: %s\n", debugstr_a(target_path) );
|
||||
symlinkat( target_path, dirfd, link_path );
|
||||
@@ -3887,6 +3914,7 @@ cleanup:
|
||||
NTSTATUS get_reparse_point_unix(const char *unix_name, REPARSE_DATA_BUFFER *buffer, ULONG *size)
|
||||
|
Loading…
Reference in New Issue
Block a user