ntdll-DOS_Attributes: Remove patch 0007.

This is refactoring, and as it happens was effectively done by a8b6966a91453f5c6147dc2c74a337d016bbd53a.
This commit is contained in:
Zebediah Figura 2023-11-29 23:39:23 -06:00
parent ecb88d82a3
commit ebab7bc29e

View File

@ -1,82 +0,0 @@
From 95b71a04c7d437e25aac1a1d327beba6ebfaf608 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
unified file info grabbing routine.
---
dlls/ntdll/unix/file.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 9594c70c016..31579caf03b 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1311,16 +1311,16 @@ 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.
*/
-static BOOL is_hidden_file( const UNICODE_STRING *name )
+static BOOL is_hidden_file( const char *name )
{
- WCHAR *p, *end;
+ const char *p, *end;
if (show_dot_files) return FALSE;
- end = p = name->Buffer + name->Length/sizeof(WCHAR);
- while (p > name->Buffer && p[-1] == '\\') p--;
- while (p > name->Buffer && p[-1] != '\\') p--;
- return (p < end && *p == '.');
+ end = p = name + strlen( name );
+ while (p > name && p[-1] == '/') p--;
+ while (p > name && p[-1] != '/') p--;
+ return (p < end && p[0] == '.' && p[1] && (p[1] != '.' || p[2]));
}
@@ -1662,6 +1662,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
free( parent_path );
}
*attr |= get_file_attributes( st );
+ /* convert Unix-style hidden files to a DOS hidden file attribute */
+ if (is_hidden_file( path ))
+ *attr |= FILE_ATTRIBUTE_HIDDEN;
+ /* retrieve any stored DOS attributes */
len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
if (len == -1) return ret;
*attr |= get_file_xattr( hexattr, len );
@@ -2228,11 +2232,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 */
-
- if (!show_dot_files && names->long_name[0] == '.' && names->long_name[1] &&
- (names->long_name[1] != '.' || names->long_name[2]))
- attributes |= FILE_ATTRIBUTE_HIDDEN;
-
fill_file_info( &st, attributes, info, class );
}
@@ -4196,7 +4195,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;
}
free( unix_name );
}
@@ -4227,10 +4225,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
- {
status = fill_file_info( &st, attributes, info, FileBasicInformation );
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
- }
free( unix_name );
}
else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
--
2.37.2