Module: wine Branch: master Commit: e916255216e708e7646f87ebc5a860039660a87f URL: https://gitlab.winehq.org/wine/wine/-/commit/e916255216e708e7646f87ebc5a8600...
Author: Joel Holdsworth joel@airwebreathe.org.uk Date: Mon Aug 7 11:32:44 2023 +0100
ntdll: Add support for FILE_{RENAME,LINK}_IGNORE_READONLY_ATTRIBUTE.
Signed-off-by: Joel Holdsworth joel@airwebreathe.org.uk
---
dlls/ntdll/tests/file.c | 14 +++++++------- dlls/ntdll/unix/file.c | 4 ++-- server/fd.c | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index a00a425582c..4e1750a4751 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2259,10 +2259,10 @@ static void test_file_rename_information_ex(void)
io.Status = 0xdeadbeef; res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformationEx ); - todo_wine ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - todo_wine ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - todo_wine ok( fileDeleted, "file should not exist\n" ); + ok( fileDeleted, "file should not exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" );
@@ -3076,8 +3076,8 @@ static void test_file_link_information_ex(void) return; }
- ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); - todo_wine ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); + todo_wine ok( io.Status == 0xdeadbeef, "io.Status expected 0xdeadbeef, got %lx\n", io.Status ); + ok( res == STATUS_ACCESS_DENIED, "res expected STATUS_ACCESS_DENIED, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -3110,8 +3110,8 @@ static void test_file_link_information_ex(void)
io.Status = 0xdeadbeef; res = pNtSetInformationFile( handle, &io, fli, sizeof(FILE_LINK_INFORMATION) + fli->FileNameLength, FileLinkInformationEx ); - todo_wine ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); - todo_wine ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); + ok( io.Status == STATUS_SUCCESS, "io.Status expected STATUS_SUCCESS, got %lx\n", io.Status ); + ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %lx\n", res ); fileDeleted = GetFileAttributesW( oldpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( !fileDeleted, "file should exist\n" ); fileDeleted = GetFileAttributesW( newpath ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index aa2ec9bae59..c6533710365 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4797,7 +4797,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, else flags = info->Flags;
- if (flags & ~FILE_RENAME_REPLACE_IF_EXISTS) + if (flags & ~(FILE_RENAME_REPLACE_IF_EXISTS | FILE_RENAME_IGNORE_READONLY_ATTRIBUTE)) FIXME( "unsupported flags: %#x\n", flags );
name_str.Buffer = info->FileName; @@ -4844,7 +4844,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, else flags = info->Flags;
- if (flags & ~FILE_LINK_REPLACE_IF_EXISTS) + if (flags & ~(FILE_LINK_REPLACE_IF_EXISTS | FILE_LINK_IGNORE_READONLY_ATTRIBUTE)) FIXME( "unsupported flags: %#x\n", flags );
name_str.Buffer = info->FileName; diff --git a/server/fd.c b/server/fd.c index 00c0e4ac847..8576882aaa9 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2601,7 +2601,8 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, da }
/* read-only files cannot be replaced */ - if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) + if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) && + !(flags & FILE_RENAME_IGNORE_READONLY_ATTRIBUTE)) { set_error( STATUS_ACCESS_DENIED ); goto failed;