Rebase against 76e7e90c3679766ac327b138e3269fb61ead6e4a.

This commit is contained in:
Elizabeth Figura
2025-11-13 15:54:44 -06:00
parent 3950dc0efe
commit 2bf94fc85b
5 changed files with 14 additions and 396 deletions

View File

@@ -1,4 +1,4 @@
From 6bef707eb81bcdaf7a4f159f07852cbf092a3a2a Mon Sep 17 00:00:00 2001
From a13f85bdd673a85b34dc6cb04c3f477a6935c278 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 30 Nov 2021 16:32:34 +0300
Subject: [PATCH] ntdll: Implement opening files through nt device paths.
@@ -9,7 +9,7 @@ Subject: [PATCH] ntdll: Implement opening files through nt device paths.
2 files changed, 154 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 7016ca166f9..362c9fcc640 100644
index 7f8cfdadcd5..c0bb08eab39 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -139,18 +139,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
@@ -63,10 +63,10 @@ index 7016ca166f9..362c9fcc640 100644
static void open_file_test(void)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a6873bb2f79..91afff6e49c 100644
index 3c59f2c63e9..534c92df826 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3721,7 +3721,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( OBJECT_ATTRIBUTES *attr, UNICODE_S
@@ -3753,7 +3753,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( OBJECT_ATTRIBUTES *attr, UNICODE_S
/******************************************************************************
@@ -75,18 +75,18 @@ index a6873bb2f79..91afff6e49c 100644
*
* Convert a file name from NT namespace to Unix namespace.
*
@@ -3729,8 +3729,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( OBJECT_ATTRIBUTES *attr, UNICODE_S
@@ -3761,8 +3761,8 @@ static NTSTATUS nt_to_unix_file_name_no_root( OBJECT_ATTRIBUTES *attr, UNICODE_S
* element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is
* returned, but the unix name is still filled in properly.
*/
-static NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nt_name,
- char **name_ret, UINT disposition )
+NTSTATUS nt_to_unix_file_name_internal( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nt_name,
+ char **name_ret, UINT disposition )
- char **name_ret, UINT disposition, BOOL open_reparse )
+static NTSTATUS nt_to_unix_file_name_internal( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nt_name,
+ char **name_ret, UINT disposition, BOOL open_reparse )
{
enum server_fd_type type;
int root_fd, needs_close;
@@ -3781,6 +3781,133 @@ static NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *n
@@ -3813,6 +3813,133 @@ static NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *n
}
@@ -165,7 +165,7 @@ index a6873bb2f79..91afff6e49c 100644
+ * returned, but the unix name is still filled in properly.
+ */
+NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nt_name,
+ char **name_ret, UINT disposition )
+ char **name_ret, UINT disposition, BOOL open_reparse )
+{
+ static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0};
+ static const WCHAR dosprefixW[] = {'\\','?','?','\\'};
@@ -175,7 +175,7 @@ index a6873bb2f79..91afff6e49c 100644
+ size_t offset, name_len;
+ NTSTATUS status;
+
+ if (attr->RootDirectory) return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition );
+ if (attr->RootDirectory) return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition, open_reparse );
+
+ nameW = attr->ObjectName;
+
@@ -194,7 +194,7 @@ index a6873bb2f79..91afff6e49c 100644
+ prefix = user_shared_data->NtSystemRoot;
+ }
+ else
+ return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition );
+ return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition, open_reparse );
+
+ name_len = sizeof(dosprefixW) + wcslen(prefix) * sizeof(WCHAR)
+ + sizeof(WCHAR) /* '\\' */ + nameW->Length - offset * sizeof(WCHAR) + sizeof(WCHAR);
@@ -213,7 +213,7 @@ index a6873bb2f79..91afff6e49c 100644
+ nt_name->Buffer = name;
+ nt_name->Length = wcslen( name ) * sizeof(WCHAR);
+ attr->ObjectName = nt_name;
+ return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition );
+ return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition, open_reparse );
+}
+
+