Gives back the ERROR_FILE_NOT_FOUND to GetFileAttributes.

This commit is contained in:
Gerard Patel 2001-02-16 19:05:42 +00:00 committed by Alexandre Julliard
parent 4988696cd4
commit d52e1c4be9
3 changed files with 14 additions and 10 deletions

View File

@ -44,7 +44,7 @@ static DOS_FULL_NAME DIR_System;
* Get a path name from the wine.ini file and make sure it is valid.
*/
static int DIR_GetPath( const char *keyname, const char *defval,
DOS_FULL_NAME *full_name )
DOS_FULL_NAME *full_name, BOOL warn )
{
char path[MAX_PATHNAME_LEN];
BY_HANDLE_FILE_INFORMATION info;
@ -55,6 +55,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
(!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")))
{
if (warn)
MESSAGE("Invalid path '%s' for %s directory: %s\n", path, keyname, mess);
return 0;
}
@ -90,9 +91,9 @@ int DIR_Init(void)
DRIVE_Chdir( drive, cwd );
}
if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows )) ||
!(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System )) ||
!(DIR_GetPath( "temp", "c:\\windows", &tmp_dir )))
if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows, TRUE )) ||
!(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System, TRUE )) ||
!(DIR_GetPath( "temp", "c:\\windows", &tmp_dir, TRUE )))
{
PROFILE_UsageWineIni();
return 0;
@ -147,7 +148,7 @@ int DIR_Init(void)
TRACE("Cwd = %c:\\%s\n",
'A' + drive, DRIVE_GetDosCwd( drive ) );
if (DIR_GetPath( "profile", "", &profile_dir ))
if (DIR_GetPath( "profile", "", &profile_dir, FALSE ))
{
TRACE("USERPROFILE= %s\n", profile_dir.short_name );
SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name );

View File

@ -843,6 +843,12 @@ BOOL DOSFS_GetFullName( LPCSTR name, BOOL check_last, DOS_FULL_NAME *full )
TRACE("%s (last=%d)\n", name, check_last );
if ((!*name) || (*name=='\n'))
{ /* error code for Win98 */
SetLastError(ERROR_BAD_PATHNAME);
return FALSE;
}
if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
flags = DRIVE_GetFlags( full->drive );

View File

@ -589,11 +589,8 @@ DWORD WINAPI GetFileAttributesA( LPCSTR name )
SetLastError( ERROR_INVALID_PARAMETER );
return -1;
}
if (!*name || !DOSFS_GetFullName( name, TRUE, &full_name ))
{
SetLastError( ERROR_BAD_PATHNAME );
if (!DOSFS_GetFullName( name, TRUE, &full_name) )
return -1;
}
if (!FILE_Stat( full_name.long_name, &info )) return -1;
return info.dwFileAttributes;
}