[PATCH V2 2/7] ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile.
Vijay Kiran Kamuju
infyquest at gmail.com
Sat Apr 27 21:19:59 CDT 2019
From: "Erich E. Hoover" <erich.e.hoover at gmail.com>
v2: merge macos support
From: Erich E. Hoover <erich.e.hoover at gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
dlls/ntdll/file.c | 6 +++++-
include/wine/port.h | 1 +
libs/port/xattr.c | 12 ++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index d62126df6e..02fd7a940b 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -171,7 +171,8 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr )
/* get the stat info and file attributes for a file (by name) */
int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
- int ret;
+ char hexattr[11];
+ int len, ret;
*attr = 0;
ret = lstat( path, st );
@@ -184,6 +185,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
if (S_ISDIR( st->st_mode )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT;
}
*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 2be2afe421..15b7b3f666 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -342,6 +342,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 );
/* Interlocked functions */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 1c06b89a86..38f978cfb2 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -42,3 +42,15 @@ 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(XATTR_ADDITIONAL_OPTIONS)
+ return getxattr( path, name, value, size, 0, 0 );
+#elif defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_XATTR_H)
+ return getxattr( path, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
--
2.21.0
More information about the wine-devel
mailing list