You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Rebase against 948a6a47b8dbd0ddd86cad04de03f0e4ba81b65d.
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
From 74693bc85e3dbc1f757cfea348dc385b4badeb89 Mon Sep 17 00:00:00 2001
|
||||
From 0bfc43bff3a9b53e65c82d987bb072f0ff0a3a2b Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Tue, 19 Aug 2014 22:10:49 -0600
|
||||
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
|
||||
NtQueryInformationFile.
|
||||
[fd_]get_file_info().
|
||||
|
||||
---
|
||||
configure.ac | 12 ++++++++++++
|
||||
dlls/ntdll/file.c | 16 ++++++++++++++++
|
||||
include/wine/port.h | 8 ++++++++
|
||||
libs/port/Makefile.in | 3 ++-
|
||||
libs/port/xattr.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 77 insertions(+), 1 deletion(-)
|
||||
configure.ac | 12 +++++++++++
|
||||
dlls/ntdll/unix/file.c | 22 ++++++++++++++++++-
|
||||
include/wine/port.h | 9 ++++++++
|
||||
libs/port/Makefile.in | 3 ++-
|
||||
libs/port/xattr.c | 49 ++++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 93 insertions(+), 2 deletions(-)
|
||||
create mode 100644 libs/port/xattr.c
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 180d958fc4ef..1e3d2e0d4ef0 100644
|
||||
index d3bd12a6340..5e775c04449 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -89,6 +89,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
|
||||
@@ -88,6 +88,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
|
||||
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
|
||||
AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)]))
|
||||
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
|
||||
@@ -25,7 +25,7 @@ index 180d958fc4ef..1e3d2e0d4ef0 100644
|
||||
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
|
||||
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
|
||||
@@ -709,6 +710,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
|
||||
@@ -697,6 +698,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
|
||||
#include <sys/socket.h>
|
||||
#endif])
|
||||
|
||||
@@ -43,13 +43,13 @@ index 180d958fc4ef..1e3d2e0d4ef0 100644
|
||||
dnl **** Check for working dll ****
|
||||
|
||||
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index 9a9acfdb623b..5536e61db2e4 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -126,6 +126,22 @@ mode_t FILE_umask = 0;
|
||||
NTSTATUS FILE_DecodeSymlink(const char *unix_src, char *unix_dest, USHORT *unix_dest_len,
|
||||
DWORD *tag, ULONG *flags, BOOL *is_dir);
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 66ce2eb5fe4..d2e783f3300 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -1431,6 +1431,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
|
||||
}
|
||||
|
||||
|
||||
+/* Match the Samba conventions for storing DOS file attributes */
|
||||
+#define SAMBA_XATTR_DOS_ATTRIB XATTR_USER_PREFIX "DOSATTRIB"
|
||||
@@ -70,11 +70,31 @@ index 9a9acfdb623b..5536e61db2e4 100644
|
||||
/* fetch the attributes of a file */
|
||||
static inline ULONG get_file_attributes( const struct stat *st )
|
||||
{
|
||||
@@ -1450,7 +1466,8 @@ static inline ULONG get_file_attributes( const struct stat *st )
|
||||
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
{
|
||||
char *parent_path;
|
||||
- int ret;
|
||||
+ char hexattr[11];
|
||||
+ int len, ret;
|
||||
|
||||
*attr = 0;
|
||||
ret = lstat( path, st );
|
||||
@@ -1476,6 +1493,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, parent_path );
|
||||
}
|
||||
*attr |= get_file_attributes( st );
|
||||
+ len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
|
||||
+ if (len == -1) return ret;
|
||||
+ *attr |= get_file_xattr( hexattr, len );
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/port.h b/include/wine/port.h
|
||||
index e8434c73cca2..f0507efcc7e7 100644
|
||||
index e8434c73cca..6e81cb71a76 100644
|
||||
--- a/include/wine/port.h
|
||||
+++ b/include/wine/port.h
|
||||
@@ -361,6 +361,14 @@ int usleep (unsigned int useconds);
|
||||
@@ -361,6 +361,15 @@ int usleep (unsigned int useconds);
|
||||
|
||||
extern int mkstemps(char *template, int suffix_len);
|
||||
|
||||
@@ -85,12 +105,13 @@ index e8434c73cca2..f0507efcc7e7 100644
|
||||
+#endif
|
||||
+
|
||||
+extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
|
||||
+extern int xattr_get( const char *path, const char *name, void *value, size_t size );
|
||||
+
|
||||
#else /* NO_LIBWINE_PORT */
|
||||
|
||||
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
||||
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
|
||||
index 1963afe24232..4b1ecab7516b 100644
|
||||
index 1963afe2423..4b1ecab7516 100644
|
||||
--- a/libs/port/Makefile.in
|
||||
+++ b/libs/port/Makefile.in
|
||||
@@ -22,4 +22,5 @@ C_SRCS = \
|
||||
@@ -102,10 +123,10 @@ index 1963afe24232..4b1ecab7516b 100644
|
||||
+ xattr.c
|
||||
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
|
||||
new file mode 100644
|
||||
index 000000000000..94b77132bbf2
|
||||
index 00000000000..88e900dac6d
|
||||
--- /dev/null
|
||||
+++ b/libs/port/xattr.c
|
||||
@@ -0,0 +1,39 @@
|
||||
@@ -0,0 +1,49 @@
|
||||
+/*
|
||||
+ * extended attributes functions
|
||||
+ *
|
||||
@@ -145,6 +166,16 @@ index 000000000000..94b77132bbf2
|
||||
+ return -1;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+int xattr_get( const char *path, const char *name, void *value, size_t size )
|
||||
+{
|
||||
+#if defined(HAVE_ATTR_XATTR_H)
|
||||
+ return getxattr( path, name, value, size );
|
||||
+#else
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+#endif
|
||||
+}
|
||||
--
|
||||
2.26.2
|
||||
2.27.0
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
From 34ed49d7dbff7c5f0da8553330c3378b574429fc Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Wed, 20 Aug 2014 16:04:34 -0600
|
||||
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
|
||||
NtQuery[Full]AttributesFile and NtQueryDirectoryFile.
|
||||
|
||||
---
|
||||
dlls/ntdll/file.c | 6 +++++-
|
||||
include/wine/port.h | 1 +
|
||||
libs/port/xattr.c | 10 ++++++++++
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index 5536e61db2e4..2fd62ebfb802 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -182,7 +182,8 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
|
||||
int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
{
|
||||
char *parent_path;
|
||||
- int ret;
|
||||
+ char hexattr[11];
|
||||
+ int len, ret;
|
||||
|
||||
*attr = 0;
|
||||
ret = lstat( path, st );
|
||||
@@ -215,6 +216,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, parent_path );
|
||||
}
|
||||
*attr |= get_file_attributes( st );
|
||||
+ len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 );
|
||||
+ if (len == -1) return ret;
|
||||
+ *attr |= get_file_xattr( hexattr, len );
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/port.h b/include/wine/port.h
|
||||
index f0507efcc7e7..6e81cb71a76d 100644
|
||||
--- a/include/wine/port.h
|
||||
+++ b/include/wine/port.h
|
||||
@@ -368,6 +368,7 @@ extern int mkstemps(char *template, int suffix_len);
|
||||
#endif
|
||||
|
||||
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
|
||||
+extern int xattr_get( const char *path, const char *name, void *value, size_t size );
|
||||
|
||||
#else /* NO_LIBWINE_PORT */
|
||||
|
||||
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
|
||||
index 94b77132bbf2..88e900dac6d4 100644
|
||||
--- a/libs/port/xattr.c
|
||||
+++ b/libs/port/xattr.c
|
||||
@@ -37,3 +37,13 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
+
|
||||
+int xattr_get( const char *path, const char *name, void *value, size_t size )
|
||||
+{
|
||||
+#if defined(HAVE_ATTR_XATTR_H)
|
||||
+ return getxattr( path, name, value, size );
|
||||
+#else
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+#endif
|
||||
+}
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1a04bc9a0ef3cf03b89d50becee9240f8a195873 Mon Sep 17 00:00:00 2001
|
||||
From 9f17f2e4f9842549820691f34f7d2da5719ead0a 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
|
||||
@@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Implement storing DOS attributes in
|
||||
4 files changed, 60 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index 2fd62ebfb802..c077add9769e 100644
|
||||
index bd6e3cbcf88..c1f9808e497 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -178,6 +178,39 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
|
||||
@@ -177,6 +177,39 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ index 2fd62ebfb802..c077add9769e 100644
|
||||
+ return STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
/* get the stat info and file attributes for a file (by name) */
|
||||
int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
{
|
||||
@@ -3240,7 +3273,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
||||
char *parent_path;
|
||||
@@ -3113,7 +3146,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
||||
case FileBasicInformation:
|
||||
if (len >= sizeof(FILE_BASIC_INFORMATION))
|
||||
{
|
||||
@@ -63,7 +63,7 @@ index 2fd62ebfb802..c077add9769e 100644
|
||||
const FILE_BASIC_INFORMATION *info = ptr;
|
||||
LARGE_INTEGER mtime, atime;
|
||||
|
||||
@@ -3254,25 +3286,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
||||
@@ -3127,25 +3159,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
|
||||
io->u.Status = set_file_times( fd, &mtime, &atime );
|
||||
|
||||
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
|
||||
@@ -91,7 +91,7 @@ index 2fd62ebfb802..c077add9769e 100644
|
||||
if (needs_close) close( fd );
|
||||
}
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 0b05c39685cd..b49a9a4dbbda 100644
|
||||
index 67d54c81fb0..4c2e63d3679 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -1365,7 +1365,7 @@ static void test_file_basic_information(void)
|
||||
@@ -131,7 +131,7 @@ index 0b05c39685cd..b49a9a4dbbda 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/include/wine/port.h b/include/wine/port.h
|
||||
index 6e81cb71a76d..f90396727d6d 100644
|
||||
index 6e81cb71a76..f90396727d6 100644
|
||||
--- a/include/wine/port.h
|
||||
+++ b/include/wine/port.h
|
||||
@@ -368,6 +368,8 @@ extern int mkstemps(char *template, int suffix_len);
|
||||
@@ -144,7 +144,7 @@ index 6e81cb71a76d..f90396727d6d 100644
|
||||
|
||||
#else /* NO_LIBWINE_PORT */
|
||||
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
|
||||
index 88e900dac6d4..6918c9956cc6 100644
|
||||
index 88e900dac6d..6918c9956cc 100644
|
||||
--- a/libs/port/xattr.c
|
||||
+++ b/libs/port/xattr.c
|
||||
@@ -38,6 +38,26 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
|
||||
@@ -175,5 +175,5 @@ index 88e900dac6d4..6918c9956cc6 100644
|
||||
{
|
||||
#if defined(HAVE_ATTR_XATTR_H)
|
||||
--
|
||||
2.26.2
|
||||
2.27.0
|
||||
|
||||
|
||||
@@ -1,136 +1,17 @@
|
||||
From 8fde8af21e169d9a48bab50bac4d6e24238141b6 Mon Sep 17 00:00:00 2001
|
||||
From 769a1043bb174557b600c9ce38765846a3126e7f 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.
|
||||
|
||||
---
|
||||
dlls/ntdll/file.c | 76 +++++++++++++++++++++++-------------
|
||||
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, 82 insertions(+), 40 deletions(-)
|
||||
4 files changed, 81 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index c077add9769e..a596afed72e7 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -255,6 +255,21 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
return ret;
|
||||
}
|
||||
|
||||
+NTSTATUS set_file_info( const char *path, ULONG attr )
|
||||
+{
|
||||
+ char hexattr[11];
|
||||
+ int len;
|
||||
+
|
||||
+ /* Note: unix mode already set when called this way */
|
||||
+ attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */
|
||||
+ len = sprintf( hexattr, "0x%x", attr );
|
||||
+ if (attr != 0)
|
||||
+ xattr_set( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, len );
|
||||
+ else
|
||||
+ xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB );
|
||||
+ return STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
/**************************************************************************
|
||||
* FILE_CreateFile (internal)
|
||||
* Open a file.
|
||||
@@ -266,6 +281,10 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
|
||||
ULONG attributes, ULONG sharing, ULONG disposition,
|
||||
ULONG options, PVOID ea_buffer, ULONG ea_length )
|
||||
{
|
||||
+ static UNICODE_STRING empty_string;
|
||||
+ OBJECT_ATTRIBUTES unix_attr;
|
||||
+ data_size_t len;
|
||||
+ struct object_attributes *objattr;
|
||||
ANSI_STRING unix_name;
|
||||
BOOL created = FALSE;
|
||||
|
||||
@@ -309,37 +328,34 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
|
||||
io->u.Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
- if (io->u.Status == STATUS_SUCCESS)
|
||||
+ if (io->u.Status != STATUS_SUCCESS)
|
||||
{
|
||||
- static UNICODE_STRING empty_string;
|
||||
- OBJECT_ATTRIBUTES unix_attr = *attr;
|
||||
- data_size_t len;
|
||||
- struct object_attributes *objattr;
|
||||
-
|
||||
- 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 );
|
||||
- return io->u.Status;
|
||||
- }
|
||||
+ WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
|
||||
+ return io->u.Status;
|
||||
+ }
|
||||
|
||||
- SERVER_START_REQ( create_file )
|
||||
- {
|
||||
- req->access = access;
|
||||
- req->sharing = sharing;
|
||||
- req->create = disposition;
|
||||
- req->options = options;
|
||||
- req->attrs = attributes;
|
||||
- wine_server_add_data( req, objattr, len );
|
||||
- wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
|
||||
- io->u.Status = wine_server_call( req );
|
||||
- *handle = wine_server_ptr_handle( reply->handle );
|
||||
- }
|
||||
- SERVER_END_REQ;
|
||||
- RtlFreeHeap( GetProcessHeap(), 0, objattr );
|
||||
+ 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 );
|
||||
+ return io->u.Status;
|
||||
}
|
||||
- else WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
|
||||
+
|
||||
+ SERVER_START_REQ( create_file )
|
||||
+ {
|
||||
+ req->access = access;
|
||||
+ req->sharing = sharing;
|
||||
+ req->create = disposition;
|
||||
+ req->options = options;
|
||||
+ req->attrs = attributes;
|
||||
+ wine_server_add_data( req, objattr, len );
|
||||
+ wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
|
||||
+ io->u.Status = wine_server_call( req );
|
||||
+ *handle = wine_server_ptr_handle( reply->handle );
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+ RtlFreeHeap( GetProcessHeap(), 0, objattr );
|
||||
|
||||
if (io->u.Status == STATUS_SUCCESS)
|
||||
{
|
||||
@@ -361,6 +377,11 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
|
||||
io->Information = FILE_OVERWRITTEN;
|
||||
break;
|
||||
}
|
||||
+ if (io->Information == FILE_CREATED)
|
||||
+ {
|
||||
+ /* set any DOS extended attributes */
|
||||
+ set_file_info( unix_name.Buffer, attributes );
|
||||
+ }
|
||||
}
|
||||
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
|
||||
{
|
||||
@@ -368,6 +389,7 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
|
||||
if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" );
|
||||
}
|
||||
|
||||
+ RtlFreeAnsiString( &unix_name );
|
||||
return io->u.Status;
|
||||
}
|
||||
|
||||
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
|
||||
index 4618f4eaff2b..44933c2153df 100644
|
||||
index 248ed99ab20..e0f4debc624 100644
|
||||
--- a/dlls/ntdll/tests/directory.c
|
||||
+++ b/dlls/ntdll/tests/directory.c
|
||||
@@ -55,7 +55,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *
|
||||
@@ -178,8 +59,125 @@ index 4618f4eaff2b..44933c2153df 100644
|
||||
testfiles[i].attr_done = TRUE;
|
||||
}
|
||||
testfiles[i].nfound++;
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 66ce2eb5fe4..0546039cc47 100644
|
||||
--- a/dlls/ntdll/unix/file.c
|
||||
+++ b/dlls/ntdll/unix/file.c
|
||||
@@ -3004,6 +3004,20 @@ void CDECL set_show_dot_files( BOOL enable )
|
||||
show_dot_files = enable;
|
||||
}
|
||||
|
||||
+NTSTATUS set_file_info( const char *path, ULONG attr )
|
||||
+{
|
||||
+ char hexattr[11];
|
||||
+ int len;
|
||||
+
|
||||
+ /* Note: unix mode already set when called this way */
|
||||
+ attr &= ~FILE_ATTRIBUTE_NORMAL; /* do not store everything, but keep everything Samba can use */
|
||||
+ len = sprintf( hexattr, "0x%x", attr );
|
||||
+ if (attr != 0)
|
||||
+ xattr_set( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, len );
|
||||
+ else
|
||||
+ xattr_remove( path, SAMBA_XATTR_DOS_ATTRIB );
|
||||
+ return STATUS_SUCCESS;
|
||||
+}
|
||||
|
||||
/******************************************************************************
|
||||
* NtCreateFile (NTDLL.@)
|
||||
@@ -3013,6 +3027,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 )
|
||||
{
|
||||
+ static UNICODE_STRING empty_string;
|
||||
+ OBJECT_ATTRIBUTES unix_attr;
|
||||
+ data_size_t len;
|
||||
+ struct object_attributes *objattr;
|
||||
ANSI_STRING unix_name;
|
||||
BOOL created = FALSE;
|
||||
|
||||
@@ -3055,36 +3073,34 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
|
||||
io->u.Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
- if (io->u.Status == STATUS_SUCCESS)
|
||||
+ if (io->u.Status != STATUS_SUCCESS)
|
||||
{
|
||||
- static UNICODE_STRING empty_string;
|
||||
- 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 );
|
||||
- return io->u.Status;
|
||||
- }
|
||||
- SERVER_START_REQ( create_file )
|
||||
- {
|
||||
- req->access = access;
|
||||
- req->sharing = sharing;
|
||||
- req->create = disposition;
|
||||
- req->options = options;
|
||||
- req->attrs = attributes;
|
||||
- wine_server_add_data( req, objattr, len );
|
||||
- wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
|
||||
- io->u.Status = wine_server_call( req );
|
||||
- *handle = wine_server_ptr_handle( reply->handle );
|
||||
- }
|
||||
- SERVER_END_REQ;
|
||||
- RtlFreeHeap( GetProcessHeap(), 0, objattr );
|
||||
+ 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 );
|
||||
+ return io->u.Status;
|
||||
}
|
||||
- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status );
|
||||
+
|
||||
+ SERVER_START_REQ( create_file )
|
||||
+ {
|
||||
+ req->access = access;
|
||||
+ req->sharing = sharing;
|
||||
+ req->create = disposition;
|
||||
+ req->options = options;
|
||||
+ req->attrs = attributes;
|
||||
+ wine_server_add_data( req, objattr, len );
|
||||
+ wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
|
||||
+ io->u.Status = wine_server_call( req );
|
||||
+ *handle = wine_server_ptr_handle( reply->handle );
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+ RtlFreeHeap( GetProcessHeap(), 0, objattr );
|
||||
|
||||
if (io->u.Status == STATUS_SUCCESS)
|
||||
{
|
||||
@@ -3106,6 +3122,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 );
|
||||
+ }
|
||||
}
|
||||
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
|
||||
{
|
||||
@@ -3113,6 +3134,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 );
|
||||
return io->u.Status;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/port.h b/include/wine/port.h
|
||||
index f90396727d6d..7d2c73887073 100644
|
||||
index f90396727d6..7d2c7388707 100644
|
||||
--- a/include/wine/port.h
|
||||
+++ b/include/wine/port.h
|
||||
@@ -371,6 +371,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
|
||||
@@ -192,7 +190,7 @@ index f90396727d6d..7d2c73887073 100644
|
||||
#else /* NO_LIBWINE_PORT */
|
||||
|
||||
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
|
||||
index 6918c9956cc6..683e7a615e2b 100644
|
||||
index 6918c9956cc..683e7a615e2 100644
|
||||
--- a/libs/port/xattr.c
|
||||
+++ b/libs/port/xattr.c
|
||||
@@ -67,3 +67,23 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
|
||||
@@ -220,5 +218,5 @@ index 6918c9956cc6..683e7a615e2b 100644
|
||||
+#endif
|
||||
+}
|
||||
--
|
||||
2.26.2
|
||||
2.27.0
|
||||
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
From e1e41f084c6cdeba3cb44aaa6753b13bc1411df8 Mon Sep 17 00:00:00 2001
|
||||
From 01a10dd50491ca0162a5293836cf9b9a3d3c0e34 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/directory.c | 15 +++++----------
|
||||
dlls/ntdll/file.c | 10 ++++------
|
||||
dlls/ntdll/ntdll_misc.h | 2 +-
|
||||
3 files changed, 10 insertions(+), 17 deletions(-)
|
||||
dlls/ntdll/unix/file.c | 23 +++++++++--------------
|
||||
1 file changed, 9 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
|
||||
index ba50aa1b807..d6bf1354a5b 100644
|
||||
--- a/dlls/ntdll/directory.c
|
||||
+++ b/dlls/ntdll/directory.c
|
||||
@@ -1274,17 +1274,17 @@ static DWORD WINAPI init_options( RTL_RUN_ONCE *once, void *param, void **contex
|
||||
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
|
||||
index 496c92265e9..6f3772d20be 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 )
|
||||
*
|
||||
* Check if the specified file should be hidden based on its name and the show dot files option.
|
||||
*/
|
||||
-BOOL DIR_is_hidden_file( const UNICODE_STRING *name )
|
||||
+BOOL DIR_is_hidden_file( const char *name )
|
||||
-static BOOL is_hidden_file( const UNICODE_STRING *name )
|
||||
+static BOOL is_hidden_file( const char *name )
|
||||
{
|
||||
- WCHAR *p, *end;
|
||||
+ char *p, *end;
|
||||
|
||||
RtlRunOnceExecuteOnce( &init_once, init_options, NULL, NULL );
|
||||
|
||||
if (show_dot_files) return FALSE;
|
||||
|
||||
- end = p = name->Buffer + name->Length/sizeof(WCHAR);
|
||||
@@ -37,7 +33,18 @@ index ba50aa1b807..d6bf1354a5b 100644
|
||||
if (p == end || *p != '.') return FALSE;
|
||||
/* make sure it isn't '.' or '..' */
|
||||
if (p + 1 == end) return FALSE;
|
||||
@@ -1532,11 +1532,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
|
||||
@@ -1493,6 +1493,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, 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 );
|
||||
@@ -1684,11 +1688,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 */
|
||||
@@ -49,55 +56,25 @@ index ba50aa1b807..d6bf1354a5b 100644
|
||||
fill_file_info( &st, attributes, info, class );
|
||||
}
|
||||
|
||||
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
|
||||
index 6a935044f46..a0e54c27198 100644
|
||||
--- a/dlls/ntdll/file.c
|
||||
+++ b/dlls/ntdll/file.c
|
||||
@@ -250,6 +250,10 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, parent_path );
|
||||
}
|
||||
*attr |= get_file_attributes( st );
|
||||
+ /* convert Unix-style hidden files to a DOS hidden file attribute */
|
||||
+ if (DIR_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 );
|
||||
@@ -3489,8 +3493,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
|
||||
@@ -3301,7 +3300,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr,
|
||||
info->AllocationSize = std.AllocationSize;
|
||||
info->EndOfFile = std.EndOfFile;
|
||||
info->FileAttributes = basic.FileAttributes;
|
||||
- if (DIR_is_hidden_file( attr->ObjectName ))
|
||||
- info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
}
|
||||
RtlFreeAnsiString( &unix_name );
|
||||
}
|
||||
@@ -3518,11 +3520,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC
|
||||
@@ -3328,10 +3326,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 (DIR_is_hidden_file( attr->ObjectName ))
|
||||
- info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
- }
|
||||
RtlFreeAnsiString( &unix_name );
|
||||
}
|
||||
else WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index aeed9b857c2..b1cb9aa6843 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -168,7 +168,7 @@ extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
|
||||
FILE_INFORMATION_CLASS class ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
|
||||
extern void init_directories(void) DECLSPEC_HIDDEN;
|
||||
-extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ) DECLSPEC_HIDDEN;
|
||||
+extern BOOL DIR_is_hidden_file( const char *name ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS DIR_unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS DIR_get_unix_cwd( char **cwd ) DECLSPEC_HIDDEN;
|
||||
extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ) DECLSPEC_HIDDEN;
|
||||
else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
|
||||
--
|
||||
2.25.1
|
||||
2.27.0
|
||||
|
||||
|
||||
@@ -2,3 +2,6 @@ Fixes: [9158] Support for DOS hidden/system file attributes
|
||||
Fixes: [15679] cygwin symlinks not working in wine
|
||||
# Depends: ntdll-Syscall_Wrappers
|
||||
Depends: ntdll-Junction_Points
|
||||
# Currently awkwardly split between ntdll.dll and ntdll.so; wait for the rest
|
||||
# of the file functions to be moved to ntdll.so before finishing the rebase.
|
||||
Disabled: true
|
||||
|
||||
Reference in New Issue
Block a user