From: Torge Matthies tmatthies@codeweavers.com
Signed-off-by: Torge Matthies tmatthies@codeweavers.com --- dlls/ntdll/tests/file.c | 2 +- dlls/ntdll/unix/file.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 724072a993b..9d3dd5cca29 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4040,7 +4040,7 @@ static void test_dotfile_file_attributes(void)
status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation ); ok( status == STATUS_SUCCESS, "got %#lx\n", status ); - todo_wine ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes ); + ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes );
GetTempFileNameW( temppathW, L"foo", 0, filenameW ); if (!rename_file( h, filenameW )) return; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 9521c6bf263..d1bef8a0aff 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4548,6 +4548,33 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, }
+static NTSTATUS refresh_file_attrs( HANDLE handle, BOOL force_set_xattr ) +{ + unsigned int options; + BOOL needs_close; + NTSTATUS status; + char *unix_name; + struct stat st; + ULONG attrib; + int fd; + + if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, &options ))) + return status; + if (server_get_unix_name( handle, &unix_name )) + unix_name = NULL; + + if (fd_get_file_info( fd, unix_name, options, &st, &attrib ) == -1) + status = errno_to_status( errno ); + else + status = fd_set_file_info( fd, attrib, force_set_xattr ); + + free( unix_name ); + if (needs_close) + close( fd ); + return status; +} + + /****************************************************************************** * NtSetInformationFile (NTDLL.@) */ @@ -4777,6 +4804,9 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, status = nt_to_unix_file_name( &attr, &unix_name, FILE_OPEN_IF ); if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE) { + if (is_hidden_file( unix_name ) && (status = refresh_file_attrs( handle, TRUE ))) + goto free_unix_name; + SERVER_START_REQ( set_fd_name_info ) { req->handle = wine_server_obj_handle( handle ); @@ -4790,6 +4820,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, } SERVER_END_REQ;
+ free_unix_name: free( unix_name ); } free( redir.Buffer ); @@ -4814,6 +4845,9 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, status = nt_to_unix_file_name( &attr, &unix_name, FILE_OPEN_IF ); if (status == STATUS_SUCCESS || status == STATUS_NO_SUCH_FILE) { + if (is_hidden_file( unix_name ) && (status = refresh_file_attrs( handle, TRUE ))) + goto free_unix_name; + SERVER_START_REQ( set_fd_name_info ) { req->handle = wine_server_obj_handle( handle ); @@ -4827,6 +4861,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, } SERVER_END_REQ;
+ free_unix_name: free( unix_name ); } free( redir.Buffer );