From: "Erich E. Hoover" Subject: [PATCH 2/4] ntdll: Implement retrieving DOS attributes in NtQuery[Full]AttributesFile and NtQueryDirectoryFile. Message-Id: Date: Thu, 18 Dec 2014 10:15:14 -0700 This patch implements retrieving DOS attributes from the Samba format "user.DOSATTRIB" extended attribute using getxattr. The patch complements part 1 (fgetxattr), allowing the use of pathnames instead of file descriptors. From d869e9b0a0aa8b95b8052f4befaa5e61c84a660a 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 | 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 2cb9aa6..e0d75c4 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -152,7 +152,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; ret = lstat( path, st ); @@ -165,6 +166,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 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.9.1