Commit 64e047fe authored by Alexandre Julliard's avatar Alexandre Julliard

Get rid of FILE_ATTRIBUTE_SYMLINK (based on a patch by Bill Medland).

parent 5a11b009
...@@ -80,7 +80,7 @@ static int DIR_GetPath( LPCWSTR keyname, LPCWSTR defval, DOS_FULL_NAME *full_nam ...@@ -80,7 +80,7 @@ static int DIR_GetPath( LPCWSTR keyname, LPCWSTR defval, DOS_FULL_NAME *full_nam
PROFILE_GetWineIniString( wineW, keyname, defval, path, MAX_PATHNAME_LEN ); PROFILE_GetWineIniString( wineW, keyname, defval, path, MAX_PATHNAME_LEN );
if (!DOSFS_GetFullName( path, TRUE, full_name ) || if (!DOSFS_GetFullName( path, TRUE, full_name ) ||
(!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))|| (!FILE_Stat( full_name->long_name, &info, NULL ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")) || (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")) ||
(!(GetLongPathNameW(full_name->short_name, longname, longname_len))) ) (!(GetLongPathNameW(full_name->short_name, longname, longname_len))) )
{ {
......
...@@ -1696,7 +1696,7 @@ BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len ) ...@@ -1696,7 +1696,7 @@ BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len )
*/ */
static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry ) static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
{ {
DWORD attr = info->attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY | FILE_ATTRIBUTE_SYMLINK; DWORD attr = info->attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
UINT flags = DRIVE_GetFlags( info->drive ); UINT flags = DRIVE_GetFlags( info->drive );
char *p, buffer[MAX_PATHNAME_LEN]; char *p, buffer[MAX_PATHNAME_LEN];
const char *drive_path; const char *drive_path;
...@@ -1704,6 +1704,7 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry ) ...@@ -1704,6 +1704,7 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
LPCWSTR long_name, short_name; LPCWSTR long_name, short_name;
BY_HANDLE_FILE_INFORMATION fileinfo; BY_HANDLE_FILE_INFORMATION fileinfo;
WCHAR dos_name[13]; WCHAR dos_name[13];
BOOL is_symlink;
if ((info->attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL) if ((info->attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
{ {
...@@ -1765,13 +1766,12 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry ) ...@@ -1765,13 +1766,12 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
/* Check the file attributes */ /* Check the file attributes */
WideCharToMultiByte(DRIVE_GetCodepage(info->drive), 0, long_name, -1, WideCharToMultiByte(DRIVE_GetCodepage(info->drive), 0, long_name, -1,
p, sizeof(buffer) - (int)(p - buffer), NULL, NULL); p, sizeof(buffer) - (int)(p - buffer), NULL, NULL);
if (!FILE_Stat( buffer, &fileinfo )) if (!FILE_Stat( buffer, &fileinfo, &is_symlink ))
{ {
WARN("can't stat %s\n", buffer); WARN("can't stat %s\n", buffer);
continue; continue;
} }
if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_SYMLINK) && if (is_symlink && (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
static const WCHAR wineW[] = {'w','i','n','e',0}; static const WCHAR wineW[] = {'w','i','n','e',0};
static const WCHAR ShowDirSymlinksW[] = {'S','h','o','w','D','i','r','S','y','m','l','i','n','k','s',0}; static const WCHAR ShowDirSymlinksW[] = {'S','h','o','w','D','i','r','S','y','m','l','i','n','k','s',0};
......
...@@ -1104,7 +1104,7 @@ int DRIVE_Chdir( int drive, LPCWSTR path ) ...@@ -1104,7 +1104,7 @@ int DRIVE_Chdir( int drive, LPCWSTR path )
buffer[MAX_PATHNAME_LEN - 1] = 0; /* ensure 0 termination */ buffer[MAX_PATHNAME_LEN - 1] = 0; /* ensure 0 termination */
if (!DOSFS_GetFullName( buffer, TRUE, &full_name )) return 0; if (!DOSFS_GetFullName( buffer, TRUE, &full_name )) return 0;
if (!FILE_Stat( full_name.long_name, &info )) return 0; if (!FILE_Stat( full_name.long_name, &info, NULL )) return 0;
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
SetLastError( ERROR_FILE_NOT_FOUND ); SetLastError( ERROR_FILE_NOT_FOUND );
......
...@@ -734,7 +734,7 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) ...@@ -734,7 +734,7 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info )
* *
* Stat a Unix path name. Return TRUE if OK. * Stat a Unix path name. Return TRUE if OK.
*/ */
BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink_ptr )
{ {
struct stat st; struct stat st;
int is_symlink; int is_symlink;
...@@ -759,7 +759,6 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) ...@@ -759,7 +759,6 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
/* fill in the information we gathered so far */ /* fill in the information we gathered so far */
FILE_FillInfo( &st, info ); FILE_FillInfo( &st, info );
if (is_symlink) info->dwFileAttributes |= FILE_ATTRIBUTE_SYMLINK;
/* and now see if this is a hidden file, based on the name */ /* and now see if this is a hidden file, based on the name */
p = strrchr( unixName, '/'); p = strrchr( unixName, '/');
...@@ -774,7 +773,7 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) ...@@ -774,7 +773,7 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
if (!show_dot_files) if (!show_dot_files)
info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
} }
if (is_symlink_ptr) *is_symlink_ptr = is_symlink;
return TRUE; return TRUE;
} }
...@@ -849,7 +848,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name ) ...@@ -849,7 +848,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
} }
if (!DOSFS_GetFullName( name, TRUE, &full_name) ) if (!DOSFS_GetFullName( name, TRUE, &full_name) )
return -1; return -1;
if (!FILE_Stat( full_name.long_name, &info )) return -1; if (!FILE_Stat( full_name.long_name, &info, NULL )) return -1;
return info.dwFileAttributes; return info.dwFileAttributes;
} }
...@@ -3361,7 +3360,7 @@ BOOL WINAPI GetFileAttributesExW( ...@@ -3361,7 +3360,7 @@ BOOL WINAPI GetFileAttributesExW(
LPWIN32_FILE_ATTRIBUTE_DATA lpFad = LPWIN32_FILE_ATTRIBUTE_DATA lpFad =
(LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation; (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name )) return FALSE; if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name )) return FALSE;
if (!FILE_Stat( full_name.long_name, &info )) return FALSE; if (!FILE_Stat( full_name.long_name, &info, NULL )) return FALSE;
lpFad->dwFileAttributes = info.dwFileAttributes; lpFad->dwFileAttributes = info.dwFileAttributes;
lpFad->ftCreationTime = info.ftCreationTime; lpFad->ftCreationTime = info.ftCreationTime;
......
...@@ -73,7 +73,7 @@ extern int FILE_strcasecmp( const char *str1, const char *str2 ); ...@@ -73,7 +73,7 @@ extern int FILE_strcasecmp( const char *str1, const char *str2 );
extern int FILE_strncasecmp( const char *str1, const char *str2, int len ); extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
extern void FILE_SetDosError(void); extern void FILE_SetDosError(void);
extern int FILE_GetUnixHandle( HANDLE handle, DWORD access ); extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ); extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink );
extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 ); extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES sa, DWORD creation, LPSECURITY_ATTRIBUTES sa, DWORD creation,
......
...@@ -3309,7 +3309,6 @@ typedef enum tagSID_NAME_USE { ...@@ -3309,7 +3309,6 @@ typedef enum tagSID_NAME_USE {
#define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800L #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
#define FILE_ATTRIBUTE_OFFLINE 0x00001000L #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
#define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
/* File notification flags */ /* File notification flags */
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment