Rebase against 18ae539c914a9b5a89f63d8cf9c2a21273eccc6c.

This commit is contained in:
Zebediah Figura
2020-07-09 23:17:40 -05:00
parent f6954e6e77
commit 046f6604b7
17 changed files with 189 additions and 426 deletions

View File

@@ -1,14 +1,14 @@
From 7fbcb02d4e88819dead5b944c3b4676fb4c3bc35 Mon Sep 17 00:00:00 2001
From 1deb289cab2a4271ec84b4636e39a467bd52b117 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 15:28:00 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in NtCreateFile.
Subject: [PATCH 3/7] ntdll: Implement storing DOS attributes in NtCreateFile.
---
dlls/ntdll/tests/directory.c | 24 +++++------
dlls/ntdll/unix/file.c | 78 +++++++++++++++++++++++-------------
dlls/ntdll/tests/directory.c | 24 ++++++------
dlls/ntdll/unix/file.c | 74 +++++++++++++++++++++++-------------
include/wine/port.h | 2 +
libs/port/xattr.c | 20 +++++++++
4 files changed, 83 insertions(+), 41 deletions(-)
libs/port/xattr.c | 20 ++++++++++
4 files changed, 81 insertions(+), 39 deletions(-)
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index 248ed99ab20..e0f4debc624 100644
@@ -60,10 +60,10 @@ index 248ed99ab20..e0f4debc624 100644
}
testfiles[i].nfound++;
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index e3477f5cb5b..73bacabb4f3 100644
index d1f1b8c8f30..32653a110a2 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3572,6 +3572,20 @@ void CDECL set_show_dot_files( BOOL enable )
@@ -3580,6 +3580,20 @@ void CDECL set_show_dot_files( BOOL enable )
show_dot_files = enable;
}
@@ -84,7 +84,7 @@ index e3477f5cb5b..73bacabb4f3 100644
/******************************************************************************
* NtCreateFile (NTDLL.@)
@@ -3581,6 +3595,10 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3589,6 +3603,10 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
ULONG attributes, ULONG sharing, ULONG disposition,
ULONG options, void *ea_buffer, ULONG ea_length )
{
@@ -92,10 +92,10 @@ index e3477f5cb5b..73bacabb4f3 100644
+ OBJECT_ATTRIBUTES unix_attr;
+ data_size_t len;
+ struct object_attributes *objattr;
ANSI_STRING unix_name;
char *unix_name;
BOOL created = FALSE;
@@ -3623,36 +3641,34 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3631,36 +3649,34 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->u.Status = STATUS_SUCCESS;
}
@@ -106,11 +106,14 @@ index e3477f5cb5b..73bacabb4f3 100644
- OBJECT_ATTRIBUTES unix_attr = *attr;
- data_size_t len;
- struct object_attributes *objattr;
-
+ WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
+ return io->u.Status;
+ }
- unix_attr.ObjectName = &empty_string; /* we send the unix name instead */
- if ((io->u.Status = alloc_object_attributes( &unix_attr, &objattr, &len )))
- {
- RtlFreeAnsiString( &unix_name );
- RtlFreeHeap( GetProcessHeap(), 0, unix_name );
- return io->u.Status;
- }
- SERVER_START_REQ( create_file )
@@ -121,23 +124,17 @@ index e3477f5cb5b..73bacabb4f3 100644
- req->options = options;
- req->attrs = attributes;
- wine_server_add_data( req, objattr, len );
- wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
- wine_server_add_data( req, unix_name, strlen(unix_name) );
- io->u.Status = wine_server_call( req );
- *handle = wine_server_ptr_handle( reply->handle );
- }
- SERVER_END_REQ;
- free( objattr );
- RtlFreeAnsiString( &unix_name );
+ WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
+ return io->u.Status;
}
- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
+
+ unix_attr = *attr;
+ unix_attr.ObjectName = &empty_string; /* we send the unix name instead */
+ if ((io->u.Status = alloc_object_attributes( &unix_attr, &objattr, &len )))
+ {
+ RtlFreeAnsiString( &unix_name );
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
+ return io->u.Status;
+ }
+
@@ -149,32 +146,33 @@ index e3477f5cb5b..73bacabb4f3 100644
+ req->options = options;
+ req->attrs = attributes;
+ wine_server_add_data( req, objattr, len );
+ wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
+ wine_server_add_data( req, unix_name, strlen(unix_name) );
+ io->u.Status = wine_server_call( req );
+ *handle = wine_server_ptr_handle( reply->handle );
+ }
}
- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
+ SERVER_END_REQ;
+ free( objattr );
if (io->u.Status == STATUS_SUCCESS)
{
@@ -3674,6 +3690,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3682,6 +3698,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->Information = FILE_OVERWRITTEN;
break;
}
+ if (io->Information == FILE_CREATED)
+ {
+ /* set any DOS extended attributes */
+ set_file_info( unix_name.Buffer, attributes );
+ set_file_info( unix_name, attributes );
+ }
}
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
{
@@ -3681,6 +3702,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3689,6 +3710,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" );
}
+ RtlFreeAnsiString( &unix_name );
+ RtlFreeHeap( GetProcessHeap(), 0, unix_name );
return io->u.Status;
}

View File

@@ -1,4 +1,4 @@
From 01a10dd50491ca0162a5293836cf9b9a3d3c0e34 Mon Sep 17 00:00:00 2001
From 78f53ba7362227cf5d725d6d5b70e06267597b5e Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 11:26:48 -0600
Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the
@@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 496c92265e9..6f3772d20be 100644
index 33fa49d0dea..a88daf1f7f3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1217,15 +1217,15 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir )
@@ -1238,15 +1238,15 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir )
*
* Check if the specified file should be hidden based on its name and the show dot files option.
*/
@@ -33,7 +33,7 @@ index 496c92265e9..6f3772d20be 100644
if (p == end || *p != '.') return FALSE;
/* make sure it isn't '.' or '..' */
if (p + 1 == end) return FALSE;
@@ -1493,6 +1493,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1571,6 +1571,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
RtlFreeHeap( GetProcessHeap(), 0, parent_path );
}
*attr |= get_file_attributes( st );
@@ -44,7 +44,7 @@ index 496c92265e9..6f3772d20be 100644
len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
if (len == -1) return ret;
*attr |= get_file_xattr( hexattr, len );
@@ -1684,11 +1688,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
@@ -2081,11 +2085,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
if (class != FileNamesInformation)
{
if (st.st_dev != dir_data->id.dev) st.st_ino = 0; /* ignore inode if on a different device */
@@ -56,15 +56,15 @@ index 496c92265e9..6f3772d20be 100644
fill_file_info( &st, attributes, info, class );
}
@@ -3301,7 +3300,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
@@ -3857,7 +3856,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
info->AllocationSize = std.AllocationSize;
info->EndOfFile = std.EndOfFile;
info->FileAttributes = basic.FileAttributes;
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
}
RtlFreeAnsiString( &unix_name );
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
}
@@ -3328,10 +3326,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC
@@ -3884,10 +3882,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC
else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
status = STATUS_INVALID_INFO_CLASS;
else
@@ -72,7 +72,7 @@ index 496c92265e9..6f3772d20be 100644
status = fill_file_info( &st, attributes, info, FileBasicInformation );
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
- }
RtlFreeAnsiString( &unix_name );
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
}
else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
--