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

This commit is contained in:
Alexandre Julliard 2002-10-25 03:32:10 +00:00
parent 5a11b009f1
commit 64e047fed3
6 changed files with 13 additions and 15 deletions

View File

@ -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 );
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")) ||
(!(GetLongPathNameW(full_name->short_name, longname, longname_len))) )
{

View File

@ -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 )
{
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 );
char *p, buffer[MAX_PATHNAME_LEN];
const char *drive_path;
@ -1704,6 +1704,7 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
LPCWSTR long_name, short_name;
BY_HANDLE_FILE_INFORMATION fileinfo;
WCHAR dos_name[13];
BOOL is_symlink;
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 )
/* Check the file attributes */
WideCharToMultiByte(DRIVE_GetCodepage(info->drive), 0, long_name, -1,
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);
continue;
}
if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_SYMLINK) &&
(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
if (is_symlink && (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
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};

View File

@ -1104,7 +1104,7 @@ int DRIVE_Chdir( int drive, LPCWSTR path )
buffer[MAX_PATHNAME_LEN - 1] = 0; /* ensure 0 termination */
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))
{
SetLastError( ERROR_FILE_NOT_FOUND );

View File

@ -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.
*/
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;
int is_symlink;
@ -759,7 +759,6 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
/* fill in the information we gathered so far */
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 */
p = strrchr( unixName, '/');
@ -774,7 +773,7 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
if (!show_dot_files)
info->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
}
if (is_symlink_ptr) *is_symlink_ptr = is_symlink;
return TRUE;
}
@ -849,7 +848,7 @@ DWORD WINAPI GetFileAttributesW( LPCWSTR name )
}
if (!DOSFS_GetFullName( name, TRUE, &full_name) )
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;
}
@ -3361,7 +3360,7 @@ BOOL WINAPI GetFileAttributesExW(
LPWIN32_FILE_ATTRIBUTE_DATA lpFad =
(LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
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->ftCreationTime = info.ftCreationTime;

View File

@ -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 void FILE_SetDosError(void);
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 HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES sa, DWORD creation,

View File

@ -3309,7 +3309,6 @@ typedef enum tagSID_NAME_USE {
#define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
#define FILE_ATTRIBUTE_OFFLINE 0x00001000L
#define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
/* File notification flags */
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001