From: "Erich E. Hoover" Subject: [PATCH 3/5] ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile. Message-Id: Date: Mon, 13 Oct 2014 13:41:51 -0600 This patch implements retrieving DOS attributes from the Samba format "user.DOSATTRIB" extended attribute using getxattr. The patch complements part 2 (fgetxattr), allowing the use of pathnames instead of file descriptors. From 687be4357bfb0143f0cade40fa4bb8f483e5c312 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 16:04:34 -0600 Subject: ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile. --- dlls/ntdll/file.c | 7 ++++++- include/wine/port.h | 1 + libs/port/xattr.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index e258ca1..fbfe882 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -154,7 +154,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[10]; + int len, ret; *attr = 0; /* stat the file and don't follow symbol links */ @@ -170,6 +171,10 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) } /* convert the Unix stat info into file attributes */ *attr |= get_file_attributes( st ); + /* 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 ); return ret; } diff --git a/include/wine/port.h b/include/wine/port.h index 521246b..7977eb9 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -370,6 +370,7 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]); #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 2d37be9..6ddaa9c 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 = ENOTSUP; + return -1; +#endif +} -- 1.7.9.5