You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Rebase against 9250ecc5a6a64c73aada0ea751815412f7f00410.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
From efd73d7778d8c083337bda1ad162618841c368e0 Mon Sep 17 00:00:00 2001
|
||||
From 6bef707eb81bcdaf7a4f159f07852cbf092a3a2a 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.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/file.c | 25 +++++++-
|
||||
dlls/ntdll/unix/file.c | 135 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 157 insertions(+), 3 deletions(-)
|
||||
dlls/ntdll/unix/file.c | 133 +++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 154 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 25381caf313..7f048572e03 100644
|
||||
index 7016ca166f9..362c9fcc640 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 25381caf313..7f048572e03 100644
|
||||
|
||||
static void open_file_test(void)
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 542a314ea81..68587cbef11 100644
|
||||
index a6873bb2f79..91afff6e49c 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -4593,7 +4593,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
@@ -3721,7 +3721,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( OBJECT_ATTRIBUTES *attr, UNICODE_S
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -75,16 +75,18 @@ index 542a314ea81..68587cbef11 100644
|
||||
*
|
||||
* Convert a file name from NT namespace to Unix namespace.
|
||||
*
|
||||
@@ -4601,7 +4601,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( FILE_OBJECT *fileobj, char **unix_
|
||||
@@ -3729,8 +3729,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( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
|
||||
+NTSTATUS nt_to_unix_file_name_internal( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
|
||||
-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 )
|
||||
{
|
||||
HANDLE rootdir = attr->RootDirectory;
|
||||
enum server_fd_type type;
|
||||
@@ -4680,6 +4680,137 @@ reparse:
|
||||
int root_fd, needs_close;
|
||||
@@ -3781,6 +3781,133 @@ static NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *n
|
||||
}
|
||||
|
||||
|
||||
@@ -162,18 +164,18 @@ index 542a314ea81..68587cbef11 100644
|
||||
+ * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is
|
||||
+ * returned, but the unix name is still filled in properly.
|
||||
+ */
|
||||
+NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition )
|
||||
+NTSTATUS nt_to_unix_file_name( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nt_name,
|
||||
+ char **name_ret, UINT disposition )
|
||||
+{
|
||||
+ static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0};
|
||||
+ static const WCHAR dosprefixW[] = {'\\','?','?','\\'};
|
||||
+ static const WCHAR deviceW[] = {'\\','D','e','v','i','c','e','\\',0};
|
||||
+ WCHAR *name, *ptr, *prefix, buffer[3] = {'c',':',0};
|
||||
+ UNICODE_STRING dospathW, *nameW;
|
||||
+ OBJECT_ATTRIBUTES attr_copy;
|
||||
+ UNICODE_STRING *nameW;
|
||||
+ size_t offset, name_len;
|
||||
+ NTSTATUS status;
|
||||
+
|
||||
+ if (attr->RootDirectory) return nt_to_unix_file_name_internal( attr, name_ret, disposition );
|
||||
+ if (attr->RootDirectory) return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition );
|
||||
+
|
||||
+ nameW = attr->ObjectName;
|
||||
+
|
||||
@@ -192,7 +194,7 @@ index 542a314ea81..68587cbef11 100644
|
||||
+ prefix = user_shared_data->NtSystemRoot;
|
||||
+ }
|
||||
+ else
|
||||
+ return nt_to_unix_file_name_internal( attr, name_ret, disposition );
|
||||
+ return nt_to_unix_file_name_internal( attr, nt_name, name_ret, disposition );
|
||||
+
|
||||
+ name_len = sizeof(dosprefixW) + wcslen(prefix) * sizeof(WCHAR)
|
||||
+ + sizeof(WCHAR) /* '\\' */ + nameW->Length - offset * sizeof(WCHAR) + sizeof(WCHAR);
|
||||
@@ -208,14 +210,10 @@ index 542a314ea81..68587cbef11 100644
|
||||
+ memcpy( ptr, nameW->Buffer + offset, nameW->Length - offset * sizeof(WCHAR) );
|
||||
+ ptr[ nameW->Length / sizeof(WCHAR) - offset ] = 0;
|
||||
+
|
||||
+ dospathW.Buffer = name;
|
||||
+ dospathW.Length = wcslen( name ) * sizeof(WCHAR);
|
||||
+ attr_copy = *attr;
|
||||
+ attr_copy.ObjectName = &dospathW;
|
||||
+ status = nt_to_unix_file_name_internal( &attr_copy, name_ret, disposition );
|
||||
+
|
||||
+ free( name );
|
||||
+ return status;
|
||||
+ 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 );
|
||||
+}
|
||||
+
|
||||
+
|
||||
@@ -223,5 +221,5 @@ index 542a314ea81..68587cbef11 100644
|
||||
* collapse_path
|
||||
*
|
||||
--
|
||||
2.47.2
|
||||
2.51.0
|
||||
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
Fixes: [37487] Resolve \\SystemRoot\\ prefix when opening files
|
||||
Fixes: Implement opening files through nt device paths
|
||||
Depends: ntdll-Junction_Points
|
||||
Disabled: True
|
||||
|
||||
Reference in New Issue
Block a user