Rebase against 3f2850aeaa159270384764843cdb1dc3cbe902c6.

This commit is contained in:
Alistair Leslie-Hughes
2021-08-06 09:23:27 +10:00
parent 00985bf311
commit 82118b0d67
9 changed files with 87 additions and 84 deletions

View File

@@ -1,4 +1,4 @@
From 6bbf7676b4b7887a54f47b43929b8f3f1d7e77ae Mon Sep 17 00:00:00 2001
From 06af804bd6e75332dd2be2005b443e285bc4f2dc Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 00:08:52 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in
@@ -6,14 +6,14 @@ Subject: [PATCH] ntdll: Implement storing DOS attributes in
---
dlls/ntdll/tests/file.c | 8 ++---
dlls/ntdll/unix/file.c | 74 ++++++++++++++++++++++++++++++-----------
2 files changed, 58 insertions(+), 24 deletions(-)
dlls/ntdll/unix/file.c | 76 +++++++++++++++++++++++++++++------------
2 files changed, 59 insertions(+), 25 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 8b9ec4f624d..6d2c8d2fc94 100644
index 19ae5f2ac21..cb578ceee9e 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1389,7 +1389,7 @@ static void test_file_basic_information(void)
@@ -1400,7 +1400,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -22,7 +22,7 @@ index 8b9ec4f624d..6d2c8d2fc94 100644
/* Then HIDDEN */
memset(&fbi, 0, sizeof(fbi));
@@ -1402,7 +1402,7 @@ static void test_file_basic_information(void)
@@ -1413,7 +1413,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -31,7 +31,7 @@ index 8b9ec4f624d..6d2c8d2fc94 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fbi, 0, sizeof(fbi));
@@ -1459,7 +1459,7 @@ static void test_file_all_information(void)
@@ -1470,7 +1470,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res);
@@ -40,7 +40,7 @@ index 8b9ec4f624d..6d2c8d2fc94 100644
/* Then HIDDEN */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
@@ -1472,7 +1472,7 @@ static void test_file_all_information(void)
@@ -1483,7 +1483,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -50,10 +50,10 @@ index 8b9ec4f624d..6d2c8d2fc94 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index da8f65af7b3..0a326a7a1bd 100644
index a2cae9708db..9a1bd50c695 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -376,6 +376,26 @@ NTSTATUS errno_to_status( int err )
@@ -374,6 +374,26 @@ NTSTATUS errno_to_status( int err )
#define XATTR_USER_PREFIX "user."
#endif
@@ -120,7 +120,7 @@ index da8f65af7b3..0a326a7a1bd 100644
/* get the stat info and file attributes for a file (by name) */
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
@@ -4139,7 +4192,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4356,7 +4409,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
case FileBasicInformation:
if (len >= sizeof(FILE_BASIC_INFORMATION))
{
@@ -128,12 +128,13 @@ index da8f65af7b3..0a326a7a1bd 100644
const FILE_BASIC_INFORMATION *info = ptr;
LARGE_INTEGER mtime, atime;
@@ -4153,25 +4205,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
io->u.Status = set_file_times( fd, &mtime, &atime );
@@ -4369,26 +4421,8 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
if (atime.QuadPart || mtime.QuadPart)
status = set_file_times( fd, &mtime, &atime );
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
- if (status == STATUS_SUCCESS && info->FileAttributes)
- {
- if (fstat( fd, &st ) == -1) io->u.Status = errno_to_status( errno );
- if (fstat( fd, &st ) == -1) status = errno_to_status( errno );
- else
- {
- if (info->FileAttributes & FILE_ATTRIBUTE_READONLY)
@@ -148,13 +149,14 @@ index da8f65af7b3..0a326a7a1bd 100644
- /* add write permission only where we already have read permission */
- st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask);
- }
- if (fchmod( fd, st.st_mode ) == -1) io->u.Status = errno_to_status( errno );
- if (fchmod( fd, st.st_mode ) == -1) status = errno_to_status( errno );
- }
- }
+ io->u.Status = fd_set_file_info( fd, info->FileAttributes );
+ if (status == STATUS_SUCCESS && info->FileAttributes)
+ status = fd_set_file_info( fd, info->FileAttributes );
if (needs_close) close( fd );
}
--
2.28.0
2.30.2

View File

@@ -1,4 +1,4 @@
From 02050df2d792e003c28a302d23e7a464573c113c Mon Sep 17 00:00:00 2001
From 494342c8f911f827783f1aed9717d793c4e6a8c0 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.
@@ -58,10 +58,10 @@ index 6a423174664..fccd48f23e5 100644
}
testfiles[i].nfound++;
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index b2494d0343a..ad39732fd29 100644
index 9a1bd50c695..9b3735dd917 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -407,6 +407,26 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
@@ -404,6 +404,26 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
#endif
}
@@ -88,7 +88,7 @@ index b2494d0343a..ad39732fd29 100644
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -3760,6 +3780,20 @@ static NTSTATUS unmount_device( HANDLE handle )
@@ -3783,6 +3803,20 @@ static NTSTATUS unmount_device( HANDLE handle )
return status;
}
@@ -109,27 +109,27 @@ index b2494d0343a..ad39732fd29 100644
/******************************************************************************
* open_unix_file
@@ -3854,13 +3888,14 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->u.Status = STATUS_SUCCESS;
@@ -3868,13 +3902,14 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
status = STATUS_SUCCESS;
}
- if (io->u.Status == STATUS_SUCCESS)
+ if (io->u.Status != STATUS_SUCCESS)
- if (status == STATUS_SUCCESS)
+ if (status != STATUS_SUCCESS)
{
- io->u.Status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
- sharing, disposition, options, ea_buffer, ea_length );
- status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
- sharing, disposition, options, ea_buffer, ea_length );
- free( unix_name );
+ WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
+ return io->u.Status;
+ return status;
}
- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
+
+ io->u.Status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
+ status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
+ sharing, disposition, options, ea_buffer, ea_length );
if (io->u.Status == STATUS_SUCCESS)
if (status == STATUS_SUCCESS)
{
@@ -3882,6 +3917,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3896,6 +3931,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->Information = FILE_OVERWRITTEN;
break;
}
@@ -139,14 +139,14 @@ index b2494d0343a..ad39732fd29 100644
+ set_file_info( unix_name, attributes );
+ }
}
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
else if (status == STATUS_TOO_MANY_OPENED_FILES)
{
@@ -3890,6 +3930,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3904,6 +3944,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
}
free( nt_name.Buffer );
+ free( unix_name );
return io->u.Status;
return io->u.Status = status;
}
--